This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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.