Re: Submit Once, Validate Twice -- but how ?

2004-03-24 Thread Haroon Rafique
On Today at 9:58pm, FS=>Frank Schaare <[EMAIL PROTECTED]> wrote:

FS> Hi,
FS> 
FS> thank you, that helps.
FS> 
FS> Now i still need to know how to access the input page (set in action 
FS> mapping with the input="sample.jsp" tag)...

Hopefully you will see Joe's response in the same thread, which has the 
following line in it:

 return mapping.getInputForward();

Later,
--
Haroon Rafique
<[EMAIL PROTECTED]>


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



RE: Submit Once, Validate Twice -- but how ?

2004-03-24 Thread Joe Germuska
At 3:58 PM -0500 3/24/04, Pady Srinivasan wrote:
I don't have sample code but are you looking for something like this:

// in Action execute...
ActionErrors errors = new ActionErrors();
// add errors...
...
// set in request
request.setAttribute("org.apache.struts.action.ERROR", errors);
// forward to same page...
When executing validation in an Action, you should use the Action 
method "saveErrors" rather than directly manipulating the request 
attributes; this guarantees that the errors will be placed in the 
same place that other code is looking for them.

Here's the response I was drafting when this came in:

public ActionForward execute(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws 
Exception
{
  ActionMessages errors = processBusinessValidation(...);
  if (!errors.isEmpty())
  {
saveErrors(request,errors);
return mapping.getInputForward();
  }
  // normal business logic
  return mapping.findForward(...);
}

private ActionMessages processBusinessValidation(...)
{
  ActionMessages errors = new ActionMessages();
  // execute validation, populate errors if necessary
  return errors;
}


--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
-- Jef Raskin

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


Re: Submit Once, Validate Twice -- but how ?

2004-03-24 Thread Frank Schaare
Hi,

thank you, that helps.

Now i still need to know how to access the input page (set in action 
mapping with the input="sample.jsp" tag)...

I don't have sample code but are you looking for something like this:

// in Action execute...
ActionErrors errors = new ActionErrors();
// add errors...
...
// set in request
request.setAttribute("org.apache.struts.action.ERROR", errors);
// forward to same page...
Thanks


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


RE: Submit Once, Validate Twice -- but how ?

2004-03-24 Thread Pady Srinivasan

I don't have sample code but are you looking for something like this:

// in Action execute...
ActionErrors errors = new ActionErrors();
// add errors...
...
// set in request
request.setAttribute("org.apache.struts.action.ERROR", errors);
// forward to same page...


Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Frank Schaare [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 24, 2004 3:35 PM
To: Struts Users Mailing List
Subject: Submit Once, Validate Twice -- but how ?

Hi,

just read this article on husted.com and it seems to be good advice.

When the user submits a page, passes validation without errors, is there 
a chance to validate business logic in the action ?

Therefor i need to
- make my validation,
- get an errors object,
- store the error,
- put the errors object in the request and
- return to input page.

Has anyone some sample code / suggestions / articles / sources hoe to 
achieve this ?

Thx

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

__
This email has been scanned by the Heroix e-mail Security System
__

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



Submit Once, Validate Twice -- but how ?

2004-03-24 Thread Frank Schaare
Hi,

just read this article on husted.com and it seems to be good advice.

When the user submits a page, passes validation without errors, is there 
a chance to validate business logic in the action ?

Therefor i need to
- make my validation,
- get an errors object,
- store the error,
- put the errors object in the request and
- return to input page.
Has anyone some sample code / suggestions / articles / sources hoe to 
achieve this ?

Thx

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


RE: Can coarse grained ActionForms validate?

2004-03-19 Thread Blake Whitmore
> I still need to figure how to get information
> from the backend that the
> form doesn't store.  

Why not set properties on the form (which obviously
there will be no validation for) and in the JSP, store
that data as hidden fields ()? That
way when the user submits the form, you will not have
to invoke your business logic again should validation
errors occur with the submission.

> For example each form has a
> section on user input,
> which will be populated with user info if validation
> fails.  However, below
> that section is an area that holds readonly
> information that is retrieved
> from backend services, so I need to retrieve this
> again unless I store it in
> the session, 



> -Original Message-
> From: Blake Whitmore
> [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 19, 2004 9:50 AM
> To: Struts Users Mailing List
> Subject: Re: Can coarse grained ActionForms
> validate?
> 
> 
> Hi Jim,
> 
> You can specify multiple form bean mappings per
> action
> form.  For insance:
> 
> type="com.pkg.MyFormBean"/>
> 
> type="com.pkg.MyFormBean"/>
> 
> Then, in your validation.xml, you can have different
> rules for both of those forms. 
> 
> HTH,
> Blake
> 
> 
> 
> 
> 
> 
> 
> --- "Chan, Jim" <[EMAIL PROTECTED]> wrote:
> > 
> > 
> > Hi, I am using coarse grained action forms that
> are
> > re-used by various
> > action classes.  Each of these action classes
> serve
> > a different page and
> > retrieves information from the backend so that the
> > jsp page can show it.
> > Now because I am using coarse grained forms, I
> have
> > now way of knowing which
> > fields to validate because the same form serve
> > multiple actions.  Also, if I
> > use the ActionForm class to validate the client
> > data, the ActionForm has to
> > be responsible for re-initializing that page with
> > backend information if
> > validation fails.  Therefore, even if I change to
> > very fine-grained
> > DynaForms and use the validation framework so that
> > each action maps to one
> > form, I will probably have to figure some way of
> > fetching backend
> > information if validation fails.
> > 
> > Currently, I am doing all the client input
> > validation in the action classes
> > because it seems to be the most simple solution;
> > however, it has the caveat
> > that the action class is now responsible for both
> > validation and backend
> > service delegation.  I am just wondering if there
> is
> > a more elegant solution
> > using the action forms as the validator.
> > 
> > Any help is greatly appreciated.
> > 
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam
> http://mail.yahoo.com
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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



RE: Can coarse grained ActionForms validate?

2004-03-19 Thread Chan, Jim

Thanks gentlemen. 

This solves the problem for different validation rules for the same form,
but I still need to figure how to get information from the backend that the
form doesn't store.  For example each form has a section on user input,
which will be populated with user info if validation fails.  However, below
that section is an area that holds readonly information that is retrieved
from backend services, so I need to retrieve this again unless I store it in
the session, which I hesitate to do.  So even though I can specify which
rules apply to the same form, I cannot specify which initialization code to
use when validation fails.


-Original Message-
From: Blake Whitmore [mailto:[EMAIL PROTECTED]
Sent: Friday, March 19, 2004 9:50 AM
To: Struts Users Mailing List
Subject: Re: Can coarse grained ActionForms validate?


Hi Jim,

You can specify multiple form bean mappings per action
form.  For insance:





Then, in your validation.xml, you can have different
rules for both of those forms. 

HTH,
Blake







--- "Chan, Jim" <[EMAIL PROTECTED]> wrote:
> 
> 
> Hi, I am using coarse grained action forms that are
> re-used by various
> action classes.  Each of these action classes serve
> a different page and
> retrieves information from the backend so that the
> jsp page can show it.
> Now because I am using coarse grained forms, I have
> now way of knowing which
> fields to validate because the same form serve
> multiple actions.  Also, if I
> use the ActionForm class to validate the client
> data, the ActionForm has to
> be responsible for re-initializing that page with
> backend information if
> validation fails.  Therefore, even if I change to
> very fine-grained
> DynaForms and use the validation framework so that
> each action maps to one
> form, I will probably have to figure some way of
> fetching backend
> information if validation fails.
> 
> Currently, I am doing all the client input
> validation in the action classes
> because it seems to be the most simple solution;
> however, it has the caveat
> that the action class is now responsible for both
> validation and backend
> service delegation.  I am just wondering if there is
> a more elegant solution
> using the action forms as the validator.
> 
> Any help is greatly appreciated.
> 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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


Re: Can coarse grained ActionForms validate?

2004-03-19 Thread Blake Whitmore
Hi Jim,

You can specify multiple form bean mappings per action
form.  For insance:





Then, in your validation.xml, you can have different
rules for both of those forms. 

HTH,
Blake







--- "Chan, Jim" <[EMAIL PROTECTED]> wrote:
> 
> 
> Hi, I am using coarse grained action forms that are
> re-used by various
> action classes.  Each of these action classes serve
> a different page and
> retrieves information from the backend so that the
> jsp page can show it.
> Now because I am using coarse grained forms, I have
> now way of knowing which
> fields to validate because the same form serve
> multiple actions.  Also, if I
> use the ActionForm class to validate the client
> data, the ActionForm has to
> be responsible for re-initializing that page with
> backend information if
> validation fails.  Therefore, even if I change to
> very fine-grained
> DynaForms and use the validation framework so that
> each action maps to one
> form, I will probably have to figure some way of
> fetching backend
> information if validation fails.
> 
> Currently, I am doing all the client input
> validation in the action classes
> because it seems to be the most simple solution;
> however, it has the caveat
> that the action class is now responsible for both
> validation and backend
> service delegation.  I am just wondering if there is
> a more elegant solution
> using the action forms as the validator.
> 
> Any help is greatly appreciated.
> 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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



RE: Can coarse grained ActionForms validate?

2004-03-19 Thread Irving, Dave
Are you using the validator framework? If you are, you can associate
different validation rules with different actions for the same form (use
DynaValidatorActionForm).
Have a look at the documentation - it'll explain how to set it up.

D

-Original Message-
From: Chan, Jim [mailto:[EMAIL PROTECTED]
Sent: 19 March 2004 17:42
To: 'Struts Users Mailing List'
Subject: Can coarse grained ActionForms validate?




Hi, I am using coarse grained action forms that are re-used by various
action classes.  Each of these action classes serve a different page and
retrieves information from the backend so that the jsp page can show it.
Now because I am using coarse grained forms, I have now way of knowing which
fields to validate because the same form serve multiple actions.  Also, if I
use the ActionForm class to validate the client data, the ActionForm has to
be responsible for re-initializing that page with backend information if
validation fails.  Therefore, even if I change to very fine-grained
DynaForms and use the validation framework so that each action maps to one
form, I will probably have to figure some way of fetching backend
information if validation fails.

Currently, I am doing all the client input validation in the action classes
because it seems to be the most simple solution; however, it has the caveat
that the action class is now responsible for both validation and backend
service delegation.  I am just wondering if there is a more elegant solution
using the action forms as the validator.

Any help is greatly appreciated.

This e-mail and any attachment is for authorised use by the intended recipient(s) 
only. It may contain proprietary material, confidential information and/or be subject 
to legal privilege. It should not be copied, disclosed to, retained or used by, any 
other party. If you are not an intended recipient then please promptly delete this 
e-mail and any attachment and all copies and inform the sender. Thank you.

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



Can coarse grained ActionForms validate?

2004-03-19 Thread Chan, Jim


Hi, I am using coarse grained action forms that are re-used by various
action classes.  Each of these action classes serve a different page and
retrieves information from the backend so that the jsp page can show it.
Now because I am using coarse grained forms, I have now way of knowing which
fields to validate because the same form serve multiple actions.  Also, if I
use the ActionForm class to validate the client data, the ActionForm has to
be responsible for re-initializing that page with backend information if
validation fails.  Therefore, even if I change to very fine-grained
DynaForms and use the validation framework so that each action maps to one
form, I will probably have to figure some way of fetching backend
information if validation fails.

Currently, I am doing all the client input validation in the action classes
because it seems to be the most simple solution; however, it has the caveat
that the action class is now responsible for both validation and backend
service delegation.  I am just wondering if there is a more elegant solution
using the action forms as the validator.

Any help is greatly appreciated.


Validate and Global Errors

2004-03-18 Thread Frers Michael
Hello

i have a little question

in the MessageTag i can specify an attribute called name to say where he can find the 
errors or messages in request.

Lets say the value is "DOIT"

now how can i make that if i use validate in my FormBean, the ActionErrors are saved 
under "DOIT" instead of Globals.ERROR_KEY

Anyone knows?

Thx for any help

Michael

RE: How to validate selects

2004-03-17 Thread Brendan Richards
An easy way could be to use


with the minLength validation, using your own custom error message:

in validation xml:

  
 
minlength1
  
  


If you're using a bundle for error messages, replace the message with
the key and drop the resource="false"



-Original Message-
From: Frank Schaare [mailto:[EMAIL PROTECTED] 
Sent: 17 March 2004 17:31
To: Struts Users Mailing List
Subject: How to validate selects

Hi all,

i´m doing some selects like this:

   
   


Now, i have to validate, that the user has made his choice, which means 
that the 'foo' property is notNull.

Does anyone have an idea how to realise this in struts ?

Thanks

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



How to validate selects

2004-03-17 Thread Frank Schaare
Hi all,

i´m doing some selects like this:

  
  

Now, i have to validate, that the user has made his choice, which means 
that the 'foo' property is notNull.

Does anyone have an idea how to realise this in struts ?

Thanks

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


RE: DispatchAction and validate

2004-03-02 Thread Robert Taylor
I've never used XDoclet (although I mean to learn about it) so I can't help you there.
Maybe someone else on the list can.

robert

> -Original Message-
> From: as as [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 02, 2004 12:39 PM
> To: Struts Users Mailing List
> Subject: RE: DispatchAction and validate
>
>
> do I need an updated .xdt file for this?
> y xdoclet generated Struts-config.xml is not having the action mappings for the 
> actiin class of mine, extending Dispatch Action.
> It shows it fine for classes extending Action class though.
> Thanks n advance for the help,
> Sam
>
> Robert Taylor <[EMAIL PROTECTED]> wrote:
> Yes.
>
> The DispatchAction will only invoke the method defined in the request under the name 
> defined in the parameter attribute of your
> action mapping. So if I had update() and restore() as methods in a DispatchAction, 
> and I only wanted to validate on the
> update, then
> I would only define validate="true" in the action mappping for the DispatchAction 
> which is designated to invoke update(). This is
> assuming you have two separate action mappings which map to the same DispatchAction.
>
>
> robert
>
> > -Original Message-
> > From: Frers Michael [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 02, 2004 3:23 AM
> > To: Struts Users Mailing List
> > Subject: DispatchAction and validate
> >
> >
> > Hello
> >
> > i want to use DispatchAction
> > now my questions is can i use in one action the struts-config entry validate="true"
> > and in the other action validate="false"
> >
> > Thx for any hints
> >
> > Michael
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> -
> Do you Yahoo!?
> Yahoo! Search - Find what youre looking for faster.


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



RE: DispatchAction and validate

2004-03-02 Thread as as
do I need an updated .xdt file for this?
y xdoclet generated Struts-config.xml is not having the action mappings for the actiin 
class of mine, extending Dispatch Action.
It shows it fine for classes extending Action class though.
Thanks n advance for the help,
Sam

Robert Taylor <[EMAIL PROTECTED]> wrote:
Yes.

The DispatchAction will only invoke the method defined in the request under the name 
defined in the parameter attribute of your
action mapping. So if I had update() and restore() as methods in a DispatchAction, and 
I only wanted to validate on the update, then
I would only define validate="true" in the action mappping for the DispatchAction 
which is designated to invoke update(). This is
assuming you have two separate action mappings which map to the same DispatchAction.


robert

> -Original Message-
> From: Frers Michael [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 02, 2004 3:23 AM
> To: Struts Users Mailing List
> Subject: DispatchAction and validate
>
>
> Hello
>
> i want to use DispatchAction
> now my questions is can i use in one action the struts-config entry validate="true"
> and in the other action validate="false"
>
> Thx for any hints
>
> Michael


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


-
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster.

RE: DispatchAction and validate

2004-03-02 Thread Robert Taylor
Yes.

The DispatchAction will only invoke the method defined in the request under the name 
defined in the parameter attribute of your
action mapping. So if I had update() and restore() as methods in a DispatchAction, and 
I only wanted to validate on the update, then
I would only define validate="true" in the action mappping for the DispatchAction 
which is designated to invoke update(). This is
assuming you have two separate action mappings which map to the same DispatchAction.


robert

> -Original Message-
> From: Frers Michael [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 02, 2004 3:23 AM
> To: Struts Users Mailing List
> Subject: DispatchAction and validate
>
>
> Hello
>
> i want to use DispatchAction
> now my questions is can i use in one action the struts-config entry validate="true"
> and in the other action validate="false"
>
> Thx for any hints
>
> Michael


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



DispatchAction and validate

2004-03-02 Thread Frers Michael
Hello

i want to use DispatchAction
now my questions is can i use in one action the struts-config entry validate="true"
and in the other action validate="false"

Thx for any hints

Michael

html:options with validate

2004-02-17 Thread Sniadach, Tomasz
hi , 
i have an ActionForm with countries in html:options , there are some
other fields, that i have to validate. So, when i submit and errors
occur, the field selected in countries is set to default. Is there a way
to mark the selected field? 
The other fields (text fields) are not cleared.

In my JSP i have something like this:




in the Form ;

public String getSelectedLand() {
return eb.getLand()[0]; 
}

public String[] getCountries() {
return eb.getCountries();
}

Thx for suggestions.
Tomek


validate indexed property with DynaValidatorActionForm

2004-02-10 Thread Nathan Maves
Can this be done?

I have an Array of my customer objects as the indexed property.

Nathan Maves
Sun Microsystems

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

RE: Re-populating form after validate fails

2004-02-05 Thread Mainguy, Mike
I've seen this happen a couple of times with different people (myself
included).  It seems like the default (expected) behavior is:  "use the bean
value unless it's blank, then use the html"  i.e. if html="" and bean="text"
it should be the bean value if the bean="" and the html="asdasdf" then it
should be "asdasdf".  And if you have html="foo" and bean="bar" then it
should be "bar".




-Original Message-
From: Paul Barry [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 05, 2004 8:24 AM
To: [EMAIL PROTECTED]
Subject: Re: Re-populating form after validate fails


I finally figured this out.  It was a stupid mistake.  I had .  The value="" 
overrides what was in the bean.  Once I removed this, problem solved.

Paul Barry wrote:
> If validate fails, your action won't even be processed.  You can't use
> any of the forwards that you may set up for your action, because your 
> action never executes, you can't do a mapping.findForward("failure").  
> Once validate fails, it forwards to the input.  The struts example has 
> validate=false (it uses the default) for the LogonAction.  It uses the 
> validator to validate the form, so that is a different example.
> 
> I found the answer to my extra credit question, you can use
> input="forwardName" in your action if you have inputForward set to true 
> in your controller config.  I have this set up, but it doesn't change 
> any thing.  Here is the log of what happens when I fill in a username 
> and no password:
> 
> Processing a 'POST' for path '/myaccount/loginAction'
> Storing ActionForm bean instance in scope 'request' under attribute 
> key
> 'LoginForm'
> Populating bean properties from this request
> Validating input form properties
> Validation failed, returning to 'myaccount/login'
>
processForwardConfig(ForwardConfig[name=myaccount/login,path=/myaccount/logi
n.do,redirect=false,contextRelative=false]) 
> 
> Processing a 'POST' for path '/myaccount/login'
> Storing ActionForm bean instance in scope 'request' under attribute 
> key
> 'LoginForm'
> Populating bean properties from this request
> Looking for Action instance for class myapp.struts.actions.ForwardAction
> Returning existing Action instance
>  From toString in my ForwardAction -> 
> Path=[/WEB-INF/jsp/myaccount/login.jsp],Form=[Username=sdfdsf,Password=]
>
processForwardConfig(ForwardConfig[name=null,path=/WEB-INF/jsp/myaccount/log
in.jsp,redirect=false,contextRelative=true]) 
> 
> 
> I have removed all the info from these messages to make it easier to
> read.  All of these messages are DEBUG messages that come from the 
> RequestProcessor, except the toString that I am printing out near the 
> end.  This all looks like exactly what I would want to happen.  The 
> original POST goes to loginAction, the validate method is called and 
> fails, so it forwards to myaccount/login.  The form is stored in the 
> request scope.  When I call the toString method after the form has been 
> populated, you can see the username property is populated.  This makes 
> sense.  The request was forwarded from the original action to this 
> action.  The request parameters are still the same as the original 
> request, so when the form is populated, the username field is populated.
> 
> What doesn't make sense to me is that when I look at my form on the 
> HTML
> page (which is /WEB-INF/jsp/myaccount/login.jsp in this case), the 
> username property is not populated.  This doesn't make sense to me.  The 
> html:form tag should see that the form property for username is 
> populated, so therefore the 'html:test property="username"' field should 
> be populated with that value.  What am I missing here?
> 
> 
>>
>> Subject:
>> Re: Re-populating form after validate fails
>> From:
>> [EMAIL PROTECTED]
>> Date:
>> Wed, 4 Feb 2004 12:50:17 +1100
>> To:
>> "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>
>>
>> oops, you could be right. I left that out when I was genericising my
>> action tag... just trying to make it more generic.
>>
>> However, my point is still that when validate fails then the errors
>> will not be empty... that is where your action tells struts to forward 
>> as:
>>
>>
>>>  forward = mapping.findForward("failure");
>>
>>
>>
>> and in your struts entry you can see (in my example) that "failure" 
>> is
>> defined as the same form (but it co

Re: Re-populating form after validate fails

2004-02-05 Thread Paul Barry
I finally figured this out.  It was a stupid mistake.  I had .  The value="" 
overrides what was in the bean.  Once I removed this, problem solved.

Paul Barry wrote:
If validate fails, your action won't even be processed.  You can't use 
any of the forwards that you may set up for your action, because your 
action never executes, you can't do a mapping.findForward("failure").  
Once validate fails, it forwards to the input.  The struts example has 
validate=false (it uses the default) for the LogonAction.  It uses the 
validator to validate the form, so that is a different example.

I found the answer to my extra credit question, you can use 
input="forwardName" in your action if you have inputForward set to true 
in your controller config.  I have this set up, but it doesn't change 
any thing.  Here is the log of what happens when I fill in a username 
and no password:

Processing a 'POST' for path '/myaccount/loginAction'
Storing ActionForm bean instance in scope 'request' under attribute key 
'LoginForm'
Populating bean properties from this request
Validating input form properties
Validation failed, returning to 'myaccount/login'
processForwardConfig(ForwardConfig[name=myaccount/login,path=/myaccount/login.do,redirect=false,contextRelative=false]) 

Processing a 'POST' for path '/myaccount/login'
Storing ActionForm bean instance in scope 'request' under attribute key 
'LoginForm'
Populating bean properties from this request
Looking for Action instance for class myapp.struts.actions.ForwardAction
Returning existing Action instance
 From toString in my ForwardAction -> 
Path=[/WEB-INF/jsp/myaccount/login.jsp],Form=[Username=sdfdsf,Password=]
processForwardConfig(ForwardConfig[name=null,path=/WEB-INF/jsp/myaccount/login.jsp,redirect=false,contextRelative=true]) 

I have removed all the info from these messages to make it easier to 
read.  All of these messages are DEBUG messages that come from the 
RequestProcessor, except the toString that I am printing out near the 
end.  This all looks like exactly what I would want to happen.  The 
original POST goes to loginAction, the validate method is called and 
fails, so it forwards to myaccount/login.  The form is stored in the 
request scope.  When I call the toString method after the form has been 
populated, you can see the username property is populated.  This makes 
sense.  The request was forwarded from the original action to this 
action.  The request parameters are still the same as the original 
request, so when the form is populated, the username field is populated.

What doesn't make sense to me is that when I look at my form on the HTML 
page (which is /WEB-INF/jsp/myaccount/login.jsp in this case), the 
username property is not populated.  This doesn't make sense to me.  The 
html:form tag should see that the form property for username is 
populated, so therefore the 'html:test property="username"' field should 
be populated with that value.  What am I missing here?


Subject:
Re: Re-populating form after validate fails
From:
[EMAIL PROTECTED]
Date:
Wed, 4 Feb 2004 12:50:17 +1100
To:
"Struts Users Mailing List" <[EMAIL PROTECTED]>
oops, you could be right. I left that out when I was genericising my 
action tag... just trying to make it more generic.

However, my point is still that when validate fails then the errors 
will not be empty... that is where your action tells struts to forward 
as:


 forward = mapping.findForward("failure");


and in your struts entry you can see (in my example) that "failure" is 
defined as the same form (but it could be anything)

an example of this is in the sample struts project in the struts 
tutorial where the login screen forwards to "welcome" if login was 
okay, or back to "login" if it failed.

so I'm not sure if the input parameter is responsible for the 
forward... it could be the default?
Cheers,
Heya Gosper
CSC Australia
212 Northbourne Ave, Braddon ACT 2612
Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
MOB: 0401 611779




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


Re: Re-populating form after validate fails

2004-02-04 Thread Paul Barry
If validate fails, your action won't even be processed.  You can't use any of the forwards that you may set up for your 
action, because your action never executes, you can't do a mapping.findForward("failure").  Once validate fails, it 
forwards to the input.  The struts example has validate=false (it uses the default) for the LogonAction.  It uses the 
validator to validate the form, so that is a different example.

I found the answer to my extra credit question, you can use input="forwardName" in your action if you have inputForward 
set to true in your controller config.  I have this set up, but it doesn't change any thing.  Here is the log of what 
happens when I fill in a username and no password:

Processing a 'POST' for path '/myaccount/loginAction'
Storing ActionForm bean instance in scope 'request' under attribute key 'LoginForm'
Populating bean properties from this request
Validating input form properties
Validation failed, returning to 'myaccount/login'
processForwardConfig(ForwardConfig[name=myaccount/login,path=/myaccount/login.do,redirect=false,contextRelative=false])
Processing a 'POST' for path '/myaccount/login'
Storing ActionForm bean instance in scope 'request' under attribute key 'LoginForm'
Populating bean properties from this request
Looking for Action instance for class myapp.struts.actions.ForwardAction
Returning existing Action instance
From toString in my ForwardAction -> 
Path=[/WEB-INF/jsp/myaccount/login.jsp],Form=[Username=sdfdsf,Password=]
processForwardConfig(ForwardConfig[name=null,path=/WEB-INF/jsp/myaccount/login.jsp,redirect=false,contextRelative=true])
I have removed all the info from these messages to make it easier to read.  All of these messages are DEBUG messages 
that come from the RequestProcessor, except the toString that I am printing out near the end.  This all looks like 
exactly what I would want to happen.  The original POST goes to loginAction, the validate method is called and fails, so 
it forwards to myaccount/login.  The form is stored in the request scope.  When I call the toString method after the 
form has been populated, you can see the username property is populated.  This makes sense.  The request was forwarded 
from the original action to this action.  The request parameters are still the same as the original request, so when the 
form is populated, the username field is populated.

What doesn't make sense to me is that when I look at my form on the HTML page (which is /WEB-INF/jsp/myaccount/login.jsp 
in this case), the username property is not populated.  This doesn't make sense to me.  The html:form tag should see 
that the form property for username is populated, so therefore the 'html:test property="username"' field should be 
populated with that value.  What am I missing here?


Subject:
Re: Re-populating form after validate fails
From:
[EMAIL PROTECTED]
Date:
Wed, 4 Feb 2004 12:50:17 +1100
To:
"Struts Users Mailing List" <[EMAIL PROTECTED]>
oops, you could be right. I left that out when I was genericising my 
action tag... just trying to make it more generic.

However, my point is still that when validate fails then the errors will 
not be empty... that is where your action tells struts to forward as:


 forward = mapping.findForward("failure");


and in your struts entry you can see (in my example) that "failure" is 
defined as the same form (but it could be anything)

an example of this is in the sample struts project in the struts tutorial 
where the login screen forwards to "welcome" if login was okay, or back to 
"login" if it failed.

so I'm not sure if the input parameter is responsible for the forward... 
it could be the default? 

Cheers,
Heya Gosper
CSC Australia
212 Northbourne Ave, Braddon ACT 2612
Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
MOB: 0401 611779


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


Re: Re-populating form after validate fails

2004-02-04 Thread Rick Reumann
Paul Barry wrote:


name="LoginForm" validate="false" 
parameter="/WEB-INF/jsp/myaccount/login.jsp" />

name="LoginForm" validate="true" input="/myaccount/login.do" />

So, the user goes to /myaccount/login.do, and they are presented with a 
form.  The code for that looks like this:


  
   
  Username: 
  Password: 
  

  



What I am struggling with is that when I submit this form, if username 
is not null, but password is, the username field is not populated with 
the value for username.   
My guess is the problem lies in that it looks like when validation fails 
you are forarding to another action. I could be wrong though. Usually 
the input value is a jsp page or tile and not an Action (at least as far 
as I'm aware). You're probably getting a whole new Request object built 
when you go to the login.do action and are losing your request scoped 
form. Try changing the login.do to the name of the jsp page of your 
login form.

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


Re: Re-populating form after validate fails

2004-02-03 Thread hgosper
oops, you could be right. I left that out when I was genericising my 
action tag... just trying to make it more generic.

However, my point is still that when validate fails then the errors will 
not be empty... that is where your action tells struts to forward as:

>   forward = mapping.findForward("failure");

and in your struts entry you can see (in my example) that "failure" is 
defined as the same form (but it could be anything)

an example of this is in the sample struts project in the struts tutorial 
where the login screen forwards to "welcome" if login was okay, or back to 
"login" if it failed.

so I'm not sure if the input parameter is responsible for the forward... 
it could be the default? 

Cheers,
Heya Gosper
CSC Australia
212 Northbourne Ave, Braddon ACT 2612
Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
MOB: 0401 611779

This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose.






Paul Barry <[EMAIL PROTECTED]>
04/02/2004 12:38 PM
Please respond to "Struts Users Mailing List"

 
To: [EMAIL PROTECTED]
    cc: 
Subject:Re: Re-populating form after validate fails


I can't test this right now, but if I have an ActionMapping with 
validate="true" and no input, won't that result in an 
error when validate fails?  My understanding is that if validate fails, 
the request processor forwards the request to 
the input.



> ----
> 
> Subject:
> Re: Re-populating form after validate fails
> From:
> [EMAIL PROTECTED]
> Date:
> Wed, 4 Feb 2004 10:59:35 +1100
> To:
> "Struts Users Mailing List" <[EMAIL PROTECTED]>
> 
> 
> Just set up an forward for validation failure. You can do this in your 
> struts-config.xml file, in fact you can have as many  forwards as you 
> like, but for practical purposes most people prefer to have at most 
three 
> or four forwards per Action. For example, you might have a SaveAction 
that 
> forwards to the next screen in a sequence if validation succeeds, an 
error 
> page if it fails, a login page if the session becomes invalidated, and a 

> query action if you had a "delete" button to delete a record.
> 
> Just say you query a database to populate your form fields. Then you can 

> edit the form and hit Save. In the Form's validate method you fill an 
> ActionErrors object.
> 
> Then in the SaveAction you will have something like:
> 
> // If a message is required, save the specified key(s)
> // into the request for use by the  tag.
> if (!errors.isEmpty()) 
> {
> saveErrors(request, errors);
> 
> // Forward control to the appropriate 'failure' URI
> forward = mapping.findForward("failure");
> 
> } 
> 
> else
> {
> // Forward control to the appropriate 'success' URI if 
no errors
> forward = mapping.findForward("success");
> } 
> 
> return forward;
> 
> and in your struts-config you will have something like:
> 
>  type="myproject.actions.SaveAction"
> name="somethingForm"
> validate="true">
> 
> 
> 
> 
> I hope you can figure out your answer from that... I can't give you a 
real 
> example from my project because of confidentiality so I have to try and 
> make it generic.
> 
> 
> Cheers,
> Heya Gosper
> CSC Australia
> 212 Northbourne Ave, Braddon ACT 2612
> Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
> MOB: 0401 611779
> 

> This is a PRIVATE message. If you are not the intended recipient, please 

> delete without copying and kindly advise us by e-mail of the mistake in 
> delivery. NOTE: Regardless of content, this e-mail shall not operate to 
> bind CSC to any order or other 

Re: Re-populating form after validate fails

2004-02-03 Thread Paul Barry
I can't test this right now, but if I have an ActionMapping with validate="true" and no input, won't that result in an 
error when validate fails?  My understanding is that if validate fails, the request processor forwards the request to 
the input.





Subject:
Re: Re-populating form after validate fails
From:
[EMAIL PROTECTED]
Date:
Wed, 4 Feb 2004 10:59:35 +1100
To:
"Struts Users Mailing List" <[EMAIL PROTECTED]>
Just set up an forward for validation failure. You can do this in your 
struts-config.xml file, in fact you can have as many  forwards as you 
like, but for practical purposes most people prefer to have at most three 
or four forwards per Action. For example, you might have a SaveAction that 
forwards to the next screen in a sequence if validation succeeds, an error 
page if it fails, a login page if the session becomes invalidated, and a 
query action if you had a "delete" button to delete a record.

Just say you query a database to populate your form fields. Then you can 
edit the form and hit Save. In the Form's validate method you fill an 
ActionErrors object.

Then in the SaveAction you will have something like:

// If a message is required, save the specified key(s)
// into the request for use by the  tag.
if (!errors.isEmpty()) 
{
saveErrors(request, errors);

// Forward control to the appropriate 'failure' URI
forward = mapping.findForward("failure");
} 
 
else
{
// Forward control to the appropriate 'success' URI if no errors
forward = mapping.findForward("success");
} 
 
return forward;

and in your struts-config you will have something like:




I hope you can figure out your answer from that... I can't give you a real 
example from my project because of confidentiality so I have to try and 
make it generic.

Cheers,
Heya Gosper
CSC Australia
212 Northbourne Ave, Braddon ACT 2612
Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
MOB: 0401 611779

This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose.




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


Re: Re-populating form after validate fails

2004-02-03 Thread hgosper
Just set up an forward for validation failure. You can do this in your 
struts-config.xml file, in fact you can have as many  forwards as you 
like, but for practical purposes most people prefer to have at most three 
or four forwards per Action. For example, you might have a SaveAction that 
forwards to the next screen in a sequence if validation succeeds, an error 
page if it fails, a login page if the session becomes invalidated, and a 
query action if you had a "delete" button to delete a record.

Just say you query a database to populate your form fields. Then you can 
edit the form and hit Save. In the Form's validate method you fill an 
ActionErrors object.

Then in the SaveAction you will have something like:

// If a message is required, save the specified key(s)
// into the request for use by the  tag.
if (!errors.isEmpty()) 
{
saveErrors(request, errors);

// Forward control to the appropriate 'failure' URI
forward = mapping.findForward("failure");

} 
 
else
{
// Forward control to the appropriate 'success' URI if no errors
forward = mapping.findForward("success");
} 
 
return forward;

and in your struts-config you will have something like:






I hope you can figure out your answer from that... I can't give you a real 
example from my project because of confidentiality so I have to try and 
make it generic.


Cheers,
Heya Gosper
CSC Australia
212 Northbourne Ave, Braddon ACT 2612
Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
MOB: 0401 611779

This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose.






Paul Barry <[EMAIL PROTECTED]>
04/02/2004 09:48 AM
Please respond to "Struts Users Mailing List"

 
To: [EMAIL PROTECTED]
cc: 
Subject:Re-populating form after validate fails


I feel bad asking this question because I know it has been asked 1 million 
times in this group, but I still haven't 
found the answer so I am asking it again.  How do you get a form to 
re-populate if validation fails?  Here is what I am 
trying.

I have 2 actions:




So, the user goes to /myaccount/login.do, and they are presented with a 
form.  The code for that looks like this:


   

   Username: 
   Password: 
   
 
   


The code for the LoginForm is simple, getters and setters with a validate 
method like this:

 public ActionErrors validate(ActionMapping mapping,
 HttpServletRequest 
request) {
 ActionErrors errors = new ActionErrors();
 Object form;
 if(StringUtil.isEmpty(getUsername())) {
 if(log.isDebugEnabled()) 
{
 log.debug("No username was entered.");
 }
 errors.add("message",
 new 
ActionError("myaccount.login.error.missingUsername"));
 errors.add("username",
 new 
ActionError("myaccount.login.error.label"));
 return errors;
 }
 
 if(StringUtil.isEmpty(getPassword())) {
 if(log.isDebugEnabled()) 
{
 log.debug("No password was entered.");
 }
 errors.add("message",
 new 
ActionError("myaccount.login.error.missingPassword"));
 errors.add("password",
 new 
ActionError("myaccount.login.error.label"));
 return errors;
 }
   

Re-populating form after validate fails

2004-02-03 Thread Paul Barry
I feel bad asking this question because I know it has been asked 1 million times in this group, but I still haven't 
found the answer so I am asking it again.  How do you get a form to re-populate if validation fails?  Here is what I am 
trying.

I have 2 actions:



So, the user goes to /myaccount/login.do, and they are presented with a form.  The code for that looks like this:


  
   
  Username: 
  Password: 
  

  

The code for the LoginForm is simple, getters and setters with a validate method like this:

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
Object form;
if(StringUtil.isEmpty(getUsername())) {
if(log.isDebugEnabled()) {
log.debug("No username was entered.");
}
errors.add("message",
new 
ActionError("myaccount.login.error.missingUsername"));
errors.add("username",
new ActionError("myaccount.login.error.label"));
return errors;
}

if(StringUtil.isEmpty(getPassword())) {
if(log.isDebugEnabled()) {
log.debug("No password was entered.");
}
errors.add("message",
new 
ActionError("myaccount.login.error.missingPassword"));
errors.add("password",
new ActionError("myaccount.login.error.label"));
return errors;
}
return errors;
}
What I am struggling with is that when I submit this form, if username is not null, but password is, the username field 
is not populated with the value for username.  I made my own ForwardAction by copying the source code for the struts 1.1 
ForwardAction and adding a few debugging statements.  When I enter a username but no password oand submit the form, I 
get back to the form, but the username field is not filled in.  Here is log:

org.apache.struts.action.RequestProcessor - Processing a 'POST' for path '/myaccount/loginAction'
org.apache.struts.action.RequestProcessor -  Storing ActionForm bean instance in scope 'request' under attribute key 
'LoginForm'
org.apache.struts.action.RequestProcessor -  Populating bean properties from this request
org.apache.struts.action.RequestProcessor -  Validating input form properties
myapp.struts.forms.LoginForm - No password was entered.
org.apache.struts.action.RequestProcessor -  Validation failed, returning to '/myaccount/login.do'
org.apache.struts.action.RequestProcessor -  Delegating via forward to '/myaccount/login.do'
org.apache.struts.action.RequestProcessor - Processing a 'POST' for path '/myaccount/login'
org.apache.struts.action.RequestProcessor -  Storing ActionForm bean instance in scope 'request' under attribute key 
'LoginForm'
org.apache.struts.action.RequestProcessor -  Populating bean properties from this request
org.apache.struts.action.RequestProcessor -  Looking for Action instance for class myapp.struts.actions.ForwardAction
org.apache.struts.action.RequestProcessor -   Returning existing Action instance
myapp.struts.actions.ForwardAction - Path=[/WEB-INF/jsp/myaccount/login.jsp],Form=[Username=dfgfdgfd,Password=]
org.apache.struts.action.RequestProcessor - 
processForwardConfig(ForwardConfig[name=null,path=/WEB-INF/jsp/myaccount/login.jsp,redirect=false,contextRelative=true])

What I don't get is that when I print out the toString of my LoginForm in the debug statement of my ForwardAction, the 
username property is populated.  So why doesn't the html:form populate the html:test field with that value?

And for extra credit, is there any way to not use the path to another action in the input property of an ActionMapping? 
   In the example above, I would rather user a forward titled say "login", than hard-code "/myaccount/login.do" for the 
input of /myaccount/loginAction.







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


validate at least one field

2004-02-03 Thread Alvaro Martinez
I would like to validate a form that contains several fields where at least
one of them should be filled (don't mind what of them)
How can I implement this with validator.xml?
Thanks


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



SV: All values null after Validate

2004-01-15 Thread Søren Blidorf
Hi again.

I am doing it like this:





Is it possible then?

Soren

-Oprindelig meddelelse-
Fra: Otto, Frank [mailto:[EMAIL PROTECTED] 
Sendt: 15. januar 2004 11:35
Til: 'Struts Users Mailing List'
Emne: AW: All values null after Validate

Hi Oliver,

You can use  in [extends ActionForm]
too.


Regards,

Frank

-Ursprüngliche Nachricht-
Von: Oliver Thiel [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 15. Januar 2004 11:21
An: 'Struts Users Mailing List'
Betreff: AW: All values null after Validate


Hi Søren,


IF you use [extends ActionForm] you can use:

"> (in your jsp)

OR:

IF you use [extends ValidatorForm] you can use:

 (in your jsp)
 

Hope that helps
Oliver

-Ursprüngliche Nachricht-
Von: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Januar 2004 11:16
An: [EMAIL PROTECTED]
Betreff: All values null after Validate

Hi.
I am using struts and I am doing a form validate.

When the user types in more than on thing and one of them fails
validation, all the values is returned blank.

Is there anyway to keep the values when validate error?

BR

Soren


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



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



SV: All values null after Validate

2004-01-15 Thread Søren Blidorf
That's great. Thanks both

I'll try that right away

Soren

-Oprindelig meddelelse-
Fra: Otto, Frank [mailto:[EMAIL PROTECTED] 
Sendt: 15. januar 2004 11:35
Til: 'Struts Users Mailing List'
Emne: AW: All values null after Validate

Hi Oliver,

You can use  in [extends ActionForm]
too.


Regards,

Frank

-Ursprüngliche Nachricht-
Von: Oliver Thiel [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 15. Januar 2004 11:21
An: 'Struts Users Mailing List'
Betreff: AW: All values null after Validate


Hi Søren,


IF you use [extends ActionForm] you can use:

"> (in your jsp)

OR:

IF you use [extends ValidatorForm] you can use:

 (in your jsp)
 

Hope that helps
Oliver

-Ursprüngliche Nachricht-
Von: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Januar 2004 11:16
An: [EMAIL PROTECTED]
Betreff: All values null after Validate

Hi.
I am using struts and I am doing a form validate.

When the user types in more than on thing and one of them fails
validation, all the values is returned blank.

Is there anyway to keep the values when validate error?

BR

Soren


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



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



AW: All values null after Validate

2004-01-15 Thread Otto, Frank
Hi Oliver,

You can use  in [extends ActionForm] too.


Regards,

Frank

-Ursprüngliche Nachricht-
Von: Oliver Thiel [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 15. Januar 2004 11:21
An: 'Struts Users Mailing List'
Betreff: AW: All values null after Validate


Hi Søren,


IF you use [extends ActionForm] you can use:

"> (in your jsp)

OR:

IF you use [extends ValidatorForm] you can use:

 (in your jsp)
 

Hope that helps
Oliver

-Ursprüngliche Nachricht-
Von: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Januar 2004 11:16
An: [EMAIL PROTECTED]
Betreff: All values null after Validate

Hi.
I am using struts and I am doing a form validate.

When the user types in more than on thing and one of them fails
validation, all the values is returned blank.

Is there anyway to keep the values when validate error?

BR

Soren


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



AW: All values null after Validate

2004-01-15 Thread Oliver Thiel
Hi Søren,


IF you use [extends ActionForm] you can use:

"> (in your jsp)

OR:

IF you use [extends ValidatorForm] you can use:

 (in your jsp)
 

Hope that helps
Oliver

-Ursprüngliche Nachricht-
Von: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Januar 2004 11:16
An: [EMAIL PROTECTED]
Betreff: All values null after Validate

Hi.
I am using struts and I am doing a form validate.

When the user types in more than on thing and one of them fails
validation, all the values is returned blank.

Is there anyway to keep the values when validate error?

BR

Soren


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



All values null after Validate

2004-01-15 Thread Søren Blidorf
Hi.
I am using struts and I am doing a form validate.

When the user types in more than on thing and one of them fails
validation, all the values is returned blank.

Is there anyway to keep the values when validate error?

BR

Soren


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



Re: Howto answer: Validate two input forms (PDA and 1024x768) for same Action

2004-01-03 Thread Iain Sanderson
Answered my own question.



and



 ie 2 action paths in struts-config pointing to the same Action type, each 
referring back to different input JSPs. No extra code.

Iain.





Iain Sanderson <[EMAIL PROTECTED]>
01/02/2004 09:51 AM
Please respond to "Struts Users Mailing List"
 
To: [EMAIL PROTECTED]
cc: 
Subject:    Howto please: Validate two input forms (PDA and 
1024x768) for same Action


I'm evolving a large STRUTS medical application to place some of it's 
functionality on 802.11b-enabled Pocket PC devices using Mobile IE, 
reformatting views to the 240x320 pixel resolution for these devices.
My method is to test the request header for this resolution and Forward 
the response on to  smaller (240x320) output JSPs, leaving all the 
underlying Action and  business logic unchanged. It works very well, 
maintaining nice MVC principles.  The challenge is that I would like to do 

the same with input forms, but cut down the input view  for the PDA 
version, maintain validation for the PDA version, and return control to 
the PDA version if a validation error occurs.

This is the Action code that directs the ActionForward to two outputs, one 

regular, one PDA.

public class SchedChoiceActions extends DispatchAction {

// some more ActionForwards here


   /*
 *The "liveOff" Action is invoked if the "liveOff" request parameter 
has the value "off"
 *
 */
public ActionForward liveOff(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

   // more stuff
 
// Forward control to the specified success URI
if(request.getHeader("user-agent").indexOf("240x320")>0) {return 
(mapping.findForward("outputPdaVersion")); }
 else{  return (mapping.findForward("output"));} 
}
}

Here's the problem on the INPUT side. If a validation error ocurs in the 
PDA version of an input form, I only have one option of returning control 
to the input form, and in my current app, it returns control via 
struts-config to a regularly sized JSP. I can't differentially send a PDA 
validation error back to the PDA input  JSP, sharing the Action with a 
regular set of input forms.

Is there an elegant solution for this?   Areas I'm exploring  1) Chaining 
an action for the PDA version input form to call the 'regular' action, 
which can then test for output resolution as above ( ugh!).2) Can Strut's 
Validator do this? (currently validating only in ActionForms).

Thanks,

Iain Sanderson.




Howto please: Validate two input forms (PDA and 1024x768) for same Action

2004-01-02 Thread Iain Sanderson
I'm evolving a large STRUTS medical application to place some of it's 
functionality on 802.11b-enabled Pocket PC devices using Mobile IE, 
reformatting views to the 240x320 pixel resolution for these devices.
My method is to test the request header for this resolution and Forward 
the response on to  smaller (240x320) output JSPs, leaving all the 
underlying Action and  business logic unchanged. It works very well, 
maintaining nice MVC principles.  The challenge is that I would like to do 
the same with input forms, but cut down the input view  for the PDA 
version, maintain validation for the PDA version, and return control to 
the PDA version if a validation error occurs.

This is the Action code that directs the ActionForward to two outputs, one 
regular, one PDA.

public class SchedChoiceActions extends DispatchAction {

// some more ActionForwards here


   /*
 *The "liveOff" Action is invoked if the "liveOff" request parameter 
has the value "off"
 *
 */
public ActionForward liveOff(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

   // more stuff
 
// Forward control to the specified success URI
if(request.getHeader("user-agent").indexOf("240x320")>0) {return 
(mapping.findForward("outputPdaVersion")); }
 else{  return (mapping.findForward("output"));} 
}
}

Here's the problem on the INPUT side. If a validation error ocurs in the 
PDA version of an input form, I only have one option of returning control 
to the input form, and in my current app, it returns control via 
struts-config to a regularly sized JSP. I can't differentially send a PDA 
validation error back to the PDA input  JSP, sharing the Action with a 
regular set of input forms.

Is there an elegant solution for this?   Areas I'm exploring  1) Chaining 
an action for the PDA version input form to call the 'regular' action, 
which can then test for output resolution as above ( ugh!).2) Can Strut's 
Validator do this? (currently validating only in ActionForms).

Thanks,

Iain Sanderson.



html array validate

2003-12-22 Thread vico
Hello,
(B in my html, i have a array object,
(Blike this:
(B
(B
(B,and when i submit, how to validate it.
(Bi want use javascript check,how to write validate.xml.
(B
(Bthanks
(B
(Bvico

Re: Validate method in action form

2003-12-18 Thread Ted Husted
Another approach would be to create a base ActionForm with the 
properties, and then extend it for each validation instance.

You can also use the came ActionForm class in multiple form-bean 
elements, and then use the Struts Validator to give each form-bean it's 
own validation suite.

HTH, Ted.

vasudevrao gupta wrote:
I have a single action form bean for multiple JSP pages.
Validation of fields for JSP1 is different from validation of fields in
JSP2.
How should I write the validate() method in the form so that depending
on the 
action, appropriate validation of fields is done.

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


Validate method in action form

2003-12-18 Thread vasudevrao gupta

I have a single action form bean for multiple JSP pages.
Validation of fields for JSP1 is different from validation of fields in
JSP2.
How should I write the validate() method in the form so that depending
on the 
action, appropriate validation of fields is done.

Regards
Vasudevraogupta


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]



Which framework's validate if preferred? Struts - JSTL

2003-12-01 Thread ZYD
Dear all,

Struts and JSTL both have validator framework, which one is preferred if I'm using 
struts and JSTL in one web application?

Thanks.

bruce

help: how to validate a Integer type data. that equals blank...

2003-11-28 Thread Ricky
hello,
   sorry to trouble you of my problem. i hope for the best solution of my
problem.

i am using DynaValidatorForm to validate my form, and i have form-name, a
form property configurate like this:



and in my jsp is :

  
add new author..


and in my validation.xml ,just configurate below..




it can't validate properly, until i change the form-property type to
"java.lang.String",
i know the validator's depends required must be correspond to a String type,
but i want to keep the java.lang.Integer type, instead of that, i can set
the option value equals 0, and use the Range depends to validate the field,
or use "validwhen" that compare with 0 to validate the field, but that
depends property hasn't available in Struts 1.1, any better solution about
this case, i want to leave the form-bean type to java.lang.Integer, and if
the option value is blank(""), how can i validate this field?

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



Re: validation.xml and validate() method

2003-11-24 Thread Sergey Smirnov
Your form-bean should expand org.apacher.struts.validator.ValidatorForm, not
just ActionForm, and your validate() should call validate() from super class
(ValidatorForm) to have validation.xml involved.


"Honza Spurný" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there,
>
> as I can see, when I implement the validate() method in the ActionForm, it
> means, that validation throught validation.xml file (inner struts
> validation) stops to work.
>
> ??? Am I right ???
>
> This seems to me so... Am I doing something wrong? How can I walk throught
> both validation? If it is able, which one is first performed?
>
> Thanks for answers.
>
> Sporak




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



Re: validation.xml and validate() method

2003-11-24 Thread Dirk Markert
Hello Sporak,

   call super.validate().

***

HS> Hi there,

HS> as I can see, when I implement the validate() method in the ActionForm, it
HS> means, that validation throught validation.xml file (inner struts
HS> validation) stops to work.

HS> ??? Am I right ???

HS> This seems to me so... Am I doing something wrong? How can I walk throught
HS> both validation? If it is able, which one is first performed?

HS> Thanks for answers.

HS> Sporak


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



Regards,
Dirk

+--- Quality leads ---+
| Dirk Markert [EMAIL PROTECTED] |
| Dr. Markert Softwaretechnik AG  |
| Joseph-von-Fraunhofer-Str. 20   |
| 44227 Dortmund  |
+-->>>>>>> to success! <<<<<<-+ 


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



validation.xml and validate() method

2003-11-24 Thread Honza Spurný
Hi there,

as I can see, when I implement the validate() method in the ActionForm, it
means, that validation throught validation.xml file (inner struts
validation) stops to work.

??? Am I right ???

This seems to me so... Am I doing something wrong? How can I walk throught
both validation? If it is able, which one is first performed?

Thanks for answers.

Sporak


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



what is the right way to test whether execute() is called after validate()?

2003-11-18 Thread Janice
I'm sorry if this is too basic, I'm still really green.

I'm validating a form.  This form is used for adding and editing widgets.  I
use the same actionHandler, where I test a request parameter and set up the
form accordingly.  It builds my form object and either resets it for an add,
or retrieves a widget from the DB and sticks it in my object.

What I found was, when my validation failed on add or edit, it was still
going thru the execute() method of my actionHandler and was therefore
reset()ing on add or re-building my form object on edit.

So, I put in something like this instead:

  if ((request.getParameter("Submit") == null) ||
  (!request.getParameter("Submit").equals("Submit"))) {

if (request.getParameter("addEdit").equals("edit")) {
  form = buildCompanyForm(request.getParameter("id"), request);
} else {
  form = new CompanyForm();
  form.reset(mapping, request);
}
  }

And it works, but testing whether Submit has been pressed seems kinda nasty.
I'd like to learn a better way.

Thanks in advance,
Janice


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



Re: Validate Uploads,

2003-11-07 Thread Rajat Pandit
hello sunny,
why dont u write a quick jscript instead to check the value of the file 
type.  u might also want to u use regex to check if the file selected 
was of a valid extension or not.
personally, i dont find the validation.xml a pain unless the form is 
huge. for small issues writing a quick jscript seems to be better idea 
(IMHO).

ps: maybe my ignorance (read lazyness) for reading more about it is the 
factor.

Sunny wrote:

Hi friends,

I'm a newbie to struts.

 While uploading a file, I want to validate, whether the user has selected 
the file or not.

 i mean i want to handle situation when user submits the form with out 
selecting any file.

 in my validation.xml, i've made field's property as depends = "required"

but i am getting the exception
org.apache.commons.beanutils.ConversionException: Cannot assign value of type 
'java.lang.String' to property 'projectFile' of type 
'org.apache.struts.upload.FormFile'

kindly help me in this regard.

Sunny.

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

Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]


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


Re: Validate Uploads,

2003-11-07 Thread Jeff Kyser
Check the javadocs for org.apache.struts.upload.FormFile,
I think has a member, fileName, or something like that.
You want to have a string filename on your form, and then
make IT required. When the user successfully supplies a
value, then you can set the FormFile's value to it.
or something like that...

-jeff

On Friday, November 7, 2003, at 08:24  AM, Sunny wrote:

Hi friends,

I'm a newbie to struts.

 While uploading a file, I want to validate, whether the user has 
selected
the file or not.

 i mean i want to handle situation when user submits the form with out
selecting any file.
 in my validation.xml, i've made field's property as depends = 
"required"

but i am getting the exception
org.apache.commons.beanutils.ConversionException: Cannot assign value 
of type
'java.lang.String' to property 'projectFile' of type
'org.apache.struts.upload.FormFile'

kindly help me in this regard.

Sunny.

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


Validate Uploads,

2003-11-07 Thread Sunny
Hi friends,

I'm a newbie to struts.

 While uploading a file, I want to validate, whether the user has selected 
the file or not.

 i mean i want to handle situation when user submits the form with out 
selecting any file.

 in my validation.xml, i've made field's property as depends = "required"

but i am getting the exception
org.apache.commons.beanutils.ConversionException: Cannot assign value of type 
'java.lang.String' to property 'projectFile' of type 
'org.apache.struts.upload.FormFile'

kindly help me in this regard.

Sunny.

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



Re: validate method

2003-10-31 Thread Ben Anderson
   ActionErrors ae = form.validate( mapping, request );
   if( ae.size() != 0 ){
   saveErrors( request, ae );
   return new ActionForward( mapping.getInput() );
   }

From: "Khandelwal, Rahul" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: validate method
Date: Fri, 31 Oct 2003 15:47:37 +0530
Hi All,

For some reason, I have to do some form field validation in my Action 
class.
And, if the validation fails, I have to return the control to the
same(input) page to display the error msg (using ). I have
previously done it in the validate method in the Form bean, but don't know
how to put the validation in the Action class.

Any help will be much appreciated.

Thanks,
Rahul
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee.  Access to 
this
message by anyone else is unauthorised.  If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful.  Please immediately contact the sender if you have received this
message in error. Thank you.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Surf and talk on the phone at the same time with broadband Internet access. 
Get high-speed for as low as $29.95/month (depending on the local service 
providers in your area).  https://broadband.msn.com

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


validate method

2003-10-31 Thread Khandelwal, Rahul
Hi All,

For some reason, I have to do some form field validation in my Action class.
And, if the validation fails, I have to return the control to the
same(input) page to display the error msg (using ). I have
previously done it in the validate method in the Form bean, but don't know
how to put the validation in the Action class.

Any help will be much appreciated.

Thanks,
Rahul
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee.  Access to this
message by anyone else is unauthorised.  If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful.  Please immediately contact the sender if you have received this
message in error. Thank you.

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



Re: How to validate is selected on a JSP page?

2003-10-26 Thread ZYD
I found this:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg79778.html

but it seem the problem is still not solved, right?

- Original Message - 
From: "Rajat Pandit" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Sunday, October 26, 2003 3:01 PM
Subject: RE: How to validate  is selected on a JSP page?


> Lets hope for someone to reply to this! :D 
> 
> -Original Message-
> From: ZYD [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, October 25, 2003 10:50 AM
> To: Struts Users Mailing List
> Subject: Re: How to validate  is selected on a JSP page?
> 
> 
> Yes,  that works. But that's not decent like you said.
> Is there really no way to do a client-side validation using validator
> framework?
> 
> - Original Message - 
> From: "Rajat Pandit" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Sunday, October 26, 2003 1:37 PM
> Subject: RE: How to validate  is selected on a JSP page?
> 
> 
> > I couldn't find a workaround for that so far. I use the validate() 
> > method of the actionform. Pretty lame! Eh!
> > 
> > -Original Message-
> > From: ZYD [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, October 25, 2003 10:33 AM
> > To: Struts Users Mailing List
> > Subject: How to validate  is selected on a JSP page?
> > 
> > 
> > Hi friends,
> > 
> > How to make sure a radiobox is selected on a JSP page using validator?
> > 
> > I cannot use:
> > 
> >
> > 
> > 
> > Thanks
> > 
> > -bruce
> > 
> > 
> > -
> > 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: How to validate is selected on a JSP page?

2003-10-26 Thread Rajat Pandit
Lets hope for someone to reply to this! :D 

-Original Message-
From: ZYD [mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 25, 2003 10:50 AM
To: Struts Users Mailing List
Subject: Re: How to validate  is selected on a JSP page?


Yes,  that works. But that's not decent like you said.
Is there really no way to do a client-side validation using validator
framework?

- Original Message - 
From: "Rajat Pandit" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Sunday, October 26, 2003 1:37 PM
Subject: RE: How to validate  is selected on a JSP page?


> I couldn't find a workaround for that so far. I use the validate() 
> method of the actionform. Pretty lame! Eh!
> 
> -Original Message-
> From: ZYD [mailto:[EMAIL PROTECTED]
> Sent: Saturday, October 25, 2003 10:33 AM
> To: Struts Users Mailing List
> Subject: How to validate  is selected on a JSP page?
> 
> 
> Hi friends,
> 
> How to make sure a radiobox is selected on a JSP page using validator?
> 
> I cannot use:
> 
>
> 
> 
> Thanks
> 
> -bruce
> 
> 
> -
> 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: How to validate is selected on a JSP page?

2003-10-25 Thread ZYD
Yes,  that works. But that's not decent like you said.
Is there really no way to do a client-side validation using validator framework?

- Original Message - 
From: "Rajat Pandit" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Sunday, October 26, 2003 1:37 PM
Subject: RE: How to validate  is selected on a JSP page?


> I couldn't find a workaround for that so far. I use the validate()
> method of the actionform. Pretty lame! Eh!
> 
> -Original Message-
> From: ZYD [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, October 25, 2003 10:33 AM
> To: Struts Users Mailing List
> Subject: How to validate  is selected on a JSP page?
> 
> 
> Hi friends,
> 
> How to make sure a radiobox is selected on a JSP page using validator?
> 
> I cannot use:
> 
>
> 
> 
> Thanks
> 
> -bruce
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

RE: How to validate is selected on a JSP page?

2003-10-25 Thread Rajat Pandit
I couldn't find a workaround for that so far. I use the validate()
method of the actionform. Pretty lame! Eh!

-Original Message-
From: ZYD [mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 25, 2003 10:33 AM
To: Struts Users Mailing List
Subject: How to validate  is selected on a JSP page?


Hi friends,

How to make sure a radiobox is selected on a JSP page using validator?

I cannot use:

   


Thanks

-bruce


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



How to validate is selected on a JSP page?

2003-10-25 Thread ZYD
Hi friends,

How to make sure a radiobox is selected on a JSP page using validator?

I cannot use:

   


Thanks

-bruce


Re: Multiple error pages from validate method

2003-10-24 Thread Max Cooper
The input page is specified in the action mapping. Use separate action
mappings  for each input page (add.jsp and edit.jsp). You can use the same
Action class for both.

-Max

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 24, 2003 12:15 PM
Subject: Multiple error pages from validate method


> Hello,
>
> I am using one ActionForm bean for multiple pages..say for add.jsp and
> edit.jsp.But when I validate and I get an error I want the user to go to
> different error pages instead of one just specified in struts-config file
> as input parameter?
>
> Can somebody help??



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



Re: Multiple error pages from validate method

2003-10-24 Thread Geeta Ramani
Ah! I was assuming that the original poster was validating in the form bean..:)

"Chen, Gin" wrote:

> Here's another way that I can think of:
>
> I'm assuming you will have 2 actions (one for add and one for edit) or a
> single action that uses a lookupdispatch add/edit handling.
> In either case don't have validate="true" in your struts-config but rather
> do the validation from your action method:
> public ActionForward addAction()
> {
>   ActionErrors errors = myBean.validate(...);
>   if( errors != null && !errors.isEmpty())
>   {
>   return aMapping.findForward("ERROR_PAGE_ADD");
>   }
> }
>
> Do the same for edit.
>
> Of course there are a lot of other ways to do this as well.
> -Tim
>
> -Original Message-
> From: Geeta Ramani [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 24, 2003 3:36 PM
> To: Struts Users Mailing List
> Subject: Re: Multiple error pages from validate method
>
> Here's one "hacky" way of doing this:  Set a request attribute, something
> like "goToErrorPage2" right after you validate. On the top of the error page
> if that attribute goToErrorPage2 is nonnull, then forward to the second
> error
> page else simply render the "normal" error page..
>
> [EMAIL PROTECTED] wrote:
>
> > Hello,
> >
> > I am using one ActionForm bean for multiple pages..say for add.jsp and
> > edit.jsp.But when I validate and I get an error I want the user to go to
> > different error pages instead of one just specified in struts-config file
> > as input parameter?
> >
> > Can somebody help??
>
> -
> 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]



RE: Multiple error pages from validate method

2003-10-24 Thread VKeswani
Thanks Tim.This too makes good sense..thanks 




"Chen, Gin" <[EMAIL PROTECTED]>
10/24/2003 02:45 PM
Please respond to "Struts Users Mailing List"

 
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
cc: 
    Subject:RE: Multiple error pages from validate method


Here's another way that I can think of:

I'm assuming you will have 2 actions (one for add and one for edit) or a
single action that uses a lookupdispatch add/edit handling.
In either case don't have validate="true" in your struts-config but rather
do the validation from your action method:
public ActionForward addAction()
{
  ActionErrors errors = myBean.validate(...);
  if( errors != null && !errors.isEmpty())
  {
  return aMapping.findForward("ERROR_PAGE_ADD");
  }
}

Do the same for edit.

Of course there are a lot of other ways to do this as well.
-Tim

-Original Message-
From: Geeta Ramani [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 24, 2003 3:36 PM
To: Struts Users Mailing List
Subject: Re: Multiple error pages from validate method


Here's one "hacky" way of doing this:  Set a request attribute, something
like "goToErrorPage2" right after you validate. On the top of the error 
page
if that attribute goToErrorPage2 is nonnull, then forward to the second
error
page else simply render the "normal" error page..

[EMAIL PROTECTED] wrote:

> Hello,
>
> I am using one ActionForm bean for multiple pages..say for add.jsp and
> edit.jsp.But when I validate and I get an error I want the user to go to
> different error pages instead of one just specified in struts-config 
file
> as input parameter?
>
> Can somebody help??


-
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: Multiple error pages from validate method

2003-10-24 Thread Chen, Gin
Here's another way that I can think of:

I'm assuming you will have 2 actions (one for add and one for edit) or a
single action that uses a lookupdispatch add/edit handling.
In either case don't have validate="true" in your struts-config but rather
do the validation from your action method:
public ActionForward addAction()
{
  ActionErrors errors = myBean.validate(...);
  if( errors != null && !errors.isEmpty())
  {
  return aMapping.findForward("ERROR_PAGE_ADD");
  }
}

Do the same for edit.

Of course there are a lot of other ways to do this as well.
-Tim

-Original Message-
From: Geeta Ramani [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 24, 2003 3:36 PM
To: Struts Users Mailing List
Subject: Re: Multiple error pages from validate method


Here's one "hacky" way of doing this:  Set a request attribute, something
like "goToErrorPage2" right after you validate. On the top of the error page
if that attribute goToErrorPage2 is nonnull, then forward to the second
error
page else simply render the "normal" error page..

[EMAIL PROTECTED] wrote:

> Hello,
>
> I am using one ActionForm bean for multiple pages..say for add.jsp and
> edit.jsp.But when I validate and I get an error I want the user to go to
> different error pages instead of one just specified in struts-config file
> as input parameter?
>
> Can somebody help??


-
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: Multiple error pages from validate method

2003-10-24 Thread VKeswani
Thanks geeta!

Yes that might be a roundabout way of doing it.Lemme try!




"Geeta Ramani" <[EMAIL PROTECTED]>
10/24/2003 02:36 PM
Please respond to "Struts Users Mailing List"

 
To: Struts Users Mailing List <[EMAIL PROTECTED]>
cc: 
Subject:    Re: Multiple error pages from validate method


Here's one "hacky" way of doing this:  Set a request attribute, something
like "goToErrorPage2" right after you validate. On the top of the error 
page
if that attribute goToErrorPage2 is nonnull, then forward to the second 
error
page else simply render the "normal" error page..

[EMAIL PROTECTED] wrote:

> Hello,
>
> I am using one ActionForm bean for multiple pages..say for add.jsp and
> edit.jsp.But when I validate and I get an error I want the user to go to
> different error pages instead of one just specified in struts-config 
file
> as input parameter?
>
> Can somebody help??


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





Re: Multiple error pages from validate method

2003-10-24 Thread Geeta Ramani
Here's one "hacky" way of doing this:  Set a request attribute, something
like "goToErrorPage2" right after you validate. On the top of the error page
if that attribute goToErrorPage2 is nonnull, then forward to the second error
page else simply render the "normal" error page..

[EMAIL PROTECTED] wrote:

> Hello,
>
> I am using one ActionForm bean for multiple pages..say for add.jsp and
> edit.jsp.But when I validate and I get an error I want the user to go to
> different error pages instead of one just specified in struts-config file
> as input parameter?
>
> Can somebody help??


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



Multiple error pages from validate method

2003-10-24 Thread VKeswani
Hello,

I am using one ActionForm bean for multiple pages..say for add.jsp and 
edit.jsp.But when I validate and I get an error I want the user to go to 
different error pages instead of one just specified in struts-config file 
as input parameter?

Can somebody help??

RE: Reset() and validate() using DynaActionForm

2003-10-21 Thread Chen, Gin
RTFM:
http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_act
ion_form_classes

"If need be, you can extend the DynaActionForm to add custom validate and
reset methods you might need. Simply specify your subclass in the
struts-config instead. However, you cannot mix conventional properties and
DynaProperties. A conventional getter or setter on a DynaActionForm won't be
found by the reflection utilities. "

-Tim

-Original Message-
From: Shishir K. Singh [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 21, 2003 1:02 PM
To: Struts Users Mailing List
Subject: Reset() and validate() using DynaActionForm


Hello, 

I am trying to use DynaActionForm. However, I would like to have the
reset() and validate() functionality using DynaActionForm. Any pointers
as to how to get around this without going back to ActionForm. 

TIA 
Shishir

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



Reset() and validate() using DynaActionForm

2003-10-21 Thread Shishir K. Singh
Hello, 

I am trying to use DynaActionForm. However, I would like to have the
reset() and validate() functionality using DynaActionForm. Any pointers
as to how to get around this without going back to ActionForm. 

TIA 
Shishir

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



DynaValidatorActionForm does not validate data

2003-10-20 Thread icorcos
Hi All,

There was a known bug regarding the DynaValidatorActionForm class not 
working with the Validator framework.  This bug was reported as bug 10432 
in bugzilla (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10432).
 From my understanding, this bug was supposed to be fixed before the final 
release of Struts 1.1 however I just downloaded the latest version of 
Struts 1.1 (which I thought was final version) and the bug still exists.

Can anyone shed some light on this topic?

Thanks

Igal Corcos

problem with forwarding to input from the method validate

2003-10-10 Thread Raphaël di Cicco
Hi,

I'm working with Struts 1.1 and tiles. It seems like the validate() can't
forward to my tiles page when an ActionErrors occurs.
Here is my struts-config.xml file :






When my method validate on EditDossCEForm fails it returns a non null
ActionErrors and this is supposed to forward to the input page. The
RequestProcessor seems to find page.communs.editDossCECarte as the input,
however it fails in finding the corresponding tiles definition (
mapping.findForward(input) is null)
and therefore forward me to the correct page. I solved this problem by
adding this forward :


Was anyone aware of this problem ? Any other way to solve this ?
Raphaël


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



Correction: DynaValidatorForm.validate() does not seemt o validate Integers when called from DispatchAction [Re: Problem validating form manually in DispatchAction]

2003-10-10 Thread Elie Medeiros
In reference to the problem below, it actually seems that the
DynaValidatorForm.validate() method does validate Strings, but not
Integers

any clues appreciated

Elie

> Hi there,
> 
> am having a problem validating a form manually using the
> DynaValidatorForm.validate() function. For some reason, when validation
> is carried out this way it only seems to find errors in one of the form
> fields - however, if I set the validate="true" property in the
> struts-module-config.xml file, validation does seem to be carried out
> properly, which suggests to me that I did not make a mistake in the
> validation configuration. Since I want to use DispatchAction however, I
> can't use validate="true", as I need to validate the form selectively
> for one of the methods only. 
> 
> I have tried using ValidatorLookupdispatchForm, but can't use it as
> Struts 1.1 (which I am using) seems to have a bug with the set-property
> tag in the module-config.xml file. Also tried latest version of Struts
> (1.1, was using 1.1rc3) and of the validator (1.0, 1.02, latest nightly
> build). My code is as follows - pretty straightforward:
> 
> 
>   DynaValidatorForm thisForm = (DynaValidatorForm)form;
>   ActionErrors errors=thisForm.validate(mapping,request);
>   
> Integer var1= (Integer)thisForm.get("var1");
> (... get more form vars...)
>   
>   //if errors, back to form
>   if (!errors.isEmpty()) {
>   saveErrors(request, errors);
> 
>   return mapping.getInputForward();
>}
> 
> 
> 
>  path="/details" 
>   scope="request"
>   parameter="method"
>   type="com.inc.modules.users.DetailsAction"
>   validate="false">
>   
>  
>   
> 
> 
> 
>   
>  property="var1"
>   depends="required,integer">
>   
>   
>   
>   
>   
>   
> 
> 
> I have spent almost 2 days trying to figure ways of getting around this
> - anyone have any ideas?
> 
> Thanks,
> Elie
> 
> 
> -
> 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: Validate values in a collection

2003-09-26 Thread Rassmann, Natalie D
Timo,

I would try to avoid using the requiredif because it will be deprecated with the
next release of struts.  validwhen will replace it.  validwhen is much more
powerful and easier to use.  To get the validwhen code, you have to go and
download a nightly build.  I just did it a few days ago and everything works
fine.  I actually built the validwhen stuff into my app rather than used the new
struts.jar file.

If you don't want to try and use the validwhen then you can modify Matt Raible's
design for validating two fields.  I did that too.  The only problem I had was
when I was trying to validate an indexed property and a non-indexed property.  The
getProperty method in the common-beanutils kept getting an error when trying to
use reflection to find the second property (the one that was not no part of the
collection).  In other words, I was trying to compare an item in an ArrayList with
a property that was just a String (not part of the ArrayList).  I had and still am
having problems with that.  I am going to try again this morning and try to get it
to work because the validateTwoFields works great when it works.

http://www.raibledesigns.com/page/rd/20030226#struts_validator_validating_two_fields


I hope this helps,

Natalie

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



Re: Validate values in collection?

2003-09-26 Thread Timo Neumann
Natalie D Rassmann wrote:

Hi Natalie and everybody,

do you know if I can do a requiredif check against a second property in 
the same bean?

something like:



	
	
		field[0]
		funds.valueNeeded
	
	
		fieldTest[0]
		EQUAL
	
	
		fieldValue[0]
		true
	



Timo

It depends on if it is indexed or not.

Here is an example that I have...

 
  
   
I am using a multi-page for that is why I have the page attribute.

The prepTime property is a String[].

Here is an example of a property that is part of the defectsList collection.
defectsList is an ArrayList.  I wrote the isFieldEmpty validation.
   
  
   
Does this help?

Natalie

Timo Neumann wrote:


Natalie D Rassmann wrote:

So this works if "forms" is a collection of beans with a property "value"?


   
   
   

Like you would any other type of form.  Do you know how to set up the
validator framework?  If not try this link below:
http://jakarta.apache.org/struts/userGuide/dev_validator.html

Timo Neumann wrote:



Natalie D Rassmann wrote:



yes
how?



Timo Neumann wrote:




Hi all,

is it possible to use the validator framework to check values of beans
that are stored in a collection in a DynaValidatorForm?
TIA,

Timo
--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
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]
--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
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]
--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
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]


--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Validate values in collection?

2003-09-25 Thread Timo Neumann
Natalie D Rassmann wrote:

Hi Natalie,

now I got it. Thanks a lot.

Timo

It depends on if it is indexed or not.

Here is an example that I have...

 
  
   
I am using a multi-page for that is why I have the page attribute.

The prepTime property is a String[].

Here is an example of a property that is part of the defectsList collection.
defectsList is an ArrayList.  I wrote the isFieldEmpty validation.
   
  
   
Does this help?

Natalie

Timo Neumann wrote:


Natalie D Rassmann wrote:

So this works if "forms" is a collection of beans with a property "value"?


   
   
   

Like you would any other type of form.  Do you know how to set up the
validator framework?  If not try this link below:
http://jakarta.apache.org/struts/userGuide/dev_validator.html

Timo Neumann wrote:



Natalie D Rassmann wrote:



yes
how?



Timo Neumann wrote:




Hi all,

is it possible to use the validator framework to check values of beans
that are stored in a collection in a DynaValidatorForm?


--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Validate values in collection?

2003-09-25 Thread Nimish Chourey , Tidel Park - Chennai
You can always extend DynaValidatorForm and overwrite the validate method . 

-Original Message-
From: Timo Neumann [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 6:06 PM
To: Struts Users Mailing List
Subject: Re: Validate values in collection?


Natalie D Rassmann wrote:

> yes

how?

> 
> Timo Neumann wrote:
> 
> 
>>Hi all,
>>
>>is it possible to use the validator framework to check values of beans
>>that are stored in a collection in a DynaValidatorForm?
>>
>>TIA,
>>
>>Timo
>>--
>>F&F Computer AnwendungenTel: +49 89 51727-352
>>und Unternehmensberatung GmbH   Fax: +49 89 51727-111
>>Westendstr. 195 Mail: [EMAIL PROTECTED]
>>D-80686 Muenchenhttp://www.ff-muenchen.de
>>
>>-
>>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]


-- 
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de


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


Re: Validate values in collection?

2003-09-25 Thread Natalie D Rassmann
It depends on if it is indexed or not.

Here is an example that I have...

 
  
   


I am using a multi-page for that is why I have the page attribute.

The prepTime property is a String[].

Here is an example of a property that is part of the defectsList collection.
defectsList is an ArrayList.  I wrote the isFieldEmpty validation.

   
  
   


Does this help?

Natalie

Timo Neumann wrote:

> Natalie D Rassmann wrote:
>
> So this works if "forms" is a collection of beans with a property "value"?
>
> 
> 
> 
> 
> 
>
> > Like you would any other type of form.  Do you know how to set up the
> > validator framework?  If not try this link below:
> >
> > http://jakarta.apache.org/struts/userGuide/dev_validator.html
> >
> > Timo Neumann wrote:
> >
> >
> >>Natalie D Rassmann wrote:
> >>
> >>
> >>>yes
> >>
> >>how?
> >>
> >>
> >>>Timo Neumann wrote:
> >>>
> >>>
> >>>
> Hi all,
> 
> is it possible to use the validator framework to check values of beans
> that are stored in a collection in a DynaValidatorForm?
> 
> TIA,
> 
> Timo
> --
> F&F Computer AnwendungenTel: +49 89 51727-352
> und Unternehmensberatung GmbH   Fax: +49 89 51727-111
> Westendstr. 195 Mail: [EMAIL PROTECTED]
> D-80686 Muenchenhttp://www.ff-muenchen.de
> 
> -
> 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]
> >>
> >>--
> >>F&F Computer AnwendungenTel: +49 89 51727-352
> >>und Unternehmensberatung GmbH   Fax: +49 89 51727-111
> >>Westendstr. 195 Mail: [EMAIL PROTECTED]
> >>D-80686 Muenchenhttp://www.ff-muenchen.de
> >>
> >>-
> >>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]
>
> --
> F&F Computer AnwendungenTel: +49 89 51727-352
> und Unternehmensberatung GmbH   Fax: +49 89 51727-111
> Westendstr. 195 Mail: [EMAIL PROTECTED]
> D-80686 Muenchenhttp://www.ff-muenchen.de
>
> -
> 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: Validate values in collection?

2003-09-25 Thread Timo Neumann
Natalie D Rassmann wrote:

So this works if "forms" is a collection of beans with a property "value"?







Like you would any other type of form.  Do you know how to set up the
validator framework?  If not try this link below:
http://jakarta.apache.org/struts/userGuide/dev_validator.html

Timo Neumann wrote:


Natalie D Rassmann wrote:


yes
how?


Timo Neumann wrote:



Hi all,

is it possible to use the validator framework to check values of beans
that are stored in a collection in a DynaValidatorForm?
TIA,

Timo
--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
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]
--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
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]


--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Validate values in collection?

2003-09-25 Thread Natalie D Rassmann
Like you would any other type of form.  Do you know how to set up the
validator framework?  If not try this link below:

http://jakarta.apache.org/struts/userGuide/dev_validator.html

Timo Neumann wrote:

> Natalie D Rassmann wrote:
>
> > yes
>
> how?
>
> >
> > Timo Neumann wrote:
> >
> >
> >>Hi all,
> >>
> >>is it possible to use the validator framework to check values of beans
> >>that are stored in a collection in a DynaValidatorForm?
> >>
> >>TIA,
> >>
> >>Timo
> >>--
> >>F&F Computer AnwendungenTel: +49 89 51727-352
> >>und Unternehmensberatung GmbH   Fax: +49 89 51727-111
> >>Westendstr. 195 Mail: [EMAIL PROTECTED]
> >>D-80686 Muenchenhttp://www.ff-muenchen.de
> >>
> >>-
> >>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]
>
> --
> F&F Computer AnwendungenTel: +49 89 51727-352
> und Unternehmensberatung GmbH   Fax: +49 89 51727-111
> Westendstr. 195 Mail: [EMAIL PROTECTED]
> D-80686 Muenchenhttp://www.ff-muenchen.de
>
> -
> 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: Validate values in collection?

2003-09-25 Thread Timo Neumann
Natalie D Rassmann wrote:

yes
how?

Timo Neumann wrote:


Hi all,

is it possible to use the validator framework to check values of beans
that are stored in a collection in a DynaValidatorForm?
TIA,

Timo
--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
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]


--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Validate values in collection?

2003-09-25 Thread Natalie D Rassmann
yes

Timo Neumann wrote:

> Hi all,
>
> is it possible to use the validator framework to check values of beans
> that are stored in a collection in a DynaValidatorForm?
>
> TIA,
>
> Timo
> --
> F&F Computer AnwendungenTel: +49 89 51727-352
> und Unternehmensberatung GmbH   Fax: +49 89 51727-111
> Westendstr. 195 Mail: [EMAIL PROTECTED]
> D-80686 Muenchenhttp://www.ff-muenchen.de
>
> -
> 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]

Validate values in collection?

2003-09-25 Thread Timo Neumann
Hi all,

is it possible to use the validator framework to check values of beans 
that are stored in a collection in a DynaValidatorForm?

TIA,

Timo
--
F&F Computer AnwendungenTel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195 Mail: [EMAIL PROTECTED]
D-80686 Muenchenhttp://www.ff-muenchen.de


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


RE: setting an ActionErrors object for a form outside a validate method...

2003-09-20 Thread alan
Thank you.  saveErrors() had eluded me.  



-Original Message-
From: Charles Canning [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 20, 2003 11:52 AM
To: 'Struts Users Mailing List'
Subject: RE: setting an ActionErrors object for a form outside a
validate method...

Hi Alan,

Here are the basics:

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
ActionErrors errors;
ActionError error;

//create the errors
errors = new ActionErrors();

... do your validation, and if error

//create the error
error = new ActionError("error.resource.key");
//add it to the errors (global or form field name based) this
uses global
   errors.add(ActionErrors.GLOBAL_ERROR, error);

   ...perform rest of method

   if (errors.isEmpty() == false) {
//save the error
saveErrors(request, errors);
//go back to same page
return mapping.getInputForward();
}
// Forward control to the specified success URI
return (mapping.findForward("success"));
}

Hope this helps.

Chuck

-Original Message-
From: alan [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 20, 2003 11:10 AM
To: [EMAIL PROTECTED]
Subject: setting an ActionErrors object for a form outside a validate
method...

My Action class does some processing that involves going to the
database.  This work could throw a SQLException and I want that to
generate an error message for the user.  However I don't want to do this
work in the validate method, only to have to do it again in the execute
method (besides SQLExceptions can be non-determinate so this wouldn't
solve the problem anyway).  
 
So, my question is how can I add an ActionErrors object to my form from
within the execute method so I can send the user back to their
requesting page with an intelligent and well formatted message?
 
Thanks,
 
alan



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



RE: setting an ActionErrors object for a form outside a validate method...

2003-09-20 Thread Charles Canning
Hi Alan,

Here are the basics:

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
ActionErrors errors;
ActionError error;

//create the errors
errors = new ActionErrors();

... do your validation, and if error

//create the error
error = new ActionError("error.resource.key");
//add it to the errors (global or form field name based) this
uses global
   errors.add(ActionErrors.GLOBAL_ERROR, error);

   ...perform rest of method

   if (errors.isEmpty() == false) {
//save the error
saveErrors(request, errors);
//go back to same page
return mapping.getInputForward();
}
// Forward control to the specified success URI
return (mapping.findForward("success"));
}

Hope this helps.

Chuck

-Original Message-
From: alan [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 20, 2003 11:10 AM
To: [EMAIL PROTECTED]
Subject: setting an ActionErrors object for a form outside a validate
method...

My Action class does some processing that involves going to the
database.  This work could throw a SQLException and I want that to
generate an error message for the user.  However I don't want to do this
work in the validate method, only to have to do it again in the execute
method (besides SQLExceptions can be non-determinate so this wouldn't
solve the problem anyway).  
 
So, my question is how can I add an ActionErrors object to my form from
within the execute method so I can send the user back to their
requesting page with an intelligent and well formatted message?
 
Thanks,
 
alan



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



setting an ActionErrors object for a form outside a validate method...

2003-09-20 Thread alan
My Action class does some processing that involves going to the
database.  This work could throw a SQLException and I want that to
generate an error message for the user.  However I don't want to do this
work in the validate method, only to have to do it again in the execute
method (besides SQLExceptions can be non-determinate so this wouldn't
solve the problem anyway).  
 
So, my question is how can I add an ActionErrors object to my form from
within the execute method so I can send the user back to their
requesting page with an intelligent and well formatted message?
 
Thanks,
 
alan



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



Re: ActionForm validate() - How to get ServletContext from HttpSessio n in J2EE 1.2

2003-09-15 Thread Craig R. McClanahan
On Mon, 15 Sep 2003, Chang, Henrique wrote:

> Date: Mon, 15 Sep 2003 11:32:38 -0400
> From: "Chang, Henrique" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: ActionForm validate() - How to get ServletContext from
> HttpSessio n in J2EE 1.2
>
> Hi,
>
>   I am using Weblogic 5.1 and if I'm not wrong it is implementing J2EE
> 1.2, in which the HttpSession interface does not specify the
> getServletContext() method.  I need to get to the application context via :
> request -> session -> application.
>
>   My issue is the following :
>
>   In my ActionForm validate() method I need to access an object saved
> to the Application context; however, I can only get access to the
> Application context by means of :
>
>
> request.getSession().getServletContext().getAttribute(myAttributeName);
>
>   Since the ActionForm validate method is inherited and the signature
> is fixed to public ActionErrors validate(ActionMapping mapping,
> javax.servlet.http.HttpServletRequest request), do I have any other
> solutions to this problem ?
>

ActionForm has a getServlet() method, so you can call

  getServlet().getServletContext().getAttribute(myAttributeName);

in a validate() method.

> Thanks,
> Henrique
>

Craig

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



ActionForm validate() - How to get ServletContext from HttpSessio n in J2EE 1.2

2003-09-15 Thread Chang, Henrique
Hi,

I am using Weblogic 5.1 and if I'm not wrong it is implementing J2EE
1.2, in which the HttpSession interface does not specify the
getServletContext() method.  I need to get to the application context via :
request -> session -> application.

My issue is the following : 

In my ActionForm validate() method I need to access an object saved
to the Application context; however, I can only get access to the
Application context by means of : 


request.getSession().getServletContext().getAttribute(myAttributeName);

Since the ActionForm validate method is inherited and the signature
is fixed to public ActionErrors validate(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request), do I have any other
solutions to this problem ?

Thanks,
Henrique


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



Validate and DispatchAction

2003-09-10 Thread Natalie D Rassmann
Hi -

I am trying to get the validator framework to work with dispatchAction.
When I turn validation on, it seems as though I don't go to the action
first.  (in my action I make several options lists which need to be
displayed as part of the form).  I must be doing something wrong but I
don't know what.  How do I make it go to the my action first to build
these lists so the form can be displayed

Thanks in advance,

Natalie Rassmann

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

RE: Avoid Validate After Submit

2003-09-05 Thread Kurt Post
Here's how I do it in Struts 1.1.  I'm not sure how 1.1 is different from
1.01 in the validation area so your mileage may very.

First I have a base class for all my ActionForm's called ExtendedActionBase.
Among other things, this class defines some standard button name for "next",
"back", "cancel", and "OK" verbs.  The class will only perform validation if
a "next" or "OK" button was used to submit the form.  There's also some
extra junk in the class that has to do with accepting either simple  buttons.

The only other thing you need to do is on "back" and "cancel" buttons make
sure they are  buttons.  This insures that the JavaScript
validator will not validate the form.

I'll include ExtendedActionBase.java below.

Hope this helps,

Kurt

 ---
/*
 * ExtendedActionForm.java
 *
 * Created on July 11, 2003, 10:39 AM
 */

package com.kaptec.dateweb.web.struts.actionforms;

import org.apache.struts.action.ActionErrors;

/** The purpose of this class is to provide a base class for ActionForms
that want
 * to prepopulate their values when they are created.  This class takes
advantage
 * of the fact that STruts calls Reset() when an ActionForm is created and
in
 * addition to calling Reset() before populating ActionForm properties from
 * submitted HTML form data.
 *
 * Descenden ts of this class need to implement two methods.  the
onInitialize()
 * method is called when the ActionForm is created and the onProcessForm()
method
 * is called before HTML form values are passed into ActionForm properties.
 * @author Kurt Post
 */
public class ExtendedActionForm extends
org.apache.struts.validator.ValidatorActionForm {

/** indicates if the ActionForm has been initialed yet */
private boolean isInitialized = false;

/** This attribute will be set to a non-null value if the user pressed
the "Submit" button on
 * the form.
 */
private String btnProcessForm;
/** This attribute will be set to a non-null value if the user pressed
the "Cancel" button on
 * the form.
 */
private String btnCancelForm;
/** This attribute will be set to a non-null value if the user pressed
the "Next" button on
 * the form.
 */
private String btnNext;
/** This attribute will be set to a non-null value if the user pressed
the "Back" button on
 * the form.
 */
private String btnBack;
/** The X and Y attributes of this object will be set if the user clicks
on a
 * "Submit" image button
 */
private ImageButtonCoordinates imgProcessForm = new
ImageButtonCoordinates();
/** The X and Y attributes of this object will be set if the user clicks
on a
 * "Submit" image button
 */
private ImageButtonCoordinates imgCancelForm = new
ImageButtonCoordinates();
/** The X and Y attributes of this object will be set if the user clicks
on a
 * "Next" image button
 */
private ImageButtonCoordinates imgNext = new ImageButtonCoordinates();
/** The X and Y attributes of this object will be set if the user clicks
on a
 * "Back" image button
 */
private ImageButtonCoordinates imgBack = new ImageButtonCoordinates();

/** Simply catch the Struts framework calles to reset() and forward it
to
 * onInitialize() or onProcessForm().
 * @param mapping Action mapping that caused our ActionForm to be
 * created or populated
 * @param request HTTP request which caused this ActionForm to be
 * created or populated.
 */
public void reset(org.apache.struts.action.ActionMapping mapping,
javax.servlet.http.HttpServletRequest request) {
super.reset(mapping, request);
if (isInitialized == false) {
onInitialize(mapping, request);
isInitialized = true;
} else {
onProcessForm(mapping, request);
}
}

/** Override this method to handle ActionForm initialization
 * WARNING: The method in this base class should be called by descendent
 *  classesthat override it since it handles resetting form
 *  submit/cancel related properties.
 * @param mapping Action mapping that caused our ActionForm to be
 * created
 * @param request HTTP request which caused this ActionForm to be
 * created
 */
public void onInitialize(org.apache.struts.action.ActionMapping mapping,
javax.servlet.http.HttpServletRequest request) {
}

/** Override this method to handle any processing needed before HTML
form data is
 * passed to the properties of this ActionForm
 * WARNING: The method in this base class should be called by descendent
 *  classesthat override it since it handles resetting form
 *  submit/cancel related properties.
 * @param mapping Action mapping that caused our ActionForm to

RE: Avoid Validate After Submit

2003-09-05 Thread Pady Srinivasan

I don't know if this works in 1.01 but I tried in 1.1.

You can use the HttpServletRequest passed into the validate method to find
out which button was pressed ( getParameter("Button2") ), and return an
empty ActionErrors.


Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Andre Michel [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 05, 2003 8:36 AM
To: [EMAIL PROTECTED]
Subject: Avoid Validate After Submit

Hello ...

I'd like to have two submit buttons on a page. Pressing no. 1 should run
through validation, pressing no. 2 should avoid this. How am I able to this
in a
good way?

I'm using Struts 1.01 thus validate method is in the form bean.

Any hints would be welcomed,

Andre Michel

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


-
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: Avoid Validate After Submit

2003-09-05 Thread Mark Galbreath
You can't unless you move the validation to the Action class.

Mark

-Original Message-
From: Andre Michel [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 8:36 AM
To: [EMAIL PROTECTED]
Subject: Avoid Validate After Submit


Hello ...

I'd like to have two submit buttons on a page. Pressing no. 1 should run
through validation, pressing no. 2 should avoid this. How am I able to this
in a
good way?

I'm using Struts 1.01 thus validate method is in the form bean.

Any hints would be welcomed,

Andre Michel

--
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


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



Avoid Validate After Submit

2003-09-05 Thread Andre Michel
Hello ...

I'd like to have two submit buttons on a page. Pressing no. 1 should run
through validation, pressing no. 2 should avoid this. How am I able to this in a
good way?

I'm using Struts 1.01 thus validate method is in the form bean.

Any hints would be welcomed,

Andre Michel

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


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



Re: ANYONE Know How To Validate Nested Form Beans?

2003-09-02 Thread Mark Lowe
Okay

Sorry i took a while i forgot about it.

So we've a nested user bean as a form property

//struts config

//in validator


..
//jsp

Cheers Mark

On Monday, September 1, 2003, at 05:55 PM, Terry Brick wrote:

Well it seems to be a mystery still whether it does or
does not.  Sounds like Mark has done it but he's
checking to see if it was custom or using built in
functionality.  I guess it was just an assumption on
my part that it DID have it built in because it seems
pretty fundamental/basic to me... compared to some of
the much more advanced capabilities it has built in.
Anyway, thanks for the code sample.  It looks like I
may end up using some of that.  I'll wait and see what
Mark digs up.
I think worst case scenario, I'll use some bean
instrospection upon submission to look for all
property values that are instances of ValidatorForm or
Collections... then recursively invoke the validator
on each one it finds, and add the errors collection to
each form bean (a property they all implement through
an interface).
I guess that wouldn't be bad... but I just thought it
was built in.
--- Richard Mixon <[EMAIL PROTECTED]> wrote:
Terry,

Thanks for asking the question - I've asked a
similar question in the past.
I did not realize that validator has some collection
support, I may look
further into that.


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
-
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: ANYONE Know How To Validate Nested Form Beans?

2003-09-01 Thread Terry Brick
Well it seems to be a mystery still whether it does or
does not.  Sounds like Mark has done it but he's
checking to see if it was custom or using built in
functionality.  I guess it was just an assumption on
my part that it DID have it built in because it seems
pretty fundamental/basic to me... compared to some of
the much more advanced capabilities it has built in. 
Anyway, thanks for the code sample.  It looks like I
may end up using some of that.  I'll wait and see what
Mark digs up.
I think worst case scenario, I'll use some bean
instrospection upon submission to look for all
property values that are instances of ValidatorForm or
Collections... then recursively invoke the validator
on each one it finds, and add the errors collection to
each form bean (a property they all implement through
an interface).
I guess that wouldn't be bad... but I just thought it
was built in.

--- Richard Mixon <[EMAIL PROTECTED]> wrote:
> Terry,
> 
> Thanks for asking the question - I've asked a
> similar question in the past.
> I did not realize that validator has some collection
> support, I may look
> further into that.


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: ANYONE Know How To Validate Nested Form Beans?

2003-09-01 Thread Mark Lowe
Thats strange I'll have to check how i was getting them working.

I'll have a look over where i've got it working (I don't think there 
were any hacks in there but its possible).

Cheers Mark

On Monday, September 1, 2003, at 04:28 PM, Terry Brick wrote:

Thank you much for your response.  Two things

1)  Sorry, I left out a big piece of detail.  I'm
interested in doing this validation only on the server
side (no javascript).  Yet I still can't get it to
work.  Are you saying that I'm doing it correctly as
show here?

Your html:messages code was helpful in getting the
errors for the top level bean, but there are still no
errors for the nested beans... but that's because it's
not validating them.  I know this because validation
will pass if the top level bean has the correct
properties... regardless of what's in the nested
beans.  The nested beans just aren't being checked for
validation.
2)  About the book. I completely agree.  Glad to
know it's not just me ;)
--- Mark Lowe <[EMAIL PROTECTED]> wrote:
Programming jakarta struts is a nice introduction to
webapp development
in general and struts development too. The only
problem is as soon as
you want to do anything vaguely useful there's no
detail. Its not a
criticism of the book as such just that its scope is
different to these
sorts of problems.
There's and indexedListProperty attribute in
validator for the purpose
of which you speak, and it works although not for
the javascript
generation.
  The array of form elements aren't generated in the
javascript, but the
js itself does handle indexed properties.. for
example if you hard code
myobj[0].myproperty in validator it works. So the
only piece of the
validator puzzle thats missing is generating the js
array of indexed
form elements .. If i'm not making any sense, have a
before and after
look at the javascript.
I think fixing the validator to generate indexed
elements would be the
fastest way of dealing with this, or add this to
bugzilla. A hack could
be to just layer some most js onto the page.
If you using the html:errors stuff and cant get it
to spit them out,
you could try bean:messages and spit out the errors
like that, they are
there (the errors) they're just hiding.







rather than




Cheers Mark


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
-
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: ANYONE Know How To Validate Nested Form Beans?

2003-09-01 Thread Richard Mixon
Terry,

Thanks for asking the question - I've asked a similar question in the past.
I did not realize that validator has some collection support, I may look
further into that.

I used a different approach by putting together a little "glue" code in my
main form bean's "validate" method. For example, I have a composite form
bean that has properties for a "base" form bean and two collections of
multiple "line item" form beans. Both the base and line item form beans have
their own validator validations. Below is an example. Note that I have to
lookup the ActionMapping for a "utility" action that uses the line item form
to update a single line item.

I would go with Mark's idea if it works for you - much less manual glue
code, but at least this reuses your validations.

 - Richard

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
// Let standard validation run first.
ActionErrors errors = null;
// errors = super.validate(mapping, request);
ActionError error = null;
ActionErrors currLineItemsErrors = null;
ActionErrors newLineItemsErrors = null;
if (errors == null) errors = new ActionErrors();

LineItemForm li = null;

ActionMapping liMapping =
(ActionMapping)mapping.getModuleConfig().findActionConfig("/config/LineItemA
ction");
// Check each new currLineItems formbean
if (newLineItems != null && newLineItems.size() > 0) {
if (log.isDebugEnabled()) log.debug("Validate - count of
newLineItems="+newLineItems.size());
for (int i = 0; i < newLineItems.size(); i++)  {
// Do not consider if some part of form is not filled in
    if (   newLineItems.get(i) == null ) {
if (log.isDebugEnabled()) log.debug("Validate -
newLineItem["+i+"] is null, skipping.");
continue;
}
li = (LineItemForm)newLineItems.get(i);
if (log.isDebugEnabled()) log.debug("Validate -
newLineItem["+i+"]='"+li+"'");
if ( li.isEmpty() ) {
if (log.isDebugEnabled()) log.debug("Validate -
newLineItem["+i+"] is empty, skipping.");
continue;
}
li.setServlet(getServlet());
newLineItemsErrors = li.validate(liMapping,request);
if (!newLineItemsErrors.isEmpty()) {
errors.add(ActionErrors.GLOBAL_ERROR,
  new ActionError("error.in.new.line.num",
Integer.toString(i+1)));
    errors.add(newLineItemsErrors);
}
}
}
if (currLineItems != null && currLineItems.size() > 0) {
if (log.isDebugEnabled()) log.debug("Validate - count of
currLineItems="+currLineItems.size());
for (int i = 0; i < currLineItems.size(); i++)  {
// Do not consider if some part of form is not filled in
if (   currLineItems.get(i) == null ) {
if (log.isDebugEnabled()) log.debug("Validate -
currLineItem["+i+"] is null, skipping.");
errors.add(ActionErrors.GLOBAL_ERROR,
  new ActionError("error.in.curr.line.num",
Integer.toString(i+1)));
errors.add(currLineItemsErrors);
continue;
}
    li = (LineItemForm)currLineItems.get(i);
if (log.isDebugEnabled()) log.debug("Validate -
currLineItem["+i+"]='"+li+"'");
if ( li.isEmpty() ) {
if (log.isDebugEnabled()) log.debug("Validate -
currLineItem["+i+"] is empty, skipping.");
errors.add(ActionErrors.GLOBAL_ERROR,
  new ActionError("error.in.curr.line.num",
Integer.toString(i+1)));
errors.add(currLineItemsErrors);
continue;
}
li.setServlet(getServlet());
currLineItemsErrors = li.validate(liMapping,request);
if (!currLineItemsErrors.isEmpty()) {
errors.add(ActionErrors.GLOBAL_ERROR,
  new ActionError("error.in.curr.line.num",
Integer.toString(i+1)));
errors.add(currLineItemsErrors);
}
}
}

return errors;
}



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



Re: ANYONE Know How To Validate Nested Form Beans?

2003-09-01 Thread Terry Brick
Thank you much for your response.  Two things

1)  Sorry, I left out a big piece of detail.  I'm
interested in doing this validation only on the server
side (no javascript).  Yet I still can't get it to
work.  Are you saying that I'm doing it correctly as
show here?



Your html:messages code was helpful in getting the
errors for the top level bean, but there are still no
errors for the nested beans... but that's because it's
not validating them.  I know this because validation
will pass if the top level bean has the correct
properties... regardless of what's in the nested
beans.  The nested beans just aren't being checked for
validation.

2)  About the book. I completely agree.  Glad to
know it's not just me ;)


--- Mark Lowe <[EMAIL PROTECTED]> wrote:
> Programming jakarta struts is a nice introduction to
> webapp development 
> in general and struts development too. The only
> problem is as soon as 
> you want to do anything vaguely useful there's no
> detail. Its not a 
> criticism of the book as such just that its scope is
> different to these 
> sorts of problems.
> 
> There's and indexedListProperty attribute in
> validator for the purpose 
> of which you speak, and it works although not for
> the javascript 
> generation.
> 
>   The array of form elements aren't generated in the
> javascript, but the 
> js itself does handle indexed properties.. for
> example if you hard code 
> myobj[0].myproperty in validator it works. So the
> only piece of the 
> validator puzzle thats missing is generating the js
> array of indexed 
> form elements .. If i'm not making any sense, have a
> before and after 
> look at the javascript.
> 
> I think fixing the validator to generate indexed
> elements would be the 
> fastest way of dealing with this, or add this to
> bugzilla. A hack could 
> be to just layer some most js onto the page.
> 
> If you using the html:errors stuff and cant get it
> to spit them out, 
> you could try bean:messages and spit out the errors
> like that, they are 
> there (the errors) they're just hiding.
> 
> 
> 
> 
>   
> 
> 
> 
> 
> rather than
> 
> 
> 
> 
> 
> Cheers Mark


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: displaying collections after a validate() error

2003-09-01 Thread Robert Taylor
Graham, I'm guessing you have an action which prepares this page
for display by populating the collection and placing it in the
request scope and forwarding to the JSP page where it is rendered
successfully the first time.

Upon, a validation error, you have configured in your struts-config
file the input to be the JSP page. 

When a validation error occurs, the page is displayed, but since the
collection was in the request scope, it has long been discarded and
thus is not displayed.

There are a couple work arounds for this problem:

1. Set the input attribute of the action which processes the form
   submit, to the action which prepares the page for display. When
   a validation error occurs the request will be forward to your
   'prepare' action which will populate the collection and forward
   to the JSP page where the collection will be rendered and the
   appropriate error messages will be displayed.

2. Populate your collection in the form.reset()


HTH,

robert

> -Original Message-
> From: Graham Stark [mailto:[EMAIL PROTECTED]
> Sent: Sunday, August 31, 2003 5:12 PM
> To: Struts Users Mailing List
> Subject: displaying collections after a validate() error
> 
> 
> Hi,
>could someone suggest what I'm doing wrong here?
> 
> I've got a form with an associated ActionForm, several members of which
> are collections. I display them like this:
> 
> 
> 
> 
> 
> 
> 
> []
> 
> Whilst single valued fields are displayed like:
> 
> 
> 
> All seems well, and everything displays fine. However, the ActionForm
> has a validate() method, which send the user back at the form, which
> displays some error messages. When this happens, however, the JSP
> doesn't display the collections from the ActionForm, only single valued
> fields. 
> 
> Can anyone suggest what I'm doing wrong here?
> 
> thanks,
> 
> Graham
> 
> 
> 
> -- 
> Graham Stark, Virtual Worlds
> phone: (+044) 01908 618239 mobile: 07952 633185
> Homepage http://www.virtual-worlds.biz
> Virtual Learning Arcade http://www.bized.ac.uk/virtual/vla
> Virtual Economy http://www.bized.ac.uk/virtual/economy 
> 
> 
> -
> 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: ANYONE Know How To Validate Nested Form Beans?

2003-09-01 Thread Mark Lowe
Programming jakarta struts is a nice introduction to webapp development 
in general and struts development too. The only problem is as soon as 
you want to do anything vaguely useful there's no detail. Its not a 
criticism of the book as such just that its scope is different to these 
sorts of problems.

There's and indexedListProperty attribute in validator for the purpose 
of which you speak, and it works although not for the javascript 
generation.

 The array of form elements aren't generated in the javascript, but the 
js itself does handle indexed properties.. for example if you hard code 
myobj[0].myproperty in validator it works. So the only piece of the 
validator puzzle thats missing is generating the js array of indexed 
form elements .. If i'm not making any sense, have a before and after 
look at the javascript.

I think fixing the validator to generate indexed elements would be the 
fastest way of dealing with this, or add this to bugzilla. A hack could 
be to just layer some most js onto the page.

If you using the html:errors stuff and cant get it to spit them out, 
you could try bean:messages and spit out the errors like that, they are 
there (the errors) they're just hiding.



   

   


rather than




Cheers Mark

Hello,
I'm using struts 1.1.  I thought this would be
relatively simple, but I can't figure it out.  I've
checked my book "Programming Jakarta Struts" and
searched the archives.  All got from the archives is a
bunch of people asking this same question, but NO
responses.  Please help if you've got the secret.
Basically I have a form bean which has some properties
that are collections (Vectors) of other form beans
(indexed properties of collections).  These nested
form beans also need to be validated.  The page
displays fine, and upon submission, all the data is
populated correctly in the form (nested props and
all).  However, the validator just totally ignores the
nested beans.
What do I need to do in my validations.xml to get it
to validate nested form beans?  I've tried the
following (totally made it up)...

.. and that "form_bean_name" is the name of another
form entry in my validation.xml.
Anybody know where I'm going wrong?  Thank you!

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
-
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]


ANYONE Know How To Validate Nested Form Beans?

2003-09-01 Thread Terry Brick
Hello,
I'm using struts 1.1.  I thought this would be
relatively simple, but I can't figure it out.  I've
checked my book "Programming Jakarta Struts" and
searched the archives.  All got from the archives is a
bunch of people asking this same question, but NO
responses.  Please help if you've got the secret.

Basically I have a form bean which has some properties
that are collections (Vectors) of other form beans
(indexed properties of collections).  These nested
form beans also need to be validated.  The page
displays fine, and upon submission, all the data is
populated correctly in the form (nested props and
all).  However, the validator just totally ignores the
nested beans.
What do I need to do in my validations.xml to get it
to validate nested form beans?  I've tried the
following (totally made it up)...



.. and that "form_bean_name" is the name of another
form entry in my validation.xml.

Anybody know where I'm going wrong?  Thank you!

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



displaying collections after a validate() error

2003-08-31 Thread Graham Stark
Hi,
   could someone suggest what I'm doing wrong here?

I've got a form with an associated ActionForm, several members of which
are collections. I display them like this:







[]

Whilst single valued fields are displayed like:



All seems well, and everything displays fine. However, the ActionForm
has a validate() method, which send the user back at the form, which
displays some error messages. When this happens, however, the JSP
doesn't display the collections from the ActionForm, only single valued
fields. 

Can anyone suggest what I'm doing wrong here?

thanks,

Graham



-- 
Graham Stark, Virtual Worlds
phone: (+044) 01908 618239 mobile: 07952 633185
Homepage http://www.virtual-worlds.biz
Virtual Learning Arcade http://www.bized.ac.uk/virtual/vla
Virtual Economy http://www.bized.ac.uk/virtual/economy 


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



javascript not working after validate

2003-08-28 Thread ryan
I have some javascript functions on my form that stop working when the 
validate method for the form returns ActionErrors.  Has anyone run into 
this problem before? This occurs in both IE and mozilla

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


How to get Messages Resources from the validate method?

2003-08-24 Thread [EMAIL PROTECTED]
In order to avoid using the deprecated getResources method from the 
ActionServlet, I would like to know how to get access to the module 
message resources bundles configured in the struts-config.xml from the 
ActionForm validate method.

Thanks.

Antonio Gonzalez




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



RE: Why would I want to use the ActionForm validate() method

2003-08-19 Thread David Graham
--- "Mainguy, Mike" <[EMAIL PROTECTED]> wrote:
> The short answer is, you cannot always depend on javascript.  There is a
> small percentage (Probably less than 1% I would expect) of users who
> either
> disable javascript or don't have it in their browser (e.g. lynx).  

Don't forget the hackers that don't use a browser at all.  It's trivial to
write a program that submits a web form and bypass all of the javascript. 
They can enter any data they like without proper server side validations.

David

> In
> these
> cases you will have no validation.  Also there are differences between
> how
> each browser handles the DOM and javascript in general.
> 
> -Original Message-
> From: Madhu Nair [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 19, 2003 2:33 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: Why would I want to use the ActionForm validate() method
> 
> 
> Hi,
> 
>  Why would I want to use the Struts ActionForm validate() method when I
> can
>  achieve the same functionality using Javascript? I assume that the user
> would never disable javascript.
> 
>  Regards ,
>  Madhu
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> This message and its contents (to include attachments) are the property
> of Kmart Corporation (Kmart) and may contain confidential and
> proprietary information. You are hereby notified that any disclosure,
> copying, or distribution of this message, or the taking of any action
> based on information contained herein is strictly prohibited.
> Unauthorized use of information contained herein may subject you to
> civil and criminal prosecution and penalties. If you are not the
> intended recipient, you should delete this message immediately.
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: Why would I want to use the ActionForm validate() method

2003-08-19 Thread Mainguy, Mike
The short answer is, you cannot always depend on javascript.  There is a
small percentage (Probably less than 1% I would expect) of users who either
disable javascript or don't have it in their browser (e.g. lynx).  In these
cases you will have no validation.  Also there are differences between how
each browser handles the DOM and javascript in general.

-Original Message-
From: Madhu Nair [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2003 2:33 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Why would I want to use the ActionForm validate() method


Hi,

 Why would I want to use the Struts ActionForm validate() method when I can
 achieve the same functionality using Javascript? I assume that the user
would never disable javascript.

 Regards ,
 Madhu


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


This message and its contents (to include attachments) are the property of Kmart 
Corporation (Kmart) and may contain confidential and proprietary information. You are 
hereby notified that any disclosure, copying, or distribution of this message, or the 
taking of any action based on information contained herein is strictly prohibited. 
Unauthorized use of information contained herein may subject you to civil and criminal 
prosecution and penalties. If you are not the intended recipient, you should delete 
this message immediately.



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



Re: Why would I want to use the ActionForm validate() method

2003-08-19 Thread Vipin Bhatia
because malicious code can be executed if u r using only java script for
validation by not using the browser to submit forms, many companies totally
do not use Java script because it only creates problems and solves few
things when you want your application to run on all platforms and all
platforms
- Original Message -
From: "Madhu Nair" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, August 19, 2003 12:03 PM
Subject: RE: Why would I want to use the ActionForm validate() method


>
> Hi,
>
>  Why would I want to use the Struts ActionForm validate() method when I
can
>  achieve the same functionality using Javascript? I assume that the user
> would never disable javascript.
>
>  Regards ,
>  Madhu
>
>
> -
> 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]



  1   2   3   4   5   >