struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Mitchell" <>
Subject RE: Need Answers on questions before going in to speed mode
Date Thu, 17 Oct 2002 14:40:35 GMT
> -----Original Message-----
> From: Smith, Johnathan M. []
> Sent: Thursday, October 17, 2002 7:24 AM
> To: ''
> Subject: Need Answers on questions before going in to speed mode
> We are about to start coding the real project now so I would like to ask
> some last question to know that I am going do the right road.
> 1) User cant go right to JSP:
>     We are making it so the user has to go to a URI in the struts
> config not
> right to a URI is this ok


> 2) JSP returns always to the URI/Action that display it:
>     Sample: User will enter a URI of the data input screen
> (/project/ the action will then forward to the input JSP
> page. After
>     entering the some data the user clicks the submit button and the page
> will submit back to /project/ but this this time in
>     the action looks for some fields and then in forwards to the
> /project/ urI?
> 	2.1 is this right??

That would be a personal preference.  I’ve developed apps that use both

> 	2.2 should I always go back to the same action that displayed the
> page first then forward to the next URI?

See above answer

>             2.3 should I forward to a URI /project/ or to a JSP
> page?

Keep in mind that this:
1. jsp -> someProcessingAction -> jsp

is the standard approach....

but many people are doing this:
2. jsp -> someProcessingAction -> someSetupForNextViewAction -> jsp

I much rather prefer the second approach although, the formbean is
repopulated from the original request, so changes to it in
someProcessingAction will not be seen in someSetupForNextViewAction.  I have
seen several lengthy threads about why this happens and why some feel it
should be changed.  For those who don’t understand the impact of this, they
are better off not doing it this way.

> 3) At this time I am always going back to the same action(URI)
> that display
> my page, so the first time in a data input screen I don't went
> the validate
> to validate in the form bean validate should I just check for
> some field and
> if the field is not filled in then don't validate?

No.  If that field is one of the ones on the page and is required, then if
it come in blank, how would you know if it was the ‘send me to fill in the
form’ action and not the ‘I’ve filled in the form, but left this field blank
’ action?

In the case where I reuse the same action classes, and branch logic based on
some variable passed along in the request, I usually rely on a hidden field
named ‘action’ or I will name my submit buttons ‘action’ (which throws you
to ‘how to tell when submit is i18n’d argument)

Well, that’s my $.02 for now.

James Mitchell
Software Engineer/Struts Evangelist

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

View raw message