Hi,

I'm intereseted if you found a better solution, because I have this problem
too

best regards,
Slavic

----- Original Message -----
From: "James Higginbotham" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 2:44 AM
Subject: MVC + Validation tips?


Hi,

After searching the archives, I couldn't find an email that described a
good solution to my question, and Ted's sample chapter on Validation
didn't touch on it either. I have an action that is called which
prepares the appropriate data and forwards to a JSP which contains a
struts form. I have validation turned on now, so the action tries to
validate and fails when its initially called, thus preventing my data
from being loaded (it just goes to the input page, itself). My current
workaround is to do the following:

    <action path="/editor"
            type="my.editor.EditorAction"
            name="editor"
            scope="request"
            input="editor.default"
            validate="false">
      <forward name="editor.default"
               path="editor.default"/>
    </action>

    <action path="/editorSave"
            type="my.editor.EditorAction"
            name="editor"
            scope="request"
            input="editor.default">
      <forward name="editor.default"
               path="editor.default"/>
      <forward name="editor.save.success"
               path="/viewer.do"/>
      <forward name="editor.cancel"
               path="/viewer.do"/>
    </action>

I then call the /editor.do first, and that renders a JSP that will POST
to /editorSave.do and validate the form. Is there a better way to handle
this, or is this the preferred method when honoring MVC and only
requesting pages via Actions?

Thanks,
James




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to