We'll i kind of interested in trying your solution.
Can you post some jsp & codes in here.
I think many people will appreciate it.

Thanks.
----- Original Message -----
From: "Mark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 11:52 AM
Subject: Dynamic form actions


I just wanted to pass on a tidbit that might help one or two people out
there.

I have a search page that displays the results with checkboxes.  There are
two or three different places that i use this same search page, so rather
than writing or copying the search results jsp page to several copies (to
allow me to post the form thats on the results page to a different forward
definition) i made a modifiecation to struts.

In the FormTag.java I added some code to peek in the formbean for a property
called "formaction".  If it finds one, it uses this new action instead of
the hard coded one in the jsp page.

Thus, in my action class i do this:

MyBean myBean=(MyBean)actionForm;

myBean.setFormaction("/Some/other/url");
return mapping.findforward("default");

now i have a jsp page which i can reuse its functionality in several places
in my code.

I had thought about using a hidden field, but the problem really stems from
the statically coded form action="/Url" part.  Since struts doesnt allow us
much flexibility here by default, I decided to add my own and it works
great!

Regards,
Mark




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




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

Reply via email to