Thanks, Chris:

I tested your proposed solution very quickly -- just printing out the
retrieved formName on my JSP -- and it does work.

I'm surprised, though, that it isn't easier than that; it seems that the
formName should be available via the bean:struts tag, or some similar
tag.

Now I have to integrate the solution into my app.  Like many newcomers,
I'm wavering back and forth between having a large number of very simple
JSPs, or a small number of more complex JSPs.  It's nice to know that,
using your solution, I at least have the option.

-----Original Message-----
From: Bartley, Chris P [PCS] [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 20, 2002 12:19 PM
To: 'Struts Users Mailing List'
Subject: RE: Re-using JSP pages -- Follow-up


Something like this might work:

<bean:define id="actionMappingForThisScreen"
name="org.apache.struts.action.mapping.instance"
type="org.apache.struts.action.ActionMapping"/>
<bean:define id="formName" name="actionMappingForThisScreen"
property="name" type="java.lang.String" /> <bean:define id="formBean"
name="<%= formName %>" type="org.apache.struts.action.ActionForm"/>

I haven't tested it, but i *think* it'll work since i *think* the
current action mapping is stored in the request under the key
"org.apache.struts.action.mapping.instance".  The above code should help
you get the form bean's name and a reference to the bean itself.

chris

> -----Original Message-----
> From: Charles McClain [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 11:13 AM
> To: Struts User Mailing List
> Subject: Re-using JSP pages -- Follow-up
> 
> 
> All:
> 
> This is a follow-up to my earlier post on the same topic.  Although I 
> received a response, I think it wasn't the response I needed because I

> didn't ask my question correctly.
> 
> Boiled down -- and ignoring all the background of why I need it, which

> may have confused people -- I want:
> 
> --  To pass different form-beans to the same JSP;
> --  To have the JSP figure out the name of the form-bean it
> received, so
> it can use that form-bean name in various tags.
> 
> I'm sure the form-bean name must be easily available to the JSP, but I

> have searched the Struts User Guide and the taglib documentation, and 
> I can't figure out how .  Can anyone help?
> 
> Thanks again in advance.  You guys were very responsive before; I just

> needed to phrase my question more simply.
> 
> Charles McClain
> Phone:  603.659.2046
> email:    [EMAIL PROTECTED]
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 

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



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

Reply via email to