On 6/8/06, Scott Van Wart <[EMAIL PROTECTED]> wrote:
I have two different pages that call the same action.  I'm using
validate="true" in the action mapping.  Can I specify the 'input'
attribute dynamically (or set it somewhere while the action is being
called, before validation?).

You cannot change config information that has been defined in
struts-config.xml file. If you try, you will likely get "The
configuration is frozen" exception.

You may want to try using wildcards [1], but it looks that wildcards
are not the answer to your question.

I suggest to look at your issue from another perspective. Do you
really need the functionality you are asking for? First, a small
clarification. There is no input page for an action, "input" attribute
is poorly named, it should be called "error" or "errorTarget", because
Struts forwards to that location if input data does not validate. Your
request is always sent to action/actionform.

It appears to me that you have two different HTML forms that are
submitted to one action. After many years of using Struts this
page-oriented approach seems convoluted and inflexible to me. If these
forms are different views of one web resource, they should be rendered
by one action, and a proper page is chosen depending on resource
state. If these forms are views of different resources, then they
should be served by different action classes belonging to different
web resources, that is, you simply should not submit to one action
class from views that represent different web resources.

So, to display the first form you call FirstAction and tell it to
render itself. It shows the form, you fill it out, submit, in case of
error it redisplays the form. Do display the second form you call
SecondAction and tell it to render itself. It shows the form, you fill
it out, submit, in case of error it redisplays the form. :-) This is
it, all you need is two actions, not two "input" attributes.

If you have time, the DataEntryForm page [2] explains my opinion on that matter.

[1] 
http://struts.apache.org/struts-action/userGuide/building_controller.html#action_mapping_wildcards
[2] http://wiki.apache.org/struts/DataEntryForm

Michael.

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

Reply via email to