Re: different inputs in struts-config

2004-08-20 Thread Susan Bradeen
Sebastian Ho [EMAIL PROTECTED] wrote on 08/19/2004 09:25:38 
PM:

 Thanks Susan.
 
 Refer to my comments below
 
 Sebastian Ho
 
 
 On Thu, 2004-08-19 at 21:23, Susan Bradeen wrote:
  Sebastian Ho [EMAIL PROTECTED] wrote on 08/19/2004 
05:19:35 
  AM:
  
   hi
   
   I used the same actionform for a few JSP pages, which I guess is 
good
   practice. The problem occurs when I add in validation in my 
ActionForm. 
   
   Because in the struts-config, only one input is specified for 
every
   Action. Therefore, whenever validation fails and struts display the
   error messages, struts prints it in the JSP given in input.
   
   Ideally, struts should forward and prints out the error messages in 
the
   JSP that calls the ActionForm.
   
   I tried adding in multiple action mapping in my struts-config with
   identical settings except input, which I hope struts will be smart
   enough to decide which mapping to use. Unfortuntely, it doesn't.
  
  
  Yes, you can reuse your actionform for multiple action mappings, but 
are 
  your action mappings really identical except for the input? If I 
  understand what you are trying to do, it sounds like you should have:
  

  Action1 specifies ActionForm1 and input JSP1 and forwards to JSP1.
  JSP1 probably then submits to Action2.
  Action2 specifies ActionForm1 and input JSP2 and forwards to JSP2.
  JSP2 probably then submits to Action3.
  Action3 specifies ActionForm1 and input JSP3 and forwards to JSP3.
  
 
 All of them ues the same action Action because I am using
 LookupDispatchAction.
 
 So the struts-config ideally should be (which doesn't work) :
 Action1 specifies ActionFrom1 and input JSP1.
 Action1 specifies ActionForm1 and input JSP2.
 Action1 specifies ActionForm1 and input JSP3.
 
 How do I achieve this effect?
 

snip/

Aha, I'm not familiar enough with LookupDispatchAction to offer much help 
off the top of my head. Sorry about that. I don't know if you can call the 
validate() from your LDA methods manually, then if errors come back, 
return a new ActionForward to the proper JSP, depending on what JSP you 
came from (via a hidden field passed in from the JSP?)?

Hopefully someone with more LDA experience will offer more suggestions ...

Susan

_
Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services 
powered by MessageLabs. 
_

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



Re: different inputs in struts-config

2004-08-20 Thread struts lover
Hi ,
You can validate using LookupDispatchAction class. The
validation.xml will take care of it. Also if you want
to do other business side validations, you can do it
in your methods in the action class.



--- Susan Bradeen [EMAIL PROTECTED] wrote:

 Sebastian Ho [EMAIL PROTECTED] wrote on
 08/19/2004 09:25:38 
 PM:
 
  Thanks Susan.
  
  Refer to my comments below
  
  Sebastian Ho
  
  
  On Thu, 2004-08-19 at 21:23, Susan Bradeen wrote:
   Sebastian Ho [EMAIL PROTECTED]
 wrote on 08/19/2004 
 05:19:35 
   AM:
   
hi

I used the same actionform for a few JSP
 pages, which I guess is 
 good
practice. The problem occurs when I add in
 validation in my 
 ActionForm. 

Because in the struts-config, only one input
 is specified for 
 every
Action. Therefore, whenever validation fails
 and struts display the
error messages, struts prints it in the JSP
 given in input.

Ideally, struts should forward and prints out
 the error messages in 
 the
JSP that calls the ActionForm.

I tried adding in multiple action mapping in
 my struts-config with
identical settings except input, which I
 hope struts will be smart
enough to decide which mapping to use.
 Unfortuntely, it doesn't.
   
   
   Yes, you can reuse your actionform for multiple
 action mappings, but 
 are 
   your action mappings really identical except for
 the input? If I 
   understand what you are trying to do, it sounds
 like you should have:
   
 
   Action1 specifies ActionForm1 and input JSP1 and
 forwards to JSP1.
   JSP1 probably then submits to Action2.
   Action2 specifies ActionForm1 and input JSP2 and
 forwards to JSP2.
   JSP2 probably then submits to Action3.
   Action3 specifies ActionForm1 and input JSP3 and
 forwards to JSP3.
   
  
  All of them ues the same action Action because I
 am using
  LookupDispatchAction.
  
  So the struts-config ideally should be (which
 doesn't work) :
  Action1 specifies ActionFrom1 and input JSP1.
  Action1 specifies ActionForm1 and input JSP2.
  Action1 specifies ActionForm1 and input JSP3.
  
  How do I achieve this effect?
  
 
 snip/
 
 Aha, I'm not familiar enough with
 LookupDispatchAction to offer much help 
 off the top of my head. Sorry about that. I don't
 know if you can call the 
 validate() from your LDA methods manually, then if
 errors come back, 
 return a new ActionForward to the proper JSP,
 depending on what JSP you 
 came from (via a hidden field passed in from the
 JSP?)?
 
 Hopefully someone with more LDA experience will
 offer more suggestions ...
 
 Susan
 

_
 Scanned for SoftLanding Systems, Inc. by IBM Email
 Security Management Services powered by MessageLabs.
 

_
 

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




___
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

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



RE: different inputs in struts-config

2004-08-20 Thread Jim Barrows


 -Original Message-
 From: Sebastian Ho [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 19, 2004 6:26 PM
 To: Struts Users Mailing List
 Subject: Re: different inputs in struts-config
 
 
 Thanks Susan.
 
 Refer to my comments below
 
 Sebastian Ho
 
 
 On Thu, 2004-08-19 at 21:23, Susan Bradeen wrote:
  Sebastian Ho [EMAIL PROTECTED] wrote on 
 08/19/2004 05:19:35 
  AM:
  
   hi
   
   I used the same actionform for a few JSP pages, which I 
 guess is good
   practice. The problem occurs when I add in validation in 
 my ActionForm. 
   
   Because in the struts-config, only one input is 
 specified for every
   Action. Therefore, whenever validation fails and struts 
 display the
   error messages, struts prints it in the JSP given in input.
   
   Ideally, struts should forward and prints out the error 
 messages in the
   JSP that calls the ActionForm.
   
   I tried adding in multiple action mapping in my struts-config with
   identical settings except input, which I hope struts 
 will be smart
   enough to decide which mapping to use. Unfortuntely, it doesn't.
  
  
  Yes, you can reuse your actionform for multiple action 
 mappings, but are 
  your action mappings really identical except for the input? If I 
  understand what you are trying to do, it sounds like you 
 should have:
  
  Action1 specifies ActionForm1 and input JSP1 and forwards to JSP1.
  JSP1 probably then submits to Action2.
  Action2 specifies ActionForm1 and input JSP2 and forwards to JSP2.
  JSP2 probably then submits to Action3.
  Action3 specifies ActionForm1 and input JSP3 and forwards to JSP3.
  
 
 All of them ues the same action Action because I am using
 LookupDispatchAction.
 
 So the struts-config ideally should be (which doesn't work) :
 Action1 specifies ActionFrom1 and input JSP1.
 Action1 specifies ActionForm1 and input JSP2.
 Action1 specifies ActionForm1 and input JSP3.
 
 How do I achieve this effect?

Way 1:
Struts config:
action path=/action1 type=com.blah.MyAction input=jsp1.jsp blah
forward blah
forward blah
/action
action path=/action2 type=com.blah.MyAction input=jsp2.jsp blah
forward blah
forward blah
/action
action path=/action3 type=com.blah.MyAction input=jsp3.jsp blah
forward blah
forward blah
/action

Action form:
class MyForm extends ValidatorActionForm{
blah
}

validation.xml:
form name=/action1
blah
/form
form name=/action2
blah
/form
form name=/action3
blah
/form



 
  Is that about right? In this case, Validator should work fine.
  
  Hth,
  Susan Bradeen
   
   I have read online that this strategy is quite popular. 
 Therefore I am
   sure there is a solution to this problem.
   
   How do I forward the ActionError to the correct JSP 
 instead of the one
   in input?
   
   Thanks
   
   Sebastian Ho
   
   
   
 -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
  
 __
 ___
   Scanned for SoftLanding Systems, Inc. by IBM Email Security 
   Management Services powered by MessageLabs. 
   
  
 __
 ___
  
  
  
 __
 ___
  Scanned for SoftLanding Systems, Inc. by IBM Email Security 
 Management Services powered by MessageLabs. 
  
 __
 ___
  
  
 -
  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]
 
 

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



different inputs in struts-config

2004-08-19 Thread Sebastian Ho
hi

I used the same actionform for a few JSP pages, which I guess is good
practice. The problem occurs when I add in validation in my ActionForm. 

Because in the struts-config, only one input is specified for every
Action. Therefore, whenever validation fails and struts display the
error messages, struts prints it in the JSP given in input.

Ideally, struts should forward and prints out the error messages in the
JSP that calls the ActionForm.

I tried adding in multiple action mapping in my struts-config with
identical settings except input, which I hope struts will be smart
enough to decide which mapping to use. Unfortuntely, it doesn't.

I have read online that this strategy is quite popular. Therefore I am
sure there is a solution to this problem.

How do I forward the ActionError to the correct JSP instead of the one
in input?

Thanks

Sebastian Ho


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



Re: different inputs in struts-config

2004-08-19 Thread Susan Bradeen
Sebastian Ho [EMAIL PROTECTED] wrote on 08/19/2004 05:19:35 
AM:

 hi
 
 I used the same actionform for a few JSP pages, which I guess is good
 practice. The problem occurs when I add in validation in my ActionForm. 
 
 Because in the struts-config, only one input is specified for every
 Action. Therefore, whenever validation fails and struts display the
 error messages, struts prints it in the JSP given in input.
 
 Ideally, struts should forward and prints out the error messages in the
 JSP that calls the ActionForm.
 
 I tried adding in multiple action mapping in my struts-config with
 identical settings except input, which I hope struts will be smart
 enough to decide which mapping to use. Unfortuntely, it doesn't.


Yes, you can reuse your actionform for multiple action mappings, but are 
your action mappings really identical except for the input? If I 
understand what you are trying to do, it sounds like you should have:

Action1 specifies ActionForm1 and input JSP1 and forwards to JSP1.
JSP1 probably then submits to Action2.
Action2 specifies ActionForm1 and input JSP2 and forwards to JSP2.
JSP2 probably then submits to Action3.
Action3 specifies ActionForm1 and input JSP3 and forwards to JSP3.

Is that about right? In this case, Validator should work fine.

Hth,
Susan Bradeen
 
 I have read online that this strategy is quite popular. Therefore I am
 sure there is a solution to this problem.
 
 How do I forward the ActionError to the correct JSP instead of the one
 in input?
 
 Thanks
 
 Sebastian Ho
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
_
 Scanned for SoftLanding Systems, Inc. by IBM Email Security 
 Management Services powered by MessageLabs. 
 
_


_
Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services 
powered by MessageLabs. 
_

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



RE: different inputs in struts-config

2004-08-19 Thread Jim Barrows


 -Original Message-
 From: Sebastian Ho [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 19, 2004 2:20 AM
 To: Struts Users Mailing List
 Subject: different inputs in struts-config
 
 
 hi
 
 I used the same actionform for a few JSP pages, which I guess is good
 practice. The problem occurs when I add in validation in my 
 ActionForm. 
 
 Because in the struts-config, only one input is specified for every
 Action. Therefore, whenever validation fails and struts display the
 error messages, struts prints it in the JSP given in input.
 
 Ideally, struts should forward and prints out the error 
 messages in the
 JSP that calls the ActionForm.

It does... and you tell it which jsp it comes from in the input param.

 
 I tried adding in multiple action mapping in my struts-config with
 identical settings except input, which I hope struts will be smart
 enough to decide which mapping to use. Unfortuntely, it doesn't.

You might want to look at the page number settings in validation, if you're doing a 
multi-page wizard type form fill-in.

 
 I have read online that this strategy is quite popular. Therefore I am
 sure there is a solution to this problem.
 
 How do I forward the ActionError to the correct JSP instead of the one
 in input?

Well, the on in input is the correct one.

 
 Thanks
 
 Sebastian Ho
 
 
 -
 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]



Re: different inputs in struts-config

2004-08-19 Thread Sebastian Ho
Thanks Susan.

Refer to my comments below

Sebastian Ho


On Thu, 2004-08-19 at 21:23, Susan Bradeen wrote:
 Sebastian Ho [EMAIL PROTECTED] wrote on 08/19/2004 05:19:35 
 AM:
 
  hi
  
  I used the same actionform for a few JSP pages, which I guess is good
  practice. The problem occurs when I add in validation in my ActionForm. 
  
  Because in the struts-config, only one input is specified for every
  Action. Therefore, whenever validation fails and struts display the
  error messages, struts prints it in the JSP given in input.
  
  Ideally, struts should forward and prints out the error messages in the
  JSP that calls the ActionForm.
  
  I tried adding in multiple action mapping in my struts-config with
  identical settings except input, which I hope struts will be smart
  enough to decide which mapping to use. Unfortuntely, it doesn't.
 
 
 Yes, you can reuse your actionform for multiple action mappings, but are 
 your action mappings really identical except for the input? If I 
 understand what you are trying to do, it sounds like you should have:
 
 Action1 specifies ActionForm1 and input JSP1 and forwards to JSP1.
 JSP1 probably then submits to Action2.
 Action2 specifies ActionForm1 and input JSP2 and forwards to JSP2.
 JSP2 probably then submits to Action3.
 Action3 specifies ActionForm1 and input JSP3 and forwards to JSP3.
 

All of them ues the same action Action because I am using
LookupDispatchAction.

So the struts-config ideally should be (which doesn't work) :
Action1 specifies ActionFrom1 and input JSP1.
Action1 specifies ActionForm1 and input JSP2.
Action1 specifies ActionForm1 and input JSP3.

How do I achieve this effect?

 Is that about right? In this case, Validator should work fine.
 
 Hth,
 Susan Bradeen
  
  I have read online that this strategy is quite popular. Therefore I am
  sure there is a solution to this problem.
  
  How do I forward the ActionError to the correct JSP instead of the one
  in input?
  
  Thanks
  
  Sebastian Ho
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 _
  Scanned for SoftLanding Systems, Inc. by IBM Email Security 
  Management Services powered by MessageLabs. 
  
 _
 
 
 _
 Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services 
 powered by MessageLabs. 
 _
 
 -
 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]



Re: different inputs in struts-config

2004-08-19 Thread struts lover
Try using the attribute/formAttribute in the action
mapping. I think it should work.



--- Sebastian Ho [EMAIL PROTECTED] wrote:

 Thanks Susan.
 
 Refer to my comments below
 
 Sebastian Ho
 
 
 On Thu, 2004-08-19 at 21:23, Susan Bradeen wrote:
  Sebastian Ho [EMAIL PROTECTED] wrote
 on 08/19/2004 05:19:35 
  AM:
  
   hi
   
   I used the same actionform for a few JSP pages,
 which I guess is good
   practice. The problem occurs when I add in
 validation in my ActionForm. 
   
   Because in the struts-config, only one input
 is specified for every
   Action. Therefore, whenever validation fails and
 struts display the
   error messages, struts prints it in the JSP
 given in input.
   
   Ideally, struts should forward and prints out
 the error messages in the
   JSP that calls the ActionForm.
   
   I tried adding in multiple action mapping in my
 struts-config with
   identical settings except input, which I hope
 struts will be smart
   enough to decide which mapping to use.
 Unfortuntely, it doesn't.
  
  
  Yes, you can reuse your actionform for multiple
 action mappings, but are 
  your action mappings really identical except for
 the input? If I 
  understand what you are trying to do, it sounds
 like you should have:
  
  Action1 specifies ActionForm1 and input JSP1 and
 forwards to JSP1.
  JSP1 probably then submits to Action2.
  Action2 specifies ActionForm1 and input JSP2 and
 forwards to JSP2.
  JSP2 probably then submits to Action3.
  Action3 specifies ActionForm1 and input JSP3 and
 forwards to JSP3.
  
 
 All of them ues the same action Action because I am
 using
 LookupDispatchAction.
 
 So the struts-config ideally should be (which
 doesn't work) :
 Action1 specifies ActionFrom1 and input JSP1.
 Action1 specifies ActionForm1 and input JSP2.
 Action1 specifies ActionForm1 and input JSP3.
 
 How do I achieve this effect?
 
  Is that about right? In this case, Validator
 should work fine.
  
  Hth,
  Susan Bradeen
   
   I have read online that this strategy is quite
 popular. Therefore I am
   sure there is a solution to this problem.
   
   How do I forward the ActionError to the correct
 JSP instead of the one
   in input?
   
   Thanks
   
   Sebastian Ho
   
   
  

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

_
   Scanned for SoftLanding Systems, Inc. by IBM
 Email Security 
   Management Services powered by MessageLabs. 
   
 

_
  
  
 

_
  Scanned for SoftLanding Systems, Inc. by IBM Email
 Security Management Services powered by MessageLabs.
 
 

_
  
 

-
  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]
 
 




___
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

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