Andrey Rogov wrote:

there is another way to work with parameter form:action. If you use
Tiles in your applications create one reusable tiles  lay with elements of
design, control buttons and page control. In  this case you can use the page
with many forms. Then solution <html:form action="${myFormBean.the_action_URI}"/>
can be replaced with  <html:form action="${ControlBean.the_action_URI}"/> .

What do you think ?

Sure that could work (using Tiles or Sitemesh), but I'm not sure you gain that much by having a tile/include contain a header <htm:form action="${ControlBean.the_action_URI}"/> on it versus <html:form action="${myFormBean.the_action_URI}"/>. I probably wouldn't make a whole seperate tile just for the html:form header.


Most of the time I don't need to dynamically change the action name since the reusable form usually always has the same validation rules (an update versus and add for me usually has the same data on the page.. sometimes hidden though). I also find it easier to understand when you can quickly look at the JSP and see the action name delcared in the form element.

Since I'm now leaning towards manually calling the validate methods anyway (to avoid those issues of having to repopulate lists when validation fails), I can always create custom validation calls based on whether I'm doing an update versus an insert if I need to. This why the Action name always remains the same on the form.

Obviously many ways to skin a cat here. I tend to avoid having dynamic action names since some time a year later someone will say "When I'm on such and such a page and click submit, I'm getting this wierd error." To track down the problem it's easy then to just look at the JSP and see the action it's submitting to. When it's dynamic it's a bit more of a pain to track down what is going on.

--
Rick

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



Reply via email to