struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Wannemacher <w...@wantii.com>
Subject Re: [s2] design problem
Date Mon, 07 Dec 2009 15:20:15 GMT
On Mon, Dec 7, 2009 at 3:03 AM, Tudor Andrei Raneti <w0lfshad3@yahoo.com> wrote:
> i load up dataParams.jsp from main.jsp:
> [code]  <c:when test="${param.dataParams == 'show' and param.data == null}">
>     <s:action name="dataParams_input" executeResult="true"></s:action></c:when> 
[/code]
> i map it in struts.xml:
> [code]  <action name="dataParams_*" method="{1}" class="loto.action.DataParams">
>    <result type="redirectAction">/jsp/main.jsp</result>
>    <result name="input">/jsp/dataParams.jsp</result>
>   </action>  [/code]
> and set up a DataParams-validator.xml.
> The problem starts when i submit dataParams.jsp 's form:
> [code] <form action="dataParams" method="get"> [/code]
> because it's supposed to validate while beeing loaded by main.jsp, but it displays alone
not included in main.jsp when it displays errors.


This is by design (sort of), your "input" result dispatches to
/jsp/dataParams.jsp directly. It works on the first request because
you are using executeResult="true" in your s:action tag... But, if you
want input to go to main.jsp, then dispatch there on input... The
trouble you will then have is that it will create an infinite loop...
My suggestion is that you redesign your pages and flow so that it does
not depend on the s:action tag.

> The key to this problem is what should i write in <form action="????????????" to make
this work the way i aim?

As I mention above, you are going to run into trouble no matter how
you try to work this out... Try to avoid the s:action tag.


>
> Further thoughts:
> If i dataParams action doesn't get called when dataParams submits, the struts 2 xml validation
doesn't fire.
> dataParams.jsp is supposed to be always included in main.jsp though, showing errors or
not,
> but if i call main action, the struts 2 xml validation is always bypassed by the input
action.
> dataParams bypasses validation the first time because it doesn't need to validate when
first shown (like in HelloWorld), should i validate from start and live with it?
> Maybe action chaining would do it? I don't know...
>


I hate to say it, but you might want to spend some more times looking
through examples or get a copy of Struts 2 In Practice from Manning
Publications or Apache Struts 2 Web Application Development by Dave
Newton.

-Wes


-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message