• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to capture form varibales in JSP and form a html link?

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have two drop down lists. Once a user selects once
item for every list, she will press on submit button.
The two lists are collections. I am trying to capture
these two values after the user submission. Can I set my
action form in session scope in action class, then get
form varaibales as strings in my jsp page?
Another question is: I will append these strings at the
end of a html link, and add to an taglib element's url parameter.
I am wondering how to do that in jsp page?
For example:
if 2 strings got from form are:
String id="111";
String ssn="333";
<mytag:table name="persons" uri="http://myweb.com/mypage?companyid="+id+"&ssn="+ssn>
In Java, we can concatenate strings like that, in Jsp, can we do that?
Or there is another way?
regards,
rick
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
first of all a JSP is simply a Servlet. It is not good practice but you can also write Scriptlets here, just put them between <% %> and the compiler will create the code in the servlet.
I wouldn't put your Form to Session if not really necessary. It you simply need it in the next step, you can store it as an attribute in the request amd simply get it out there. The main disadvantage is that when stored in the session the object exists on the heap the complete session time. So you should try to have as few objects in session as possible.
I didn't get it if the Collection is hold in your form class or directly in the request. But you can get it with on the JSP:

when the collection is directly stored in the request

[ August 05, 2003: Message edited by: Oliver Refle ]
 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Oliver:
So, my action form must be in the classpath to be imported in my Jsp file?
Sounds messy, but I will try it out if it works.
regards,

Originally posted by Oliver Refle:
Hi,
first of all a JSP is simply a Servlet. It is not good practice but you can also write Scriptlets here, just put them between <% %> and the compiler will create the code in the servlet.
I wouldn't put your Form to Session if not really necessary. It you simply need it in the next step, you can store it as an attribute in the request amd simply get it out there. The main disadvantage is that when stored in the request the object exists on the heap the complete session time. So you should try to have as few objects in session as possible.
I didn't get it if the Collection is hold in your form class or directly in the request. But you can get it with on the JSP:

when the collection is directly stored in the request

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic