views:

298

answers:

0

I have in struts.xml :

    <action name="MyAction!*" class="my.Action" method="{1}">
        <result name="step1">step1.jsp</result>
        <result name="step2">step2.jsp</result>         
        <result name="error">error.jsp</result>
    </action>

Then my my.Action class has various methods that can be called by specifying the name in the URL, eg :

http://localhost:8080/MyApp/MyAction!method1.action

Now let's say that the fields firstName and lastName are mandatory in one method (e.g. first step of a registration) and not in the other methods.

If I make a general validation file like MyAction-validation.xml, it will make the fields required for all methods. If I make a specific validation like MyAction-method1-validation.xml it is not taken into account.

Is there a solution ?

Otherwise I'll have to map a different action in struts.xml for each method and not use dynamic method invocation - or do my validation manually.