File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes J2ME and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "J2ME and JSP" Watch "J2ME and JSP" New topic
Author

J2ME and JSP

Vince Hon
Ranch Hand

Joined: Feb 11, 2003
Posts: 117
Question about MIDlet and JSP.
I has written a simple jsp file that:
> Receieve the login name and password from user.
> Then, display the login name and password to users.
I use tomcat 4.1 and the jsp file works if I use IE. But how do I get the "password" and "login name" generated by the jsp file and display on the mobile phone ?
<I can connect to the web browser via the use of HttpConnection in MIDlet, but don't know how to "get" the items generated by the jsp file >
Thanks


Vince Hon<br /> <br />SCJP 1.4 | SCWCD | SCBCD <br /><a href="http://vincehon.homeip.net:8000/VJW" target="_blank" rel="nofollow">http://vincehon.homeip.net:8000/VJW</a>
Greg Schwartz
Ranch Hand

Joined: May 11, 2003
Posts: 132
Vince,
After your JSP file does whatever processing it needs to do, you need to output the the information that you would like to send back to the mobile phone. You "output" the information (username / password) as if it were going to appear on a web page. This can just be plain text or can be more involved.
After you open your HttpConnection to the JSP page you're going to want to open and InputStream and call the read() function for that InputStream. The data that is returned by the read function is the data that was the output of your JSP page (username /password).
Hope that helps...


Greg Schwartz<br />Mobatech, LLC<br />greg@mobatech.com<br /><a href="http://www.mobatech.com" target="_blank" rel="nofollow">www.Mobatech.com</a>
Vince Hon
Ranch Hand

Joined: Feb 11, 2003
Posts: 117
Yes, I solved the problem, thank you very much.
By the way, I try to use servlet rather than JSP.
It seems servlet is more convenient, right ?
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
Originally posted by Vince Hon:
Yes, I solved the problem, thank you very much.
By the way, I try to use servlet rather than JSP.
It seems servlet is more convenient, right ?

In fact, I would like to say that JSP is more convenient (no need to compile, packaging and deploy -- just copy the file). But servlet is a better solution (more capable and can adopt to different patterns) unless you server returns some sort of XML document.


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: J2ME and JSP