This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with request parameter

 
Rehana Shaik
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new to struts. I am having one link on normal jsp page which is having one parameter in querystring .the invoked has to invoke differnt pages depends on the parameter that is included in the url. but i am unable to get the value of the parameter in the action class by request.getParameter(string).My link is like this /update.jsp?from=update .I want from value in updateAction class.
Thanks in advance
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you have mapped all *.jsp URLs to the Struts ActionServlet in your web.xml, your link will not go through the Struts framework.
See example of how you would map a URL pattern to the ActionServlet at http://www.reumann.net/do/struts/lesson1/step7)
You need your link to go through an Action, e.g. via /update.do in which case I wouldn't think you should need a request parameter. At any rate, you can still put a parameter, e.g. /update.do?from=update if you really want to (doesn't that seem redundant to you though?). The Action mapped to update.do would need to be associated with an ActionForm that has the methods getFrom()/setFrom().
In the Action, you normally don't need to extract parameters from the request since those values have already been transferred into the ActionForm (and converted to the appropriate type) for you by Struts.
Go through the tutorial I cited above to get a good understanding of the basics.
 
Rehana Shaik
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic