struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Mähler <>
Subject [S2] Recipe for Action and View
Date Thu, 10 Jul 2008 12:12:39 GMT
Hello everyone,

this is my first S2 project - i am a newbie (although i have a tiny
little experience with S1...). :-)

I am storing my view (JSP) files in /WEB-INF/jsp/... so they cannot be
accessed directly to prevent links from external pages that contain fake
parameters. Therefore all requests are handled by actions.

AFAIR, the current coding practice in S1 is to use an action that caters
a form (e.g. prepopulate) and presents the view to the user. A second
action then takes care of the form processing (including validation and
                                                  <<success>> |
        /-----------------\    +--------------+     /-----------------\
   --->( presentFormAction )-->|   form.jsp   |<-->( processFormAction )
        \-----------------/    +--------------+     \-----------------/

My questionis the following: Is it possible to merge these two actions
into a single one? Or are there any drawbacks?

               | <<success>>
        /--------------\     +--------------+
   --->(   formAction   )<-->|   form.jsp   |
        \--------------/     +--------------+

The problem seems to be the validation. Of course, I don't want the
initial request (with all params set to null) validated (and the error
messages generated).

A solution could be to assign a param/value pair to the "Submit"-Button
and let an interceptor check for it. If not found, forward to INPUT..
The interceptor must fire before the error-generating interceptors
(conversionError, validation and workflow AFAIK).

Is there a good way to do this? Maybe I am not the first one who wants
to do it and there is already something in the default interceptor
stack. I wouldn't touch the S2-defaults until I really must.

Or is there a reason why my approach wouldn't work? Proposals are
welcome :-)

Thanks very much in advance,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message