File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes values from jsp to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "values from jsp to servlet" Watch "values from jsp to servlet" New topic
Author

values from jsp to servlet

Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
I have a variable on my jsp which I want to use on my servlet. The param option I would like to use but I keep getting an error saying it needs to be enclosed in another call. I don't know which jsp method to use. help!
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

please show how you're trying to use it, and what the exact error is.


[My Blog]
All roads lead to JavaRanch
Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
here is what I have:
<jsp:useBean id="buyBean" class="buyer.buyBean" scope="session"/>

<jsp :param name="ISBN" value="ISBN>value"/>
and it tells me it can not be used outside a jsp :params, a jsp:include or a jsp:forward.

How do I do that?
I tried to put the param inside these statements and it says for the jsp:include jsp:forward that they need terminated. The jsp :p arams says it must be a child?

[BPSouther: Disabled graemlins for this post to stop JSP tags from grinning at us]
[ December 01, 2006: Message edited by: Ben Souther ]
Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
I got it to work sort of. It is noe asking for the standard name and value. apparently it does not like ISBN and ISBN.value.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Donna Bachner:
I got it to work sort of. It is noe asking for the standard name and value. apparently it does not like ISBN and ISBN.value.


No, your naming should follow the standard javabean convention.
Example: a property with getFirstName and setFirsName accessors and mutators would have the following name value in your JSP tags fistName.
Using all capital letters will throw the JSP compiler off.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
The value I am trying to get is in a text box in the jsp. How do I get the value from the GUI? I changed the name to isbn the value would be isbn.value.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You may want to read up on servlets/jsp. There are several free books out there. I would recommend "core servlet and JSP by Marty Hall"

In your jsp you have a textbox called ISBN. To read the value associated with that textbox in your servlet use getParameter("ISBN")on the request object.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: values from jsp to servlet