Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Request Parameter Passing

 
Amol Lekurwale
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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?
 
Maneessh saxena
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
Srinu Nanduri
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container implementation might have parameter setters that are accessible to the translated JSP's Servlet class.
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • 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?
 
Antonio Tercero
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • 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>
 
Anand Bhatt
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • 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
  • 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"
 
John Pearson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic