• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

values from jsp to servlet

 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please show how you're trying to use it, and what the exact error is.
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic