Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Passing form varables in a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Passing form varables in a servlet" Watch "Passing form varables in a servlet" New topic

Passing form varables in a servlet

Tom Caldwell
Ranch Hand

Joined: Oct 09, 2000
Posts: 39
I have a database servlet that displays the query results in a html form so that I can click on a row in the results to kick off a 2nd servlet. This all works fine and both servlets run but I'm unable to pass varables as in >
out.println("... onClick=SubmitForm()... in this case submit servlet # 2
out.println("<INPUT TYPE=hidden NAME=parmx value=parm1>");
My problem is that a getParameter("parmx") in servlet # 2 always returns parm1 and not the value of parm1 ???
I expected something like this to work
("<INPUT TYPE=hidden NAME=parmx value="parm1">");
Can't I do it this way???
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
I don't quit understand whet you are asking, but is it as simple as:

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Tom Caldwell
Ranch Hand

Joined: Oct 09, 2000
Posts: 39
Close!! and I didn't think I explained it very well, sorry.
I've already done a getParamer earlier so I'm now just trying to do out.println("<INPUT type='hidden' name='parmx' value='" + parm1 + "'>");
which produces <INPUT type='hidden' name='parmx' value=''> or doesn't pass the value ???
I agree. Here's the link:
subject: Passing form varables in a servlet
Similar Threads
Servlet becomming slow
Servlet becomming slow
Forms in servlet
Three buttons in one form
Passing values from a form inside a form?