• 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

Regarding Request Parameter Passing

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the book of Sierra for SCWCD, it is written that when a jsp is included/forwarded, parameters can be sent, and are sent as request parameters. My question is how request 'parameters' are 'set' in this case?
How will the converted servlet look like?
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amol,

parameters are written in web.xml and are deploy time constants and . We can get parameters but we can't set the parameters as in case of Attributes...

hope this help.
 
Amol Lekurwale
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by raunak saxena:
Hi Amol,

parameters are written in web.xml and are deploy time constants and . We can get parameters but we can't set the parameters as in case of Attributes...

hope this help.



I meant parameters which are sent to the included/forwarded jsp (using RequestDispatcher),not form parameters. It is mentioned in the book that <jsp : param name="xyz" value="pqr"> go as request parameter, which are retrived in the forwarded/included as request.getParameter("xyz");
What goes on in the servlet, to which the JSP's are converted
[ June 13, 2008: Message edited by: Amol Lekurwale ]
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container implementation might have parameter setters that are accessible to the translated JSP's Servlet class.
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Amol Lekurwale:
In the book of Sierra for SCWCD, it is written that when a jsp is included/forwarded, parameters can be sent, and are sent as request parameters...



On what page?
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that in the book they refer to request parameters, NOT init parameters.
init parameters are constants defined in web.xml.

Example of sending parameters with <jsp:include> or <jsp:forward> :
<jsp:include page="login.jsp">
<jsp aram name="username" value="jsmith" />
</jsp:include>
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
its reallly a good question? Anyone cheack it out what servlet code is generated for these params. I too waiting for solutions to this query.
 
Amol Lekurwale
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I meant request parameters and not INIT parameters. In the book its clearly mentioned that they are sent as "Request Parameters"
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the servlet that is generated from the JSP, the container makes a call to an include() method. One of the parameters is the request path. If you specified a parameter with <jsp:param ... />, that parameter is tacked onto the end of the path.

For instance, if my JSP contains:



the servlet generated by the container (in this case, Tomcat) will have:



Not the most readable code in the world, but it works.

Hope this helps.

Sorry for the multiple edits. Those smilies kept trying to sneak back into my listings.

[ June 16, 2008: Message edited by: John Pearson ]

[ June 16, 2008: Message edited by: John Pearson ]
[ June 16, 2008: Message edited by: John Pearson ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic