This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Accessing form members... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Accessing form members..." Watch "Accessing form members..." New topic

Accessing form members...

Tom Diamond
Ranch Hand

Joined: May 10, 2001
Posts: 98
Is there a way to access a form member (textfield, textArea, and so on) in a JSP page?
I mean is there an equivalent to javascript's

What I actually want to do is to take the text from a textField and pass it as a parameter to another jsp with the click of a custom button (not the default <input type=submit> ) :


[This message has been edited by Tom Diamond (edited October 15, 2001).]
Karen Berx

Joined: Oct 15, 2001
Posts: 3
I don't think you can do it in JSP only.
You can do a get on your current JSP page. Then you can receive the parametervalues of your form-fields.
Or use javascript in your JSP-pages. I do that.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

well remember that JSP is server side, so your <%= %> tags won't have anything in them, because the client side has to fill them in first.

what about simply calling javascript inline? I'm not too good at javascript, but I remember having to do something very similar to this.. tomorrow at work I'll look it up and post, if my memory isn't totally shot.
Tom Diamond
Ranch Hand

Joined: May 10, 2001
Posts: 98
I 've tried Javascript and it works just fine but if anyone knows something more I would like to know...
It is sorta covered in the JavaRanch Style Guide.
subject: Accessing form members...
Similar Threads
JSP and Javascript problem
simple question
getting the URL for the calling jsp page?
encode namsepace in portlets
passing jsp variable to java script function on same page