Re: Problem with validator framework in LookupDispatchAction

2006-10-10 Thread Laurie Harper

Yariel Ramos Moreno wrote:

Hi all:

I have a LookupDispatchAction which can be submitted by two buttons (Update and 
Restore). I need to validate this form only when Update button is pressed. The 
form field to validate is required and most be integer. The required condition 
works fine, using the requiredIf validation with a hidden field to check the 
pressed button (ask for the pressed button and if the value is 1 (Update) then 
validate, else (value 2 for Restore) don't do anything). If the value in the 
field is not an integer, the validator framework triggers an exception no 
matter which button were pressed.

What can I do to make this validation using the validator framework?


What exception is triggered? What does the form bean look like? I'm 
guessing that you have a form property declared as 'integer' and the 
exception is occurring when you have non-integer input. In that case, 
try changing for form bean property to String.


If that's not it, post the relevant snippets of configuration, including 
your form bean declaration and implementation, your validation rules and 
relevant JSP code.


L.


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



Problem with validator framework in LookupDispatchAction

2006-10-09 Thread Yariel Ramos Moreno
Hi all:

I have a LookupDispatchAction which can be submitted by two buttons (Update and 
Restore). I need to validate this form only when Update button is pressed. The 
form field to validate is required and most be integer. The required condition 
works fine, using the requiredIf validation with a hidden field to check the 
pressed button (ask for the pressed button and if the value is 1 (Update) then 
validate, else (value 2 for Restore) don't do anything). If the value in the 
field is not an integer, the validator framework triggers an exception no 
matter which button were pressed.

What can I do to make this validation using the validator framework?

Thanks in advance.
__

XIII Convención Científica de Ingeniería y Arquitectura
28/noviembre al 1/diciembre de 2006
Cujae, Ciudad de la Habana, Cuba
http://www.cujae.edu.cu/eventos/convencion


Re: Problem with validator

2006-10-04 Thread Frank W. Zammetti
Not surprising, given where these config files came from :)  Actually, we
upgraded Struts a while back and I doubt anyone looked at the config
files, but I'll do that tomorrow, thanks for pointing it out :)

(And yes, I fixed the validator problem... had to change the parameter
list in validator-rules.xml to match the signatures of the FieldCheck
class' check methods).

Frank


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Wed, October 4, 2006 5:50 pm, Wendy Smoak wrote:
> On 10/4/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
>
>> Hello... trying to use Commons Validator 1.3.0 with Struts 1.2.9, seeing
>> the following error... anyone have any ideas?  Everything seems fine
>> until
>> the first check... config files follow trace.  Thanks!
>
> In the config files you posted, the DOCTYPEs don't match the versions
> you claim to be using.  Struts-config in particular looks odd, with
> 1.1 in the public identifier, but an old 1.0 jakarta url for the dtd.
> Both validation config files are using the 1.1.3 dtd.
>
> This is probably unrelated to the actual error, but is enough to make
> me stop looking. :)
>
> --
> Wendy
>
> -
> 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: Problem with validator

2006-10-04 Thread Wendy Smoak

On 10/4/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:


Hello... trying to use Commons Validator 1.3.0 with Struts 1.2.9, seeing
the following error... anyone have any ideas?  Everything seems fine until
the first check... config files follow trace.  Thanks!


In the config files you posted, the DOCTYPEs don't match the versions
you claim to be using.  Struts-config in particular looks odd, with
1.1 in the public identifier, but an old 1.0 jakarta url for the dtd.
Both validation config files are using the 1.1.3 dtd.

This is probably unrelated to the actual error, but is enough to make
me stop looking. :)

--
Wendy

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



Re: Problem with validator

2006-10-04 Thread Frank W. Zammetti
Hold up, think I found it... trying to pass Validator as well, doesn't
match the signature in FieldChecks...

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Wed, October 4, 2006 5:43 pm, Frank W. Zammetti wrote:
> Hello... trying to use Commons Validator 1.3.0 with Struts 1.2.9, seeing
> the following error... anyone have any ideas?  Everything seems fine until
> the first check... config files follow trace.  Thanks!
>
>
> 20061004-17:29:17,766 DEBUG [Servlet.Engine.Transports : 0]
> (ModuleUtils.java:167) Get module name for path
> /testView/testValidation.do
> 20061004-17:29:17,766 DEBUG [Servlet.Engine.Transports : 0]
> (ModuleUtils.java:191) Module name found: default
> 20061004-17:29:17,812 DEBUG [Servlet.Engine.Transports : 0]
> (RequestProcessor.java:172) Processing a 'POST' for path
> '/testView/testValidation'
> 20061004-17:29:17,812 DEBUG [Servlet.Engine.Transports : 0]
> (RequestUtils.java:200)  Looking for ActionForm bean instance in scope
> 'request' under attribute key 'valForm'
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (RequestUtils.java:294)  Creating new DynaActionForm instance of type
> 'org.apache.struts.validator.DynaValidatorForm'
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (RequestUtils.java:300)  -->
> DynaActionForm[dynaClass=valForm,firstName=,lastName=]
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (RequestProcessor.java:339)  Storing ActionForm bean instance in scope
> 'request' under attribute key 'valForm'
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (RequestProcessor.java:805)  Populating bean properties from this request
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (BeanUtilsBean.java:795)
> BeanUtils.populate(DynaActionForm[dynaClass=valForm,firstName=,lastName=],
> {firstName=[Ljava.lang.String;@7c51607,
> lastName=[Ljava.lang.String;@73fd607})
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (BeanUtilsBean.java:876)
> setProperty(DynaActionForm[dynaClass=valForm,firstName=,lastName=],
> firstName, [])
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (ConvertUtilsBean.java:418) Convert string '' to class 'java.lang.String'
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (ConvertUtilsBean.java:426)   Using converter
> [EMAIL PROTECTED]
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (BeanUtilsBean.java:876)
> setProperty(DynaActionForm[dynaClass=valForm,firstName=,lastName=],
> lastName, [])
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (ConvertUtilsBean.java:418) Convert string '' to class 'java.lang.String'
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (ConvertUtilsBean.java:426)   Using converter
> [EMAIL PROTECTED]
> 20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
> (RequestProcessor.java:948)  Validating input form properties
> 20061004-17:29:17,891 DEBUG [Servlet.Engine.Transports : 0]
> (ValidatorResources.java:453) Form 'valForm' found in formset 'default'
> for locale 'en_US_DO'
> 20061004-17:29:17,938 ERROR [Servlet.Engine.Transports : 0]
> (DynaValidatorForm.java:112) No such validation method:
> org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
> org.apache.commons.validator.ValidatorAction,
> org.apache.commons.validator.Field,
> org.apache.struts.action.ActionMessages,
> javax.servlet.http.HttpServletRequest)
> org.apache.commons.validator.ValidatorException: No such validation
> method:
> org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
> org.apache.commons.validator.ValidatorAction,
> org.apache.commons.validator.Field,
> org.apache.struts.action.ActionMessages,
> javax.servlet.http.HttpServletRequest)
>   at
> org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorAction.java:603)
>   at
> org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:533)
>   at org.apache.commons.validator.Field.validateForRule(Field.java:766)
>   at org.apache.commons.validator.Field.validate(Field.java:846)
>   at org.apache.commons.validator.Form.validate(Form.java:290)
>   at org.apache.commons.validator.Validator.validate(Validator.java:354)
>   at
> org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:110)
>   at
> org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:950)
>   at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
>   at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
>   at org.apache.struts.action.Actio

Problem with validator

2006-10-04 Thread Frank W. Zammetti
Hello... trying to use Commons Validator 1.3.0 with Struts 1.2.9, seeing
the following error... anyone have any ideas?  Everything seems fine until
the first check... config files follow trace.  Thanks!


20061004-17:29:17,766 DEBUG [Servlet.Engine.Transports : 0]
(ModuleUtils.java:167) Get module name for path
/testView/testValidation.do
20061004-17:29:17,766 DEBUG [Servlet.Engine.Transports : 0]
(ModuleUtils.java:191) Module name found: default
20061004-17:29:17,812 DEBUG [Servlet.Engine.Transports : 0]
(RequestProcessor.java:172) Processing a 'POST' for path
'/testView/testValidation'
20061004-17:29:17,812 DEBUG [Servlet.Engine.Transports : 0]
(RequestUtils.java:200)  Looking for ActionForm bean instance in scope
'request' under attribute key 'valForm'
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(RequestUtils.java:294)  Creating new DynaActionForm instance of type
'org.apache.struts.validator.DynaValidatorForm'
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(RequestUtils.java:300)  -->
DynaActionForm[dynaClass=valForm,firstName=,lastName=]
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(RequestProcessor.java:339)  Storing ActionForm bean instance in scope
'request' under attribute key 'valForm'
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(RequestProcessor.java:805)  Populating bean properties from this request
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(BeanUtilsBean.java:795)
BeanUtils.populate(DynaActionForm[dynaClass=valForm,firstName=,lastName=],
{firstName=[Ljava.lang.String;@7c51607,
lastName=[Ljava.lang.String;@73fd607})
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(BeanUtilsBean.java:876)  
setProperty(DynaActionForm[dynaClass=valForm,firstName=,lastName=],
firstName, [])
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(ConvertUtilsBean.java:418) Convert string '' to class 'java.lang.String'
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(ConvertUtilsBean.java:426)   Using converter
[EMAIL PROTECTED]
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(BeanUtilsBean.java:876)  
setProperty(DynaActionForm[dynaClass=valForm,firstName=,lastName=],
lastName, [])
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(ConvertUtilsBean.java:418) Convert string '' to class 'java.lang.String'
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(ConvertUtilsBean.java:426)   Using converter
[EMAIL PROTECTED]
20061004-17:29:17,828 DEBUG [Servlet.Engine.Transports : 0]
(RequestProcessor.java:948)  Validating input form properties
20061004-17:29:17,891 DEBUG [Servlet.Engine.Transports : 0]
(ValidatorResources.java:453) Form 'valForm' found in formset 'default'
for locale 'en_US_DO'
20061004-17:29:17,938 ERROR [Servlet.Engine.Transports : 0]
(DynaValidatorForm.java:112) No such validation method:
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest)
org.apache.commons.validator.ValidatorException: No such validation
method:
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest)
at
org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorAction.java:603)
at
org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:533)
at org.apache.commons.validator.Field.validateForRule(Field.java:766)
at org.apache.commons.validator.Field.validate(Field.java:846)
at org.apache.commons.validator.Form.validate(Form.java:290)
at org.apache.commons.validator.Validator.validate(Validator.java:354)
at
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:110)
at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:950)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInst

RE: Problem with Validator it does not reload request attributes

2006-07-20 Thread Yee, Richard K CTR DMDC
There isn't anything that prevents you from accessing a datasource in a
FormBean. I don't think you really need to do so however. You can set the
input attribute of your action to another action that does the necessary
setting up of your view beans instead of setting it to the JSP page itself.

-Richard


