You would have to hard code the values in your action class

-----Original Message-----
From: Leonardo Francalanci [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 05, 2004 8:14 PM
To: Struts Users Mailing List
Subject: R: repost: validator & retrieving data


It seems a good solution, but compared to the hidden field:

1) I have to set up an <action> just to show the error. With the hidden
field I could use 2 <action> (instead of 3) doing something like

if (hiddenpar.isSet()) {
        leave form as is, we are here because validation failed
} else {
        populate the form from db
}


2) I have to hardcode the paths of my actions inside my classes
(es: If(mapping.getPath().equals("abcdisplay")))

Or am I wrong?

Please reply...

(and thank you!)


> -----Messaggio originale-----
> Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Inviato: giovedi 5 febbraio 2004 15.53
> A: [EMAIL PROTECTED]
> Oggetto: RE: repost: validator & retrieving data
>
>
>
> Sorry there was a typo in last one
>
> Hi,
>
> You don't need to have two actions but you can have different mappings

> for the same action class
>
> For e.g.
> <action name="formbean" path="abcdisplay" type="AbcAction.java" >
>       <forward name="success" path="jsp name" />
> </action>
> <action name="formbean"  path="abcProcess" type="AbcAction.java"
> validate="true" input="abcErrorShow">
>       <forward name="success" path="results jsp" />
> </action>
> <action name="formbean" path="abcErrorShow" type="AbcAction.java">
>       <forward name="success" path="jsp name" />
> </action>
>
>
> Now in the action class use
>
> If(mapping.getPath().equals(abcdisplay)){
> Get data from backend
> }
> Else if(mapping.getPath().equals(abcProcess)){
> Process data from backend
> }
> Else if(mapping.getPath().equals(abcErrorShow)){
> Populate data from form bean itself
> }
>
>
> Regards
>
> Anant
>
> -----Original Message-----
> From: Leonardo Francalanci [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 05, 2004 5:44 PM
> To: [EMAIL PROTECTED]
> Subject: repost: validator & retrieving data
>
>
> I'm sorry but nobody answered my question...
> Could somebody help me?
>
>
> I'm using validator for my pages. Searching the mailing list I found
> that I should use 2 actions:
>
> "If there are 2 actions, one to "prepare" the page and one to
> "process" the user input, we define the input attribute value of the
> "process" action mapping to be the URL of the "prepare" action."
>
> I think it's right, but now I have this problem:
> The "prepare" page retrieves data from the db. If validation fails,
> the user is forwarded from the "process" action to the "prepare"
> action. In this case I don't want to retrieve data from the db, but
> leave what the user entered before. In other words I want to retrieve
> data only if the user asked for the "prepare" action, not when he is
> redirected to the "prepare" action from the input property of
> "process" action.
>
> Is there a way to do that?
>
> The only way i found is an hidden field, but I don't like it...
>
>
>
> ---------------------------------------------------------------------
> 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]
>
>
> Confidentiality Notice
>
> The information contained in this electronic message and any
> attachments to this message are intended
> for the exclusive use of the addressee(s) and may contain
> confidential or privileged information. If
> you are not the intended recipient, please notify the sender at
> Wipro or [EMAIL PROTECTED] immediately
> and destroy all copies of this message and any attachments.
>
> ---------------------------------------------------------------------
> 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]


Confidentiality Notice

The information contained in this electronic message and any attachments to this 
message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged 
information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.

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

Reply via email to