That's what one of my solutions was too, although I wasn't 100% sure the 
mapping instance was actually in request (I thought I remembered seeing it, but 
wasn't sure).

The argument against doing that though is that the attribute name could 
conceivably be changed down the road, breaking your code.  If your going to do 
something like this, you might be better off doing...

request.setAttribute("mapping", mapping);

...in your Actions, assuming mapping is the name of the variable passed to 
execute() for the ActionMapping object.  Yes, it's a bit of extra work in all 
the Actions, but it insulates your app from changes to the attribute name down 
the road.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, December 23, 2004 4:29 am, Paul McCulloch said:
> When you execute an action the name of the action from used is set in a
> request scope attribute "org.apache.struts.action.mapping.instance". It's
> a
> fairly simple matter to get the actual actionform object if you know the
> scope. For instance, all my forms are session scope so I can get the
> just-used form with:
> 
>               <c:set scope="page" var="formBean"
> value="${sessionScope[requestScope['org.apache.struts.action.mapping.instanc
> e'].name]}"/>
> 
> If you don't know the scope then you'll need a bit more logic to get the
> formbean.
> 
> Does that help?
> 
> Paul
> 
>> -----Original Message-----
>> From: Donie Kelly [mailto:[EMAIL PROTECTED]
>> Sent: 22 December 2004 14:59
>> To: Struts Users Mailing List
>> Subject: Accessing my form from an included page
>>
>>
>> Hi all
>>
>>
>>
>> I have the following jsp layout for my pages
>>
>>
>>
>> Included header.jsp
>>
>> STRUTS PAGE
>>
>> Included footer.jsp
>>
>>
>>
>> Now in the header.jsp I have my site logo and I also want to add
>> breadcrumbs. I want to establish and maintain a session
>> throughout the app
>> and if the session is invalid i want to redirect to the
>> starting page so
>> that I can initialise the app. I presume I need to put code in the
>> header.jsp to handle this so no matter which page is accessed
>> it can do
>> these checks.
>>
>>
>>
>> I also want to access the ActionForm for the current page so
>> that I can
>> retrieve the page name to build up the breadcrumb. How can I do this?
>>
>>
>>
>> Any pointers would be appreciated.
>>
>> Donie
>>
>>
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Anti-Virus.
>> Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 21/12/2004
>>
>>
> 
> Axios Email Confidentiality Footer
> Privileged/Confidential Information may be contained in this message. If
> you are not the addressee indicated in this message (or responsible for
> delivery of the message to such person), you may not copy or deliver this
> message to anyone. In such case, you should destroy this message, and
> notify us immediately. If you or your employer does not consent to
> Internet email messages of this kind, please advise us immediately.
> Opinions, conclusions and other information expressed in this message are
> not given or endorsed by my Company or employer unless otherwise indicated
> by an authorised representative independent of this message.
>  
> WARNING:
> While Axios Systems Ltd takes steps to prevent computer viruses from being
> transmitted via electronic mail attachments we cannot guarantee that
> attachments do not contain computer virus code.  You are therefore
> strongly advised to undertake anti virus checks prior to accessing the
> attachment to this electronic mail.  Axios Systems Ltd grants no
> warranties regarding performance use or quality of any attachment and
> undertakes no liability for loss or damage howsoever caused.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to