struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "j alex" <>
Subject Re: some advanced questions in Struts2
Date Wed, 29 Aug 2007 19:02:11 GMT

Are you sure you pasted the right validation xml entries for username and

** As you can see for userName and password we have this attribute called
page ** -- i'm not able to understand this.

On 8/29/07, Pavel Sapozhnikov <> wrote:
> Hey guys I have posted before but I think I got no responses not sure what
> happened so here I go with more information this time. I have several
> questions about Struts2. Basically what I am trying to do is to learn
> Struts2 on my own by trying to migrate a small piece of our existing
> application which uses Struts1 / Tiles1 into Struts2 / Tiles2. I have
> successfully achieved in creating my Struts2 application but a little bit
> differently. So one of the questions that I have deals with mapping
> actions.
> I have the following action definition in struts-config.xml in S1:
> <action
>             path="/login"
>             type=""
>             name="loginForm"
>             scope="request"
>             parameter="appAction"
>             validate="false">
>             <forward name="login_entry"
> path="/WEB-INF/jsp/tiles/login/login_entry-tile.jsp" />
>             <forward name="agency_entry"
> path="/WEB-INF/jsp/tiles/login/agency_entry-tile.jsp" />
>             <forward name="temporary_password_entry"
> path="/WEB-INF/jsp/tiles/login/temporary_password_entry- tile.jsp" />
>         </action>
> So the way our Action classes are organized is we have many methods per
> Action class and as you can see only one action per class. What you also
> see
> is we have this parameter="appAction" using that we go to the actions that
> we want and we also have appContext which is essential this path attribute
> so we can go to other actions in struts-config.xml. What I have done so
> far
> is I have one action for each method in THAT class. What I use is
> type="redirect-action" to go to the action that I want and it works great.
> What I was wondering could I have the same concept in Struts2. I know I
> can
> put params in struts2 struts.xml. I also about implementing ActionMapper
> but
> I am not exactly sure what those methods do. So if you could help me out
> with that that would be terrific.
> Second question. This one deals with validation. In Struts1 we have
> validation.xml with the following example:
> <form name="loginForm">
>             <field property="appContext" depends="required">
>                 <arg0 key="appContext.displayname "/>
>             </field>
>             <field property="appAction" depends="required">
>                 <arg0 key="appAction.displayname"/>
>             </field>
>             <field property="page" depends="required">
>                 <arg0 key="page.displayname"/>
>             </field>
>             <field page="2" property="userName" depends="required">
>                 <arg0 key=" userName.displayname"/>
>             </field>
>             <field page="2" property="password" depends="required">
>                 <arg0 key="password.displayname "/>
>             </field>
>         </form>
> As you can see for userName and password we have this attribute called
> page.
> In Struts2 there is no such thing as far as I know. I think this kinda of
> behavior is what its called Validation chaining. I think what needs to
> happen is my Login application needs to have a prerequisite validation so
> even before it starts validating userName and password it needs to make
> sure
> appContext, appAction are there. I need this exact kind of behavior and I
> looked all over the place for example of validation with validation
> chaining
> and I haven't found any. Maybe there is a way to extend some other
> validation.xml which includes those things but I haven't seen people do
> that. So if you could help me with that, that would be terrific.
> --
> Pavel Sapozhnikov
> xFact, Inc

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message