Thanks, at least it's a working work-around. But the ugly thing is, that in
both cases the same action is called and I am forced to call the "real"
action
from the first action depending on the pushed button.
+ Action inserts "fire" bean into rquest context
+ Forward to JSP
+ JSP checks to see if fire==first. If so, write TheFirstAction button
+ JSP checks to see if fire==second. If so, write TheSecondActon button
+ submit "fires" action
+ action does nothing and forwards to the "real" action depending on the
button.
In my real world the page will be reused at least 5 or six times. So rather
than
putting the "Control" part of MVC in the struts-config.xml I start
piggypacking info
in the request and analysing this in the dummy action.
However again thanks.
Peter
-----Ursprungliche Nachricht-----
Von: Ted Husted [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 31. Juli 2001 15:49
An: [EMAIL PROTECTED]
Betreff: Re: action-mapping: why must the action-Attribute path be
equivalent to the name of the jsp?
At this time, the current ActionMapping is not exposed to the JSP, so it
really can't tell which ActionMapping was used to call it. (Though, it
would be cool they could;-)
You might want to route control first through an Action, and then to the
JSP. This way you can put something in the request context to help write
the control. Right now, the simplest thing would be to put two copies of
the button in your JSP, enclosed within logic:equal tags. The tags could
then check to see if they should write the button for TheFirstAction or
TheSecondAction.
+ Action inserts "fire" bean into rquest context
+ Forward to JSP
+ JSP checks to see if fire==first. If so, write TheFirstAction button
+ JSP checks to see if fire==second. If so, write TheSecondActon button
-Ted.
[EMAIL PROTECTED] wrote:
>
> Hello,
> does anyone have an idea, how to use the same physical jsp page in
different
> action mappings (with different actions).
> I do not see a way to describe that my action path should be a locigal
path
> using a page, which does not fit to
> the pathname of the page.
>
> Example:
> JSP is page1.jsp with one button
> if I call this page as /page1 it should fire TheFirstAction,
> if I call this page as /page2 it should fire TheSecondAction
> But which parameter in the action mapping gives me a possibilty to
declare
> that page1.jsp
> should be found as page1.jsp AND as page2.jsp?
>
> <action-mappings>
> <action path="/page1"
> type="TheFirstAction"
> name="Page1Form"
> NOTKNOWNATTRIBUTE="page1.jsp"
> <forward name="success" path="/page3.jsp"/>
> </action>
>
> <action path="/page2"
> type="TheSecondAction"
> name="Page1Form"
> NOTKNOWNATTRIBUTE="page1.jsp"
> <forward name="success" path="/page4.jsp"/>
> </action>
> <action-mappings>
>
> The problem is: why must the action-Attribute path be equivalent to the
name
> of the jsp?
>
> If anyone has understood what I am looking for, I would be very happy and
> thankful for help....
>
> Peter