You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stetze2008 <st...@gmx.de> on 2008/05/26 11:28:33 UTC
Problem with Struts 2 + Tiles 2 + Validation (result input)
hi,
I'm using Struts 2 and Tiles 2 and have a problem concerning the form
validation.
If one action throws a validation error (because for example one form
field is empty) ALL other actions (which are part of the tiles template)
call the defined tiles definitions for the result "input" and not only
that action that throws the validation error. therefore my top module
jumps back to login mode if there is a validation error on the user's
profile page.
this is my *tiles.xml*:
<definition name="base.definition" template="/layouts/wmBoerseLayout.jsp">
<put-attribute name="module" value="/menu/module.action"/>
<put-attribute name="std_menu" value="/common/menu.jsp" />
</definition>
<definition name="page.user.profile" extends="base.definition">
<put-attribute name="body-content" value="/pages/profile.jsp"/>
</definition>
this is my *struts.xml*:
<action name="module" class="userAction" method="module">
<interceptor-ref name="myStack"/>
<result name="user">/modules/user.jsp</result>
<result name="admin">/modules/admin.jsp</result>
<result name="login">/modules/login.jsp</result>
<result name="input">/modules/login.jsp</result>
<result>/modules/login.jsp</result>
</action>
<action name="editProfile" class="profileAction" method="editProfile">
<result type="tiles">page.user.profile</result>
<result name="input" type="tiles">page.user.profile</result>
</action>
The problem is that if the action editProfile returns a validation error
it uses the tiles definition page.user.profile defined for the result
input of this action.
But the definition page.user.profile extends the tiles definition
base.definition and in this base definition another action
(/menu/module.action) is called to determine the correct top module to
be shown. Now it seems that this action is not invoked but also for this
action the definition defined for the result input is shown (in this
case the login.jsp what is definitely wrong when the user is logged in)
I would be glad if anyone could help!
Best regards,
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org