File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes problem with request parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with request parameter" Watch "problem with request parameter" New topic
Author

problem with request parameter

Rehana Shaik
Ranch Hand

Joined: Jan 03, 2003
Posts: 33
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

Joined: Feb 26, 2001
Posts: 4456
    
    6

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
Rehana Shaik
Ranch Hand

Joined: Jan 03, 2003
Posts: 33
Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with request parameter