views:

81

answers:

2

Hi I have an action Registration.java which is used for users to create an account. this action class has two methord: doList and execute. doList gets data from the database and renders the initial jsp page with some s:select tags. execute do the actual business logics.

in the struts.xml:

   <action name="InitList" method="list"  class="......Registration" >
     <result name="success">/..../...../Registration.jsp</result>

  <action name="Registration" class="......Registration">   
    **<result name="input" >InitList.action</result>**
    <result name="next" type="redirect">InitListReg.action</result>
  </action>

I also have a validation config file: RegistrationAction-Registration-validation.xml

when i created some validation error and the intial page was not displayed with the error: InitList.action is not available. It seems strut2s did not recognized the action InitList. When i change the result input like this:

  <action name="Registration" class="......Registration">   
    **<result name="input" type="redirect">InitList.action</result>**
    <result name="next" type="redirect">InitListReg.action</result>
  </action>

the initial page was displayed successfully, but the validation error messages were lost and not displayed because of "redirect".

So i wonder if input can be an action or only support jsps. Or how can i fix my problem?

A: 

When you use the Struts2 Validations togehther with redirect you need the MessageStoreInterceptor.

jogep
yes, it, works. thanks very much
Heng
A: 

I have the exact same problem. I tried to use type="chain", but still I am loosing my validation errors.

Is there any better way to do this rather then using MessageStoreInterceptor?

goodsanket