开发者

struts2 validation result input cannot be an action

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