-Original Message-
From: Kim Brianne Go [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 20, 2006 12:15 AM
To: Struts Users Mailing List
Subject: Re: Problem with Validator it does not reload request attributes

Thanks for the suggestions.

I tried this and it works if the content of the list boxes are static.  But
in my case, the values that is being used by this widget is pulled out from
the database then forwarded to the jsp page using request.setAttribute.

Unfortunately, i dont think it will be possible in struts to access a
datasource using the FormBean.  Well this is my current problem, and would
really like to know if somebody would say otherwise and or have other
suggestions.  Or the least we could do is put those values in session, but I
agree that it would be a waste of resource.

Here's a sample...

This basically loads data to request scope to be used by a JSP page...

List zones = buildSelectionForm("zones", request); // this method does the
DB access...
request.setAttribute("zones", zones);


Then using the html:optionsCollection... we can use the data to prefill the
list box, for example this zones are information pulled from the database
and sent to request scope in an ArrayList for display.


 
  
  



This works well, unfortunately if validation occurs what happens is the data
on the request scope will be nullified and will not be available again for
the html:optionsCollection.  That's the reason I have to put that widget
inside a logc:present tag.

Brian

On 7/19/06, Adam Gordon <[EMAIL PROTECTED]> wrote:
>
> Kim-
>
> I had the same problem with some static form elements (e.g. contents of
> list boxes that were not part of any model data I cared to keep, yet it
> needed to be in the JSP page.)
>
> One solution I found was to set the properties on the session, but I
> decided that that was unnecessarily cluttering up the session and since
> only one form needed it was overkill.  Note the method signature of the
> validate(...) method in your ValidatorFormBean (or DynaForm...):
>
>   public ActionErrors validate(ActionMapping mapping, HttpServletRequest
> request) {
>
> // will not return null
> ActionErrors errors = super.validate(mapping, request);
>
> ...
> }
>
> It takes a HttpServletRequest object.  Thus, you can set any attributes
> or parameters you need to on the request after a failed (or even
> successful) validation.  What I do is if the validation fails (the
> ActionErrors instance will not be empty - use this as your flag) and I
> set the parameters to populate the static form content widgets in my JSP
> so when the JSP page is reloaded with the error messages displayed, it
> displays correctly.
>
> Doing this avoids two things:  I'm not storing non-bean data in my bean
> and the data is segregated from the rest of the web container because
> it's only available to the request.  Now, if your situation differs, you
> can set it on the session instead and all your JSP pages will have
> access to the content.
>
> Hope this helps.
>
> Cheers,
>
> -Adam
>
> Kim Brianne Go wrote:
> > Good Day,
> >
> > I was just wondering if anyone has a clue on how to retain request
> > values (
> > request.setAttribute()) forwarded to a jsp form page and once a form has
> > been submitted or validated then returns with error messages the values
> > from
> > request.setAttribute() is no longer accessible.
> >
> > Here's an example...
> >
> > A form has an OptionsCollections populated using the
> > request.setAttribute()...
> > from an action class.  I applied the Validator (Server-side) to perform
> > input validations, everything works well aside from the problem specific
> > to
> > the OptionCollections... since it requires the values sent to the jsp
> > page
> > prior to submission and validation.
> >
> > A temporary solution was to put the OptionsCollections inside the
> > bean:present tag to avoid disrupting the entire page's execution.  But
> > this
> > is not acceptable in practice since the input field that requires
> > OptionsCollections is necessary.
> >
> > Does anyone have an idea how to go about this aside from doing a
> > bean:present or putting the values in session?
> >
> > Thanks,
> >
> > Brian
> >
>
> -
> 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: Problem with Validator it does not reload request attributes

2006-07-20 Thread Kim Brianne Go

Thanks for the suggestions.

I tried this and it works if the content of the list boxes are static.  But
in my case, the values that is being used by this widget is pulled out from
the database then forwarded to the jsp page using request.setAttribute.

Unfortunately, i dont think it will be possible in struts to access a
datasource using the FormBean.  Well this is my current problem, and would
really like to know if somebody would say otherwise and or have other
suggestions.  Or the least we could do is put those values in session, but I
agree that it would be a waste of resource.

Here's a sample...

This basically loads data to request scope to be used by a JSP page...

List zones = buildSelectionForm("zones", request); // this method does the
DB access...
request.setAttribute("zones", zones);


Then using the html:optionsCollection... we can use the data to prefill the
list box, for example this zones are information pulled from the database
and sent to request scope in an ArrayList for display.



 
 



This works well, unfortunately if validation occurs what happens is the data
on the request scope will be nullified and will not be available again for
the html:optionsCollection.  That's the reason I have to put that widget
inside a logc:present tag.

Brian

On 7/19/06, Adam Gordon <[EMAIL PROTECTED]> wrote:


Kim-

I had the same problem with some static form elements (e.g. contents of
list boxes that were not part of any model data I cared to keep, yet it
needed to be in the JSP page.)

One solution I found was to set the properties on the session, but I
decided that that was unnecessarily cluttering up the session and since
only one form needed it was overkill.  Note the method signature of the
validate(...) method in your ValidatorFormBean (or DynaForm...):

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {

// will not return null
ActionErrors errors = super.validate(mapping, request);

...
}

It takes a HttpServletRequest object.  Thus, you can set any attributes
or parameters you need to on the request after a failed (or even
successful) validation.  What I do is if the validation fails (the
ActionErrors instance will not be empty - use this as your flag) and I
set the parameters to populate the static form content widgets in my JSP
so when the JSP page is reloaded with the error messages displayed, it
displays correctly.

Doing this avoids two things:  I'm not storing non-bean data in my bean
and the data is segregated from the rest of the web container because
it's only available to the request.  Now, if your situation differs, you
can set it on the session instead and all your JSP pages will have
access to the content.

Hope this helps.

Cheers,

-Adam

Kim Brianne Go wrote:
> Good Day,
>
> I was just wondering if anyone has a clue on how to retain request
> values (
> request.setAttribute()) forwarded to a jsp form page and once a form has
> been submitted or validated then returns with error messages the values
> from
> request.setAttribute() is no longer accessible.
>
> Here's an example...
>
> A form has an OptionsCollections populated using the
> request.setAttribute()...
> from an action class.  I applied the Validator (Server-side) to perform
> input validations, everything works well aside from the problem specific
> to
> the OptionCollections... since it requires the values sent to the jsp
> page
> prior to submission and validation.
>
> A temporary solution was to put the OptionsCollections inside the
> bean:present tag to avoid disrupting the entire page's execution.  But
> this
> is not acceptable in practice since the input field that requires
> OptionsCollections is necessary.
>
> Does anyone have an idea how to go about this aside from doing a
> bean:present or putting the values in session?
>
> Thanks,
>
> Brian
>

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




Re: Problem with Validator it does not reload request attributes

2006-07-19 Thread Adam Gordon

Kim-

I had the same problem with some static form elements (e.g. contents of 
list boxes that were not part of any model data I cared to keep, yet it 
needed to be in the JSP page.)


One solution I found was to set the properties on the session, but I 
decided that that was unnecessarily cluttering up the session and since 
only one form needed it was overkill.  Note the method signature of the 
validate(...) method in your ValidatorFormBean (or DynaForm...):


 public ActionErrors validate(ActionMapping mapping, HttpServletRequest 
request) {


   // will not return null
   ActionErrors errors = super.validate(mapping, request);

   ...
}

It takes a HttpServletRequest object.  Thus, you can set any attributes 
or parameters you need to on the request after a failed (or even 
successful) validation.  What I do is if the validation fails (the 
ActionErrors instance will not be empty - use this as your flag) and I 
set the parameters to populate the static form content widgets in my JSP 
so when the JSP page is reloaded with the error messages displayed, it 
displays correctly.


Doing this avoids two things:  I'm not storing non-bean data in my bean 
and the data is segregated from the rest of the web container because 
it's only available to the request.  Now, if your situation differs, you 
can set it on the session instead and all your JSP pages will have 
access to the content.


Hope this helps.

Cheers,

-Adam

Kim Brianne Go wrote:

Good Day,

I was just wondering if anyone has a clue on how to retain request
values (
request.setAttribute()) forwarded to a jsp form page and once a form has
been submitted or validated then returns with error messages the values
from
request.setAttribute() is no longer accessible.

Here's an example...

A form has an OptionsCollections populated using the
request.setAttribute()...
from an action class.  I applied the Validator (Server-side) to perform
input validations, everything works well aside from the problem specific
to
the OptionCollections... since it requires the values sent to the jsp
page
prior to submission and validation.

A temporary solution was to put the OptionsCollections inside the
bean:present tag to avoid disrupting the entire page's execution.  But
this
is not acceptable in practice since the input field that requires
OptionsCollections is necessary.

Does anyone have an idea how to go about this aside from doing a
bean:present or putting the values in session?

Thanks,

Brian



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



RE: Problem with Validator it does not reload request attributes

2006-07-19 Thread Krishna, Hari
Hey have a attribute called "firsttime" in form bean.
set it to "true" inside validate() in formbean.

Now in jsp 
check whether the value of the firsttime is true or not()
if its true set all the original values to the formbeam 
properties(
 mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 19, 2006 10:23 AM
To: Struts Users Mailing List
Subject: Problem with Validator it does not reload request attributes


Good Day,

I was just wondering if anyone has a clue on how to retain request values (
request.setAttribute()) forwarded to a jsp form page and once a form has
been submitted or validated then returns with error messages the values from
request.setAttribute() is no longer accessible.

Here's an example...

A form has an OptionsCollections populated using the request.setAttribute()...
from an action class.  I applied the Validator (Server-side) to perform
input validations, everything works well aside from the problem specific to
the OptionCollections... since it requires the values sent to the jsp page
prior to submission and validation.

A temporary solution was to put the OptionsCollections inside the
bean:present tag to avoid disrupting the entire page's execution.  But this
is not acceptable in practice since the input field that requires
OptionsCollections is necessary.

Does anyone have an idea how to go about this aside from doing a
bean:present or putting the values in session?

Thanks,

Brian
Notice:  All email and instant messages (including attachments) sent to
or from Franklin Templeton Investments (FTI) personnel may be retained,
monitored and/or reviewed by FTI and its agents, or authorized
law enforcement personnel, without further notice or consent.

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



Problem with Validator it does not reload request attributes

2006-07-18 Thread Kim Brianne Go

Good Day,

I was just wondering if anyone has a clue on how to retain request values (
request.setAttribute()) forwarded to a jsp form page and once a form has
been submitted or validated then returns with error messages the values from
request.setAttribute() is no longer accessible.

Here's an example...

A form has an OptionsCollections populated using the request.setAttribute()...
from an action class.  I applied the Validator (Server-side) to perform
input validations, everything works well aside from the problem specific to
the OptionCollections... since it requires the values sent to the jsp page
prior to submission and validation.

A temporary solution was to put the OptionsCollections inside the
bean:present tag to avoid disrupting the entire page's execution.  But this
is not acceptable in practice since the input field that requires
OptionsCollections is necessary.

Does anyone have an idea how to go about this aside from doing a
bean:present or putting the values in session?

Thanks,

Brian


Strange problem with validator

2005-06-30 Thread Manfred Wolff

Hi all.

I have a very, very strage problem. I use commons-validator to validate 
my struts pages. I use also velocity to render the pages. If I have a 
required field and it is empty it writes an error message and deletes 
the field. But it also deletes other fields in the form. Not all, but 
some. I have four fields:


name
vorname
email
homepage

If I fill in the form only "vorname", "email" and "homepage" the 
following things happens:


There ist an error message "name is a mandantory field" and "vorname" 
AND "homepage" will be deleted in the form. email not!!! Knows anyone 
the problem, that some field will be deleted an other fields not, if a 
validation fails??


Manfred

*Validator:*

   

 
 
   
 mask
 ^[a-zA-Z]*$
   
 

 
 
   
 mask
 ^[a-zA-Z]*$
   
 

 
 
 

 
 
 
   

*Velocity Template*



   
   
   
   #parse ("/velocity-functions/errors.vm")   
   

   
   


   
   
   
   header
   

   
   $text.get('person.name') *
value="$!form.bean.name" size="30" maxlength="50"/> 

   
   
   $text.get('person.vorname') *


   
  
   

   $text.get('person.email')
value="$!form.bean.email"  size="30" maxlength="50"/>

   
   
   $text.get('person.homepage') 


   

   
   
   
   
   
   


*app.properties*

person.name=Name
person.vorname=Vorname
person.email=E-Mail Adresse
person.homepage=Homepage

--
===
Dipl.-Inf. Manfred Wolff
Software Engineer
---
http://www.manfred-wolff.de
http://www.struts-it.org
---

Die fatale Neigung der Menschen,
vom Nachdenken über eine Sache nachzulassen,
wenn sie nicht länger zweifelhaft ist,
ist die Ursache der Hälfte ihrer Irrtümer.
- John Stuart Mil -
___


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