This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Pass parameters to the servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Pass parameters to the servlet" Watch "Pass parameters to the servlet" New topic

Pass parameters to the servlet

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
I have a MIDlet which calls a Servlet. So far what I did was just used the write(byte b) method of the DataOutputStream to write the parameter to the servlet. What I want to know is, how can I write two different parameters. For example 'name' and the 'age' to the servlet at once. Same time how can I get these two parameters seperately. Thanks in advance........

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Lisa D'Aniello
Ranch Hand

Joined: Sep 25, 2003
Posts: 42

I'm not sure if this is the best advice, but if it suits your needs, you can pass them when you call the servlet - just as you would if you were sending them in the url of a jsp page
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Ransika,

I'm afraid I don't know anything about J2ME. You may be better off posting your question in the J2ME forum.

However, if a MIDlet is the J2ME equivalent of a Servlet (!? ?!) then this may help: if you wanted to call a servlet (called Servlet2) from a servlet, passing additional parameters, you would do the following:

Maybe you can translate that to J2ME somehow?

I agree. Here's the link:
subject: Pass parameters to the servlet
It's not a secret anymore!