Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 92677 invoked from network); 30 Aug 2007 17:05:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Aug 2007 17:05:31 -0000 Received: (qmail 77539 invoked by uid 500); 30 Aug 2007 17:05:17 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 77509 invoked by uid 500); 30 Aug 2007 17:05:17 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 77493 invoked by uid 99); 30 Aug 2007 17:05:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2007 10:05:17 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2007 17:05:11 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IQnRr-0006Au-Dh for user@struts.apache.org; Thu, 30 Aug 2007 10:04:51 -0700 Message-ID: <12411676.post@talk.nabble.com> Date: Thu, 30 Aug 2007 10:04:51 -0700 (PDT) From: afp To: user@struts.apache.org Subject: Re: How to access request & session objects in jsp using struts2 tags In-Reply-To: <42db7f0a0708300906w7e363370y7a97bd152171914a@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: arup.francis@bankofamerica.com References: <12407850.post@talk.nabble.com> <42db7f0a0708300906w7e363370y7a97bd152171914a@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org By implementing the interfaces I will have access to Request and session objects in action class alone or also in the jsp's and that too in struts2 tags only and not using scriptlets? To make it more clear will print "xyz" if the url for the page was *.action?abc=xyz Is the syntax that I used correct for accessing the request parameter called "abc" with value "xyz". I am trying to do something like this but not able to succeed. Will implementing RequestAware interface in the action class make the above work and xyz be printed?? Also see if you can help me out with the last two issues that I mentioned in the first post. Chris Pratt wrote: > > If you just need access to the Request Attributes, try implementing > RequestAware in your action. If you need access to other, more > Servlet specific, parts of the Request, you'll have tto implement > ServletRequestAware. Similarly for Sessions, if you just need the > attributes, implement SessionAware, if you need full access implement > ServletRequestAware and call request.getSession(). > (*Chris*) > > On 8/30/07, afp wrote: >> >> Hi, >> >> I am trying to identify whether a button has been clicked or not in my >> jsp. >> The way I do this or is trying to do this is to access the request object >> and then check in that for the button name. The code is as shown below >> >> The button which was clicked is coded as shown below >> > title="Continue" /> >> >> The piece of code where I am trying to check for the button in the jsp >> >> HI >> >> <% request.setAttribute("currentSection","All"); %> >> >> >> <% request.setAttribute("currentSection","no"); %> >> >> >> Now I know that the parameter "action:InitAction_stub.x" is present in >> the >> request Map as I can see that in the Action class which later forwards to >> the jsp. But I am unable to access it in the jsp. >> >> Is the way I am trying to access the request parameter wrong? >> If so how do I get a request parameter in the jsp - I saw the following >> usage in one of the struts2 pages >> >> this shud >> ideally >> print out the value of the button or any other request parameter. But >> nothing gets printed. So where am I going wrong and what do I need to do? >> >> Also along with this is there any way I can do the below without using >> scriptlets >> <% request.setAttribute("currentSection","All"); %> >> >> Also say I have an object in my action class will I be able to rewrite >> the >> value of that object by using the set statement i.e. will > name="abc.currentDisplaySection" value="%{'All'}" /> where abc is an >> object >> which is specified in the action class and has getters and setters. My >> doubt >> is whether the above statement will update the currentDisplaySection >> variable under abc object?? so that if I say print out the value later >> using >> a it shud print out >> 'All". >> Will this work?? >> >> >> TIA, >> Arup >> -- >> View this message in context: >> http://www.nabble.com/How-to-access-request---session-objects-in-jsp-using-struts2-tags-tf4354438.html#a12407850 >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >> For additional commands, e-mail: user-help@struts.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > > > -- View this message in context: http://www.nabble.com/How-to-access-request---session-objects-in-jsp-using-struts2-tags-tf4354438.html#a12411676 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org