Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Eric Lentz
 So when this error condition is met and the user redirected back to the 
INPUT form; the
 field where they had entered xyz is now the original default
 initialized value.

Can't you check the action error and not refresh the model when there is 
an error?


RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread CRANFORD, CHRIS
Not that I am aware.  The paramsPrepareParamsStack to my knowledge
handles validation at the very end; so by the time validation has
happened; the model has already been prepared by the prepare() method.  

-Original Message-
From: Eric Lentz [mailto:eric.le...@sherwin.com] 
Sent: Thursday, May 19, 2011 11:58 AM
To: Struts Users Mailing List
Subject: Re: Struts2 Validation w/ModelDriven

 So when this error condition is met and the user redirected back to
the 
INPUT form; the
 field where they had entered xyz is now the original default
 initialized value.

Can't you check the action error and not refresh the model when there is

an error?


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Aaron Brown
Generally speaking, I don't advocate for client-side data validation
(javascript) since in most cases it's intended to be used instead of
server side validation, which is a Bad Thing.

In this case, however, perhaps some basic client-side validation would
be appropriate, just to prevent the user from submitting data that is
impossible to store in your model. Then you can let server validation
check the appropriateness of the data according to business rules,
etc.

 - Aaron

On Thu, May 19, 2011 at 1:16 PM, CRANFORD, CHRIS
chris.cranf...@setech.com wrote:
 Not that I am aware.  The paramsPrepareParamsStack to my knowledge
 handles validation at the very end; so by the time validation has
 happened; the model has already been prepared by the prepare() method.

 -Original Message-
 From: Eric Lentz [mailto:eric.le...@sherwin.com]
 Sent: Thursday, May 19, 2011 11:58 AM
 To: Struts Users Mailing List
 Subject: Re: Struts2 Validation w/ModelDriven

 So when this error condition is met and the user redirected back to
 the
 INPUT form; the
 field where they had entered xyz is now the original default
 initialized value.

 Can't you check the action error and not refresh the model when there is

 an error?


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





-- 
Aaron Brown : aa...@thebrownproject.com

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread Eric Lentz
 Not that I am aware.  The paramsPrepareParamsStack to my knowledge
 handles validation at the very end; so by the time validation has
 happened; the model has already been prepared by the prepare() method.

Right, I see you said that earlier, sorry.

So, why do you want to show what they entered, especially if it is so 
wrong? It seems satisfactory to represent the previously correct response. 
Still, if you need this, you could probably make use of ParameterAware and 
store that information somewhere where it can be accessed by your error 
display mechanism? I haven't used it before though, so just a thought. It 
might be applicable?

I'm curious. If you are using ModelDriven, then why do you load your model 
in prepare()? Why not in getModel? I don't think behavior will be any 
different though since that interceptor is on the same side of the stack 
as prepare.

- Eric



From:
CRANFORD, CHRIS chris.cranf...@setech.com
To:
Struts Users Mailing List user@struts.apache.org
Date:
05/19/2011 01:16 PM
Subject:
RE: Struts2 Validation w/ModelDriven



Not that I am aware.  The paramsPrepareParamsStack to my knowledge
handles validation at the very end; so by the time validation has
happened; the model has already been prepared by the prepare() method. 

-Original Message-
From: Eric Lentz [mailto:eric.le...@sherwin.com] 
Sent: Thursday, May 19, 2011 11:58 AM
To: Struts Users Mailing List
Subject: Re: Struts2 Validation w/ModelDriven

 So when this error condition is met and the user redirected back to
the 
INPUT form; the
 field where they had entered xyz is now the original default
 initialized value.

Can't you check the action error and not refresh the model when there is

an error?


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org





RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread CRANFORD, CHRIS
Eric -

The framework will call getModel() multiple times before your validate()
and execute() methods are invoked; and so by adding the create/lookup
logic to getModel(); you would then have to wrap that block of code
around a null check so that subsequent calls to getModel() would just
return the model reference and not worry about creating or looking up
the model object.  (see below)

public MyModelObject getModel() {
  if(model == null) {
if(id == null) 
  model = service.create(itemNumber,vendorNumber,quantity);
else
  model = service.lookupById(id);
  }
  return model;
}

To me this is a performance issue because a null check is being
performed for each getModel() invocation.  And since my model should
only be instantiated once; it's appropriate to put this in a method that
is invoked only once per action request; which is the prepare() method.

Personally I prefer to keep my design simple and clear and thus if any
retrieval of data is done inside my actions it is either in the
prepare() method or in the actual execute() or entry point method call
being invoked in the action.  Any get() methods are there simply to
return the instance of a property member that has been initialized in
either prepare() or the execute() or entry point method calls
themselves.

-Chris 

-Original Message-
From: Eric Lentz [mailto:eric.le...@sherwin.com] 
Sent: Thursday, May 19, 2011 1:22 PM
To: Struts Users Mailing List
Subject: RE: Struts2 Validation w/ModelDriven

I'm curious. If you are using ModelDriven, then why do you load your
model 
in prepare()? Why not in getModel? I don't think behavior will be any 
different though since that interceptor is on the same side of the stack

as prepare.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Dave Newton
On Thu, May 19, 2011 at 2:22 PM, Eric Lentz eric.le...@sherwin.com wrote:
 I'm curious. If you are using ModelDriven, then why do you load your model
 in prepare()? Why not in getModel?

That'd mean you'd need the did I already load the model? code in
getModel(), wouldn't it? Seems cleaner to use prepare, since that's
what it's for.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Dave Newton
On Thu, May 19, 2011 at 3:55 PM, CRANFORD, CHRIS wrote:
 The framework will call getModel() multiple times before your validate()
 and execute() methods are invoked; and so by adding the create/lookup
 logic to getModel(); you would then have to wrap that block of code
 around a null check so that subsequent calls to getModel() would just
 return the model reference and not worry about creating or looking up
 the model object.  (see below)

Oh, guess you said all that already.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread Chris Pratt
That should work fine until someonw switches you to the PrepareParamsPrepare
stack and prepere() gets called twice anyway. ;)
  (*Chris*)
On May 19, 2011 12:55 PM, CRANFORD, CHRIS chris.cranf...@setech.com
wrote:
 Eric -

 The framework will call getModel() multiple times before your validate()
 and execute() methods are invoked; and so by adding the create/lookup
 logic to getModel(); you would then have to wrap that block of code
 around a null check so that subsequent calls to getModel() would just
 return the model reference and not worry about creating or looking up
 the model object. (see below)

 public MyModelObject getModel() {
 if(model == null) {
 if(id == null)
 model = service.create(itemNumber,vendorNumber,quantity);
 else
 model = service.lookupById(id);
 }
 return model;
 }

 To me this is a performance issue because a null check is being
 performed for each getModel() invocation. And since my model should
 only be instantiated once; it's appropriate to put this in a method that
 is invoked only once per action request; which is the prepare() method.

 Personally I prefer to keep my design simple and clear and thus if any
 retrieval of data is done inside my actions it is either in the
 prepare() method or in the actual execute() or entry point method call
 being invoked in the action. Any get() methods are there simply to
 return the instance of a property member that has been initialized in
 either prepare() or the execute() or entry point method calls
 themselves.

 -Chris

 -Original Message-
 From: Eric Lentz [mailto:eric.le...@sherwin.com]
 Sent: Thursday, May 19, 2011 1:22 PM
 To: Struts Users Mailing List
 Subject: RE: Struts2 Validation w/ModelDriven

 I'm curious. If you are using ModelDriven, then why do you load your
 model
 in prepare()? Why not in getModel? I don't think behavior will be any
 different though since that interceptor is on the same side of the stack

 as prepare.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation on List of String data

2011-05-02 Thread Eric Lentz
 String[]  names;
// OR

ArrayList names;
}

i want to validate RequiredStringValidator  validator on these names. 

I don't think the standard validations deal with arrays. Probably your 
best bet is to override validate() and validate on your own. See:

http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/Validateable.html
http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html
http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html
 
(which implements those interfaces)



Re: Struts2 validation

2010-07-14 Thread kisja

Thanks for the answer.

I'm trying this, but it is not working properly

field name=telefonos
field-validator type=fieldexpression

![CDATA[#paciente.telefonoMobil = 0 || #paciente.telefonoFixo
= 0 ]]

messagi/message
/field-validator
/field

I have two numeric textfields any idea??



jake-65 wrote:
 
 You can use the fieldexpression validator. See
 http://struts.apache.org/2.1.8.1/docs/fieldexpression-validator.html for
 details.
 
 On Tue, Jul 13, 2010 at 05:39:52AM -0700, kisja wrote:
 
 I have two textfield and I would like to validate that at least one of
 both
 have data. 
 How I can do? 
 
 (I apologize for my bad English)
 
 Thanks
 -- 
 View this message in context:
 http://old.nabble.com/Struts2-validation-tp29149892p29149892.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Struts2-validation-tp29149892p29159311.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation

2010-07-13 Thread jake
You can use the fieldexpression validator. See 
http://struts.apache.org/2.1.8.1/docs/fieldexpression-validator.html for 
details.

On Tue, Jul 13, 2010 at 05:39:52AM -0700, kisja wrote:
 
 I have two textfield and I would like to validate that at least one of both
 have data. 
 How I can do? 
 
 (I apologize for my bad English)
 
 Thanks
 -- 
 View this message in context: 
 http://old.nabble.com/Struts2-validation-tp29149892p29149892.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation problem

2010-04-04 Thread zud



newton.dave wrote:
 
 zud wrote:
 1) Is old errors is not getting cleared that means when the filed value
 is
 empty  when i submit the form it shows required that is ok and agian when
 i
 submit with empty values again now it shows messages like
 filed is required
 filed is required
 
 Are you using Spring as your object factory? If so, make sure the 
 actions are declared as being prototype scope.
 
 Dave
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Struts2--validation-problem-tp28042625p28137164.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation problem

2010-04-04 Thread zud



zud wrote:
 
 
 
 newton.dave wrote:
 
 zud wrote:
 1) Is old errors is not getting cleared that means when the filed value
 is
 empty  when i submit the form it shows required that is ok and agian
 when i
 submit with empty values again now it shows messages like
 filed is required
 filed is required
 
 Are you using Spring as your object factory? If so, make sure the 
 actions are declared as being prototype scope.
 
 Dave
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Struts2--validation-problem-tp28042625p28137165.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation problem

2010-04-04 Thread zud



zud wrote:
 
 
 
 newton.dave wrote:
 
 zud wrote:
 1) Is old errors is not getting cleared that means when the filed value
 is
 empty  when i submit the form it shows required that is ok and agian
 when i
 submit with empty values again now it shows messages like
 filed is required
 filed is required
 
 Are you using Spring as your object factory? If so, make sure the 
 actions are declared as being prototype scope.
 
 Dave
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Struts2--validation-problem-tp28042625p28137167.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation problem

2010-04-04 Thread zud


newton.dave wrote:
 
 zud wrote:
 1) Is old errors is not getting cleared that means when the filed value
 is
 empty  when i submit the form it shows required that is ok and agian when
 i
 submit with empty values again now it shows messages like
 filed is required
 filed is required
 
 Are you using Spring as your object factory? If so, make sure the 
 actions are declared as being prototype scope.
 
 Dave
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 

thanks for the reply i am  not using springs   i am  using struts 2.x can
you please help me out


-- 
View this message in context: 
http://old.nabble.com/Struts2--validation-problem-tp28042625p28137191.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation problem

2010-04-03 Thread Dave Newton

zud wrote:

1) Is old errors is not getting cleared that means when the filed value is
empty  when i submit the form it shows required that is ok and agian when i
submit with empty values again now it shows messages like
filed is required
filed is required


Are you using Spring as your object factory? If so, make sure the 
actions are declared as being prototype scope.


Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation with Spring convention plugin

2010-01-26 Thread Brian Thompson
You might look into using the Preparable interface [1].  It's useful for
these types of situations; just add the code to generate the list into a
prepare() method on your action class instead of in execute().

Hope this helps,

-Brian

[1] -
http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html



On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna nani2ra...@gmail.com wrote:


 Hi,

 I am using struts2, spring with spring convention plugin.
 SO all my action classes has been specified in application-Context.xml.
 One of my action class got Bean as a property. So I can dealt with the bean
 properties in JSP.

 The problem, when I am working with my validation i am getting Error
 messages repeated problem.
 Solution for this one is change scope to prototype.

 Now I got another problem, I got a list box in jsp page. If validation
 fails
 I am getting the following error.
 could not be resolved as a collection/array/map/enumeration/iterator type

 This is happening because, list in Javabean becoming null when validation
 fails.

 Then i changed scope=request. And i have added cglib.jar.
 Now i am getting following error.

 org.springframework.beans.factory.BeanCreationException: Error creating
 bean
 with name 'scopedTarget.pmaction': Scope 'request' is not active for the
 current thread; consider defining a scoped proxy for this bean if you
 intend
 to refer to it from a singleton; nested exception is
 java.lang.IllegalStateException: No thread-bound request found: Are you
 referring to request attributes outside of an actual web request, or
 processing a request outside of the originally receiving thread? If you are
 actually operating within a web request and still receive this message,
 your
 code is probably running outside of DispatcherServlet/DispatcherPortlet: In
 this case, use RequestContextListener or RequestContextFilter to expose the
 current request.


 So if you have list box in jsp page and need to do validation on that jsp
 page. ANd you configured all your action classes in Spring appContext file.
 You wont succeed.

 Is that correct. Or is there any solution.

 Thanks and Regards
 RS
 --
 View this message in context:
 http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts2 Validation with Spring convention plugin

2010-01-26 Thread nani2ratna

Hi Brian,
I have seen that interface.
If I got more than one action method in one action class.
Then when ever you execute/call method(action) in that action class,
this prepare method will be called and this setting of list will be
executed.

But My main question why the list setting to null value.
Isn't it a big, can't we fix it.

And in my company i fought with everybody to bring struts2 into project.
And now i don't have any answer to this, untill any guys help me.

Thanks
RS



Brian Thompson-5 wrote:
 
 You might look into using the Preparable interface [1].  It's useful for
 these types of situations; just add the code to generate the list into a
 prepare() method on your action class instead of in execute().
 
 Hope this helps,
 
 -Brian
 
 [1] -
 http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html
 
 
 
 On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna nani2ra...@gmail.com wrote:
 

 Hi,

 I am using struts2, spring with spring convention plugin.
 SO all my action classes has been specified in application-Context.xml.
 One of my action class got Bean as a property. So I can dealt with the
 bean
 properties in JSP.

 The problem, when I am working with my validation i am getting Error
 messages repeated problem.
 Solution for this one is change scope to prototype.

 Now I got another problem, I got a list box in jsp page. If validation
 fails
 I am getting the following error.
 could not be resolved as a collection/array/map/enumeration/iterator type

 This is happening because, list in Javabean becoming null when validation
 fails.

 Then i changed scope=request. And i have added cglib.jar.
 Now i am getting following error.

 org.springframework.beans.factory.BeanCreationException: Error creating
 bean
 with name 'scopedTarget.pmaction': Scope 'request' is not active for the
 current thread; consider defining a scoped proxy for this bean if you
 intend
 to refer to it from a singleton; nested exception is
 java.lang.IllegalStateException: No thread-bound request found: Are you
 referring to request attributes outside of an actual web request, or
 processing a request outside of the originally receiving thread? If you
 are
 actually operating within a web request and still receive this message,
 your
 code is probably running outside of DispatcherServlet/DispatcherPortlet:
 In
 this case, use RequestContextListener or RequestContextFilter to expose
 the
 current request.


 So if you have list box in jsp page and need to do validation on that jsp
 page. ANd you configured all your action classes in Spring appContext
 file.
 You wont succeed.

 Is that correct. Or is there any solution.

 Thanks and Regards
 RS
 --
 View this message in context:
 http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


 
 

-- 
View this message in context: 
http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27325427.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation with Spring convention plugin

2010-01-26 Thread Brian Thompson
I'm guessing that you have something like

this.myList = populateList();

inside your execute() method.  When validation fails, it just sends you back
to the jsp without redoing execute(), so of course the list will be null.

-Brian



On Tue, Jan 26, 2010 at 10:26 AM, nani2ratna nani2ra...@gmail.com wrote:


 Hi Brian,
 I have seen that interface.
 If I got more than one action method in one action class.
 Then when ever you execute/call method(action) in that action class,
 this prepare method will be called and this setting of list will be
 executed.

 But My main question why the list setting to null value.
 Isn't it a big, can't we fix it.

 And in my company i fought with everybody to bring struts2 into project.
 And now i don't have any answer to this, untill any guys help me.

 Thanks
 RS



 Brian Thompson-5 wrote:
 
  You might look into using the Preparable interface [1].  It's useful for
  these types of situations; just add the code to generate the list into a
  prepare() method on your action class instead of in execute().
 
  Hope this helps,
 
  -Brian
 
  [1] -
 
 http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html
 
 
 
  On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna nani2ra...@gmail.com
 wrote:
 
 
  Hi,
 
  I am using struts2, spring with spring convention plugin.
  SO all my action classes has been specified in application-Context.xml.
  One of my action class got Bean as a property. So I can dealt with the
  bean
  properties in JSP.
 
  The problem, when I am working with my validation i am getting Error
  messages repeated problem.
  Solution for this one is change scope to prototype.
 
  Now I got another problem, I got a list box in jsp page. If validation
  fails
  I am getting the following error.
  could not be resolved as a collection/array/map/enumeration/iterator
 type
 
  This is happening because, list in Javabean becoming null when
 validation
  fails.
 
  Then i changed scope=request. And i have added cglib.jar.
  Now i am getting following error.
 
  org.springframework.beans.factory.BeanCreationException: Error creating
  bean
  with name 'scopedTarget.pmaction': Scope 'request' is not active for the
  current thread; consider defining a scoped proxy for this bean if you
  intend
  to refer to it from a singleton; nested exception is
  java.lang.IllegalStateException: No thread-bound request found: Are you
  referring to request attributes outside of an actual web request, or
  processing a request outside of the originally receiving thread? If you
  are
  actually operating within a web request and still receive this message,
  your
  code is probably running outside of DispatcherServlet/DispatcherPortlet:
  In
  this case, use RequestContextListener or RequestContextFilter to expose
  the
  current request.
 
 
  So if you have list box in jsp page and need to do validation on that
 jsp
  page. ANd you configured all your action classes in Spring appContext
  file.
  You wont succeed.
 
  Is that correct. Or is there any solution.
 
  Thanks and Regards
  RS
  --
  View this message in context:
 
 http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 

 --
 View this message in context:
 http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27325427.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts2 Validation with Spring convention plugin

2010-01-26 Thread nani2ratna

Flow in my project works like this.
When user request one web page, action method searchPm will execute.
This calls populatePm method in service call.
Then it will call some dao methods.
I have JavaBean as a property in action class. This java bean get populated
in service(dao) and return from the service class to action class.
The same JavaBean got the List property which is populated in service class.

The above is my flow.

But I have another doubt. I think I didn't understand struts properly.
If validation fails, does it calls the action method or just execute method.
I think it shouldn't call any of those, because while editing the form
assume you have changed some form values.
And submit the form but validation fails and you will see the same form with
error messages and changed values as well not the old values.

Is that right.
Correct me if i am wrong.

Thanks and Regards
rs.



Brian Thompson-5 wrote:
 
 I'm guessing that you have something like
 
 this.myList = populateList();
 
 inside your execute() method.  When validation fails, it just sends you
 back
 to the jsp without redoing execute(), so of course the list will be null.
 
 -Brian
 
 
 
 On Tue, Jan 26, 2010 at 10:26 AM, nani2ratna nani2ra...@gmail.com wrote:
 

 Hi Brian,
 I have seen that interface.
 If I got more than one action method in one action class.
 Then when ever you execute/call method(action) in that action class,
 this prepare method will be called and this setting of list will be
 executed.

 But My main question why the list setting to null value.
 Isn't it a big, can't we fix it.

 And in my company i fought with everybody to bring struts2 into project.
 And now i don't have any answer to this, untill any guys help me.

 Thanks
 RS



 Brian Thompson-5 wrote:
 
  You might look into using the Preparable interface [1].  It's useful
 for
  these types of situations; just add the code to generate the list into
 a
  prepare() method on your action class instead of in execute().
 
  Hope this helps,
 
  -Brian
 
  [1] -
 
 http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html
 
 
 
  On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna nani2ra...@gmail.com
 wrote:
 
 
  Hi,
 
  I am using struts2, spring with spring convention plugin.
  SO all my action classes has been specified in
 application-Context.xml.
  One of my action class got Bean as a property. So I can dealt with the
  bean
  properties in JSP.
 
  The problem, when I am working with my validation i am getting Error
  messages repeated problem.
  Solution for this one is change scope to prototype.
 
  Now I got another problem, I got a list box in jsp page. If validation
  fails
  I am getting the following error.
  could not be resolved as a collection/array/map/enumeration/iterator
 type
 
  This is happening because, list in Javabean becoming null when
 validation
  fails.
 
  Then i changed scope=request. And i have added cglib.jar.
  Now i am getting following error.
 
  org.springframework.beans.factory.BeanCreationException: Error
 creating
  bean
  with name 'scopedTarget.pmaction': Scope 'request' is not active for
 the
  current thread; consider defining a scoped proxy for this bean if you
  intend
  to refer to it from a singleton; nested exception is
  java.lang.IllegalStateException: No thread-bound request found: Are
 you
  referring to request attributes outside of an actual web request, or
  processing a request outside of the originally receiving thread? If
 you
  are
  actually operating within a web request and still receive this
 message,
  your
  code is probably running outside of
 DispatcherServlet/DispatcherPortlet:
  In
  this case, use RequestContextListener or RequestContextFilter to
 expose
  the
  current request.
 
 
  So if you have list box in jsp page and need to do validation on that
 jsp
  page. ANd you configured all your action classes in Spring appContext
  file.
  You wont succeed.
 
  Is that correct. Or is there any solution.
 
  Thanks and Regards
  RS
  --
  View this message in context:
 
 http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 

 --
 View this message in context:
 http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27325427.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


 
 

-- 
View this message in context: 
http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27326206.html
Sent from the Struts - User 

Re: Struts2 Validation with Spring convention plugin

2010-01-26 Thread nani2ratna

Hi,

I assume, since it doesn't call any action class if validation fails,
stack got only values from jsp which are already populated into bean
properties when we submit before valdiation.
Since bean is not in session, it should not have any values.
But we have already submitted the form so thats why we have got
non-list(text field) values.

ABove works if scope = prototype.
If scope=singleton, it works different.
It doesnt make list null. But the error messages will be in stack. if you
submit the form again and validation fails, it will show the error messages
repeatedly.

Hope this helps.

Thanks and regards
RS




nani2ratna wrote:
 
 Flow in my project works like this.
 When user request one web page, action method searchPm will execute.
 This calls populatePm method in service call.
 Then it will call some dao methods.
 I have JavaBean as a property in action class. This java bean get
 populated in service(dao) and return from the service class to action
 class.
 The same JavaBean got the List property which is populated in service
 class.
 
 The above is my flow.
 
 But I have another doubt. I think I didn't understand struts properly.
 If validation fails, does it calls the action method or just execute
 method.
 I think it shouldn't call any of those, because while editing the form
 assume you have changed some form values.
 And submit the form but validation fails and you will see the same form
 with error messages and changed values as well not the old values.
 
 Is that right.
 Correct me if i am wrong.
 
 Thanks and Regards
 rs.
 
 
 
 Brian Thompson-5 wrote:
 
 I'm guessing that you have something like
 
 this.myList = populateList();
 
 inside your execute() method.  When validation fails, it just sends you
 back
 to the jsp without redoing execute(), so of course the list will be null.
 
 -Brian
 
 
 
 On Tue, Jan 26, 2010 at 10:26 AM, nani2ratna nani2ra...@gmail.com
 wrote:
 

 Hi Brian,
 I have seen that interface.
 If I got more than one action method in one action class.
 Then when ever you execute/call method(action) in that action class,
 this prepare method will be called and this setting of list will be
 executed.

 But My main question why the list setting to null value.
 Isn't it a big, can't we fix it.

 And in my company i fought with everybody to bring struts2 into project.
 And now i don't have any answer to this, untill any guys help me.

 Thanks
 RS



 Brian Thompson-5 wrote:
 
  You might look into using the Preparable interface [1].  It's useful
 for
  these types of situations; just add the code to generate the list into
 a
  prepare() method on your action class instead of in execute().
 
  Hope this helps,
 
  -Brian
 
  [1] -
 
 http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html
 
 
 
  On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna nani2ra...@gmail.com
 wrote:
 
 
  Hi,
 
  I am using struts2, spring with spring convention plugin.
  SO all my action classes has been specified in
 application-Context.xml.
  One of my action class got Bean as a property. So I can dealt with
 the
  bean
  properties in JSP.
 
  The problem, when I am working with my validation i am getting Error
  messages repeated problem.
  Solution for this one is change scope to prototype.
 
  Now I got another problem, I got a list box in jsp page. If
 validation
  fails
  I am getting the following error.
  could not be resolved as a collection/array/map/enumeration/iterator
 type
 
  This is happening because, list in Javabean becoming null when
 validation
  fails.
 
  Then i changed scope=request. And i have added cglib.jar.
  Now i am getting following error.
 
  org.springframework.beans.factory.BeanCreationException: Error
 creating
  bean
  with name 'scopedTarget.pmaction': Scope 'request' is not active for
 the
  current thread; consider defining a scoped proxy for this bean if you
  intend
  to refer to it from a singleton; nested exception is
  java.lang.IllegalStateException: No thread-bound request found: Are
 you
  referring to request attributes outside of an actual web request, or
  processing a request outside of the originally receiving thread? If
 you
  are
  actually operating within a web request and still receive this
 message,
  your
  code is probably running outside of
 DispatcherServlet/DispatcherPortlet:
  In
  this case, use RequestContextListener or RequestContextFilter to
 expose
  the
  current request.
 
 
  So if you have list box in jsp page and need to do validation on that
 jsp
  page. ANd you configured all your action classes in Spring appContext
  file.
  You wont succeed.
 
  Is that correct. Or is there any solution.
 
  Thanks and Regards
  RS
  --
  View this message in context:
 
 http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To 

Re: struts2 validation for only one method in action

2009-11-30 Thread axing

you can use @SkipValidation
-- 
View this message in context: 
http://old.nabble.com/struts2-validation-for-only-one-method-in-action-tp9082687p26572573.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation Problem - validation errors not being cleared when corrected!

2009-10-23 Thread Murray Furtado
Hehe, I've just resolved my own issue!
The problem was my spring configuration. I needed to
specify scope=prototype on each of my Struts 2 Action declarations.
Singleton actions were being created and thus previous field errors were
being carried over between requests.

I'm surprised this isn't a more common gotcha that should be highlighted in
the documentation.

Rgds

Murray

2009/10/23 Murray Furtado murrayfurt...@googlemail.com

 Hi,
 I'm using Struts 2.0.14 and validation annotations.  I have a
 UpdateUserAction class which implements ModelDriven and declares the
 execute() method with the following :

 @Validations( visitorFields = { @VisitorFieldValidator(message=,
 fieldName=model)} )

 My model is a User class which has a number of @RequiredStringValidators,
 etc.

 When I test the functionality I login to my app as a user with all it's
 fields populated (ie a valid user). I then update a dropdown box in the
 Update User jsp to the 'Select' value, to invalidate this property (declared
 with a @RequiredStringValidator).  Sure enough, when I submit the form, I
 get a field error telling me this is a required field. So far so good.

 However when I then correct that field and resubmit, I still get the error!
  I've added debug code to the prepare() method of the UpdateUserAction and
 it shows that the previous field error is still present when I submit the
 corrected form.  This is strange because my understanding is that field
 errors should get cleared between requests, and the validation framework
 shouldn't fire until after the prepare() method has fired. So why am I
 seeing validation errors in the prepare method? And why aren't they
 clearing?

 What's even more frustrating is that I've downloaded the source code for
 the xworks 2.0.7 package, and attached as source in Eclipse Galileo, but
 then I can't set breakpoints in any of the xwork codebase to step through,
 as each time I try and open an xwork java file, it takes me to the .class
 file instead.

 Can anyone shed light on my problems as I can't see what I'm doing wrong?

 Thanks in advance,

 Murray





Re: Struts2 - validation

2009-06-24 Thread Greg Lindholm
This question gets asked about once a week on this list ;)

http://struts.apache.org/2.1.6/docs/how-do-we-repopulate-controls-when-validation-fails.html

On Wed, Jun 24, 2009 at 9:07 AM, Kishan G. Chellap Paandy 
kishanchellapaand...@spanservices.com wrote:

 Hi Folks,

 I'm populating a list in my action class, which will be used in the JSP for
 populating a s:select/ tag.

 Now, I'm submitting the form, where I'm doing validation (server side
 validation) thru validation.xml. And this throws some action/field errors
 and the same JSP page is rendered again with the errors. But, the list to
 populate s:select/ tag is empty/lost. How I can retain it?

 Storing in session is not an option for me. And if redirect/redirectAction
 the action/field errors are lost.

 Please advice.

 Thank you.
 Regards,
 Kishan.G

 Team Leader.
 www.spansystems.com



 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts2 Validation not working with theme simple

2009-04-19 Thread Dave Newton

Bhaarat Sharma wrote:

However, If i have the following line in my struts.properties then the
validation stops happening and I do not see any errors.
struts.ui.theme=simple


Technically, the validation does not stop happening.


Has someone seen something like this before?


Yes, anybody using the simple theme.


what is the best way to resolve this??


Stop using the simple theme.

The simple theme tags don't display error messages--they're simple. 
You'll either need to switch themes, show field error messages by hand 
(if you want the messages near the fields), or modify/extend/create a 
theme to emit the HTML you want.


Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation not working with theme simple

2009-04-19 Thread Bhaarat Sharma
Stop using the simple theme.

The simple theme tags don't display error messages--they're simple.
You'll either need to switch themes, show field error messages by hand
(if you want the messages near the fields), or modify/extend/create a
theme to emit the HTML you want.

At this time I cant afford to change the theme of the site.  Because
that breaks the html on a lot of pages and would require a lot of
effort to correct those pages.

show field error messages by hand (if you want the messages near the fields),

how can i do this? do you mean, by using field validators like on this
link? http://struts.apache.org/2.x/docs/using-field-validators.htmls

Appreciate your help


On 4/19/09, Dave Newton newton.d...@yahoo.com wrote:
 Bhaarat Sharma wrote:
 However, If i have the following line in my struts.properties then the
 validation stops happening and I do not see any errors.
 struts.ui.theme=simple

 Technically, the validation does not stop happening.

 Has someone seen something like this before?

 Yes, anybody using the simple theme.

 what is the best way to resolve this??

 Stop using the simple theme.

 The simple theme tags don't display error messages--they're simple.
 You'll either need to switch themes, show field error messages by hand
 (if you want the messages near the fields), or modify/extend/create a
 theme to emit the HTML you want.

 Dave


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation not working with theme simple

2009-04-19 Thread Bhaarat Sharma
by the way. I can do without having errors right beside the textfield.
 I can have them grouped up top

On 4/19/09, Bhaarat Sharma bhaara...@gmail.com wrote:
 Stop using the simple theme.

 The simple theme tags don't display error messages--they're simple.
 You'll either need to switch themes, show field error messages by hand
 (if you want the messages near the fields), or modify/extend/create a
 theme to emit the HTML you want.

 At this time I cant afford to change the theme of the site.  Because
 that breaks the html on a lot of pages and would require a lot of
 effort to correct those pages.

show field error messages by hand (if you want the messages near the
 fields),

 how can i do this? do you mean, by using field validators like on this
 link? http://struts.apache.org/2.x/docs/using-field-validators.htmls

 Appreciate your help


 On 4/19/09, Dave Newton newton.d...@yahoo.com wrote:
 Bhaarat Sharma wrote:
 However, If i have the following line in my struts.properties then the
 validation stops happening and I do not see any errors.
 struts.ui.theme=simple

 Technically, the validation does not stop happening.

 Has someone seen something like this before?

 Yes, anybody using the simple theme.

 what is the best way to resolve this??

 Stop using the simple theme.

 The simple theme tags don't display error messages--they're simple.
 You'll either need to switch themes, show field error messages by hand
 (if you want the messages near the fields), or modify/extend/create a
 theme to emit the HTML you want.

 Dave


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation not working with theme simple

2009-04-19 Thread Dave Newton

Bhaarat Sharma wrote:

At this time I cant afford to change the theme of the site.  Because
that breaks the html on a lot of pages and would require a lot of
effort to correct those pages.


Changing to show field error messages by hand would most likely entail 
significantly more work.



show field error messages by hand (if you want the messages near the fields),


how can i do this? do you mean, by using field validators like on this
link? http://struts.apache.org/2.x/docs/using-field-validators.htmls


How are you doing validation now?

In any case, I meant showing field error messages by hand by checking 
the field errors map for specific field names, in the HTML/JSP, instead 
of having it done by the theme.


Seriously--consider modifying the simple theme (creating your own theme 
based on the simple theme) and adding the error message bits of one of 
the themes that includes them. Otherwise you'll be adding either a chunk 
of JSP to check for field errors, using a custom tag to encapsulate it 
somehow, or something fairly similar.


How is it that the project got so far along that changing the theme is 
too much work and nobody noticed that validation messages weren't being 
displayed?


Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation not working with theme simple

2009-04-19 Thread Dave Newton

Bhaarat Sharma wrote:

by the way. I can do without having errors right beside the textfield.
 I can have them grouped up top


Are you saying the s:fielderror/ tag doesn't render field errors in 
the simple theme? The template file sure makes it look like it does.


Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation not working with theme simple

2009-04-19 Thread Bhaarat Sharma
thanks dave!

s:fielderror/ worked fine.  I was trying too many things so got confused.

I have one further question regarding validation.  Is it possible to
validate a text field only when certain strings are selected from the
multiple drop down box.

Basically I want to make the text feild required only when some
strings are selected from the multiple drop down box, which is in the
same form as the text field.  Can this be done via struts2 validation
or do I have to write a custom validator for this?

Thanks!

On 4/19/09, Dave Newton newton.d...@yahoo.com wrote:
 Bhaarat Sharma wrote:
 by the way. I can do without having errors right beside the textfield.
  I can have them grouped up top

 Are you saying the s:fielderror/ tag doesn't render field errors in
 the simple theme? The template file sure makes it look like it does.

 Dave


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 Validation not working with theme simple

2009-04-19 Thread Dave Newton

Bhaarat Sharma wrote:

thanks dave!

s:fielderror/ worked fine.  I was trying too many things so got confused.

I have one further question regarding validation.  Is it possible to
validate a text field only when certain strings are selected from the
multiple drop down box.

Basically I want to make the text feild required only when some
strings are selected from the multiple drop down box, which is in the
same form as the text field.  Can this be done via struts2 validation
or do I have to write a custom validator for this?


I'd expect it could be handled with an expression validator; whether or 
not this is the cleanest solution is arguable. Once validation gets more 
complicated than a single expression or two doing it in Java may end up 
being easier to understand and maintain. There's no reason declarative 
and programmatic validation can't be combined.


Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 validation

2009-02-18 Thread Lukasz Lenart
2009/2/17 PEGASUS84 pegasu...@hotmail.it:
 Does someone knows how to hide the error message which cames from the action
 with name=input?
 i don't want to view this message Invalid field value...

I thing you're talking about conversion errors, if so remove
Conversion Error Interceptor [1] from your stack

[1] http://struts.apache.org/2.1.6/docs/conversion-error-interceptor.html


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 validation

2009-02-18 Thread PEGASUS84


thanks for your answer i've removed the conversion error interceptor but the
same message apper in my jsp page;
if i see the html code i see td with the message invalide field value...
is there a way for remove this td?
 
-- 
View this message in context: 
http://www.nabble.com/struts2-validation-tp22068251p22082549.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 validation

2009-02-18 Thread Lukasz Lenart
Use theme simple [1] and add what tags you want

[1] http://struts.apache.org/2.1.2/docs/themes-and-templates.html


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 validation

2009-02-18 Thread PEGASUS84

thanks,
but in this way i'cant se the labels of the form;
Can i override theme simple and remove only errorMessage?
-- 
View this message in context: 
http://www.nabble.com/struts2-validation-tp22068251p22087958.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 validation

2009-02-18 Thread Lukasz Lenart
2009/2/18 PEGASUS84 pegasu...@hotmail.it:
 but in this way i'cant se the labels of the form;

You can use s:label tag [1]

 Can i override theme simple and remove only errorMessage?

Yes you can, take a look on [2] and [3]


[1] http://struts.apache.org/2.1.6/docs/label.html
[2] http://struts.apache.org/2.1.6/docs/extending-themes.html
[3] http://www.vitarara.org/cms/struts_2_cookbook/creating_a_theme


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 validation

2009-02-18 Thread PEGASUS84

sorry but i can't.
this is my code jsp:
s:form action=/action/Login.action method=GET cssClass=form
  s:textfield label=Username name=username
cssClass=basic/s:textfield
 s:password  label=Password  name=password
cssClass=basic/s:password
  s:select  label=Login as name=tipo cssClass=selezione headerKey=1
headerValue=seleziona
list=#{'01':'studente','02':'docente','03':'segretario'}/s:select
   s:submit value=Login align=center cssClass=botton/
   /s:form


and this is the image
http://www.nabble.com/file/p22089792/Image.jpg 
i don't want the message;
please help me
-- 
View this message in context: 
http://www.nabble.com/struts2-validation-tp22068251p22089792.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 validation failed method

2008-11-03 Thread hernan gonzalez
The quick answer: in the default configuration, when the validation
fails the result INPUT (input) is returned. You frequently define a
mapping for this action and result in your struts.xml which renders
the original jsp (the input) so that the user can see the errors
(eg: s:actionerrors /) and reenter the data.

Hernán J. González
http://hjg.com.ar/



On Mon, Nov 3, 2008 at 7:59 AM, Harden ZHU [EMAIL PROTECTED] wrote:
 Hi,

 I have Basic Validation. If validation failed, which method struts2 is
 calling? Can I define some method like in struts1 input?

 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]



Re: struts2 validation failed method

2008-11-03 Thread Nils-Helge Garli Hegvik
Hi!

If you look at the relationship between the ValidationInterceptor [1]
and the WorkflowInterceptor [2], you should be able to figure it out.

[1] - http://struts.apache.org/2.0.12/docs/validation-interceptor.html
[2] - http://struts.apache.org/2.0.12/docs/workflow-interceptor.html

Nils-H

On Mon, Nov 3, 2008 at 10:59 AM, Harden ZHU [EMAIL PROTECTED] wrote:
 Hi,

 I have Basic Validation. If validation failed, which method struts2 is
 calling? Can I define some method like in struts1 input?

 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]



Re: Struts2 validation with portlet

2008-10-21 Thread bakann

Did you find an example ?
I think it is not working.


devsahu wrote:
 
 Hi,
 
 Does stuts2 support its validation feature with portlet.
 Any help is highly appreciated.
 
 Thanks,
 Sabyasachi
 

-- 
View this message in context: 
http://www.nabble.com/Struts2-validation-with-portlet-tp11445797p20093267.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 validation with portlet

2008-10-21 Thread Torsten Krah
Am Dienstag, 21. Oktober 2008 17:46:41 schrieb bakann:
 Did you find an example ?
 I think it is not working.

It is working.
I am using 2.0.11.2 with portlets. I am using some field validators and 
configured validators.xml and my *.xml for the actions and validation 
triggers fine.

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect.
-- Linus Torvalds


smime.p7s
Description: S/MIME cryptographic signature


Re: Struts2 validation with portlet

2008-10-21 Thread Nils-Helge Garli Hegvik
The source for the example portlet app is here:
http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_0_11_2/apps/portlet/

On Tue, Oct 21, 2008 at 5:46 PM, bakann [EMAIL PROTECTED] wrote:

 Did you find an example ?
 I think it is not working.


 devsahu wrote:

 Hi,

 Does stuts2 support its validation feature with portlet.
 Any help is highly appreciated.

 Thanks,
 Sabyasachi


 --
 View this message in context: 
 http://www.nabble.com/Struts2-validation-with-portlet-tp11445797p20093267.html
 Sent from the Struts - User mailing list archive at Nabble.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: struts2 validation, tiles definition in input result type, problem!

2008-07-25 Thread Halil Ağın
Hello Dave;

Yes you are right, There is no ProjectStatus action defined.
Now, i change the form action definition to

s:form action=ProjectStatus_showAddPage
..

and it is ok.  validation works, but there is still a problem,

When i request the
http://localhost:8080/TVQ/ProjectStatus_showAddPage.action  (showAddPage
function is defined in ProjectStatus action class)

it shows the AddPage.jsp (which is expected), but it shows all the
validation messages at first page load which is not expected.

The correct scenario is that it should show the validation messages after i
press the add button.


Here is my jsp content and struts.xml content, respectively (I do not
include tiles definition, they works, morover, they are not needed to
analyze this problem, i think :) )

There is also a validation file named ProjectStatus-validation,xml in the
directory where ProjectStatusAction.java resides in.

===start:AddPage.jsp=
s:form action=ProjectStatus_showAddPage  validate=true  

s:fielderror  /

jsp:include page=AddUpdateTemplate.jsp/
br/

table
trtd colspan=2s:submit   method=add  value=Add //td/tr
/table

/s:form

===end :AddPage  =



===start:struts.xml=
 action name=ProjectStatus_*

class=tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction
method={1}  

result name={1} type=tiles tvq.projectstatus.{1}/result
result name=input  type=tiles
tvq.projectstatus.{1}/result
result name=ADDSUCCEED
type=redirect/ProjectStatus_list.action/result

/action
===end :struts.xml =






Regards,


-Halil AGIN


On Thu, Jul 24, 2008 at 6:22 PM, Dave Newton [EMAIL PROTECTED] wrote:

 Your action is submitting to ProjectStatus; is that action defined?

 Dave


 --- On Thu, 7/24/08, Halil Ağın [EMAIL PROTECTED] wrote:

  From: Halil Ağın [EMAIL PROTECTED]
  Subject: struts2 validation, tiles definition in input result type,
 problem!
  To: user@struts.apache.org
  Date: Thursday, July 24, 2008, 10:58 AM
  Hello List;
 
  I am trying to implement validation in struts2.
 
  My action is as follow:
 
  action name=ProjectStatus_*
 
  class=tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction
  method={1}  
 
  result name={1}
  type=tiles
  tvq.projectstatus.{1}/result
  result name=input
  type=tiles
  tvq.projectstatus.{1}/result
  result name=error
  type=tilestvq.projectstatus.{1}/result
 
  result name=ADDSUCCEED
  type=redirect/ProjectStatus_list.action/result
  /action
 
 
 
  Since when validation process returns false, i want struts
  to show the same
  page. I search the web, and saw some solution like above.
  But, when i try to
  implement, i could not succeed.
 
  Here are my tiles definitions:
 
  definition
  name=tvq.projectstatus.showAddPage
  extends=tvq.template.default
  put-attribute name=title
  value=Add A Project Status /
  put-attribute name=content
  value=/jsp/projectstatus/AddPage.jsp
  /
  /definition
 
  definition
  name=tvq.projectstatus.ListPage
  extends=tvq.template.default
  put-attribute name=title
  value=Add A Project Status /
  put-attribute name=content
  value=/jsp/projectstatus/ListPage.jsp /
  /definition
 
  definition name=tvq.projectstatus.list
  extends=tvq.template.default
  put-attribute name=title
  value=Add A Project Status /
  put-attribute name=content
  value=/jsp/projectstatus/ListPage.jsp /
  /definition
 
 
 
  I call the page ass follows :
  http://localhost:8080/TVQ/ProjectStatus_showAddPage.action
 
  (the ProjectStatusAction.java has showAddPage, list, and
  add functions and
  these functions returns the correct strings.)
 
 
  Then, struts looks the action definition and it finds
  showAddPage function
  in ProjectStatus.
 
  In result list, there is tvq.projectstatus.showAddPage, and
  i have this
  definition in my tiles.xml.
 
  Therefore, it shows the page. The problem occures after i
  press the add
  button in tvq.projectstatus.showAddPage.
 
  here is the content of the
  tvq.projectstatus.showAddPage(meanly,/jsp/projectstatus/AddPage.jsp)
 
 
 
 
  s:form action=ProjectStatus
  validate=true  
 
  s:fielderror  /
 
  jsp:include page=AddUpdateTemplate.jsp/
  br/
 
  table
  trtd colspan=2s:submit
  method=add  value=Add
  //td/tr
  /table
 
  /s:form
 
 
 
 
  And i have a required field validator on a field in my
  form(this field is
  listed in AddUpdateTemplate.jsp)
 
 
  ProjectStatus action has add function which returns the
  ADDSUCCEED string
  on success.
 
 
  When i press the add button without filling the required
  field, there occure
  a validation error(which is expected)
 
  At this level, i expect struts that it enters the input
  result which is
  defined in my action as a result.
 
  Here is the result definition.
 
  result 

Re: struts2 validation, tiles definition in input result type, problem!

2008-07-25 Thread Halil Ağın
Sorry i amde a typo in the previous mail,

ProjectStatus-validation,xml should be replaced with
ProjectStatusAction-validation,xml

2008/7/25 Halil Ağın [EMAIL PROTECTED]:

 Hello Dave;

 Yes you are right, There is no ProjectStatus action defined.
 Now, i change the form action definition to

 s:form action=ProjectStatus_showAddPage
 ..

 and it is ok.  validation works, but there is still a problem,

 When i request the
 http://localhost:8080/TVQ/ProjectStatus_showAddPage.action  (showAddPage
 function is defined in ProjectStatus action class)

 it shows the AddPage.jsp (which is expected), but it shows all the
 validation messages at first page load which is not expected.

 The correct scenario is that it should show the validation messages after i
 press the add button.


 Here is my jsp content and struts.xml content, respectively (I do not
 include tiles definition, they works, morover, they are not needed to
 analyze this problem, i think :) )

 There is also a validation file named ProjectStatus-validation,xml in the
 directory where ProjectStatusAction.java resides in.

 ===start:AddPage.jsp=
 s:form action=ProjectStatus_showAddPage  validate=true  

 s:fielderror  /

 jsp:include page=AddUpdateTemplate.jsp/
 br/

 table
 trtd colspan=2s:submit   method=add  value=Add //td/tr
 /table

 /s:form

 ===end :AddPage  =



 ===start:struts.xml=
  action name=ProjectStatus_*

 class=tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction
 method={1}  

 result name={1} type=tiles tvq.projectstatus.{1}/result
 result name=input  type=tiles
 tvq.projectstatus.{1}/result
 result name=ADDSUCCEED
 type=redirect/ProjectStatus_list.action/result

 /action
 ===end :struts.xml =






 Regards,


 -Halil AGIN



 On Thu, Jul 24, 2008 at 6:22 PM, Dave Newton [EMAIL PROTECTED]
 wrote:

 Your action is submitting to ProjectStatus; is that action defined?

 Dave


 --- On Thu, 7/24/08, Halil Ağın [EMAIL PROTECTED] wrote:

  From: Halil Ağın [EMAIL PROTECTED]
  Subject: struts2 validation, tiles definition in input result type,
 problem!
  To: user@struts.apache.org
  Date: Thursday, July 24, 2008, 10:58 AM
  Hello List;
 
  I am trying to implement validation in struts2.
 
  My action is as follow:
 
  action name=ProjectStatus_*
 
 
 class=tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction
  method={1}  
 
  result name={1}
  type=tiles
  tvq.projectstatus.{1}/result
  result name=input
  type=tiles
  tvq.projectstatus.{1}/result
  result name=error
  type=tilestvq.projectstatus.{1}/result
 
  result name=ADDSUCCEED
  type=redirect/ProjectStatus_list.action/result
  /action
 
 
 
  Since when validation process returns false, i want struts
  to show the same
  page. I search the web, and saw some solution like above.
  But, when i try to
  implement, i could not succeed.
 
  Here are my tiles definitions:
 
  definition
  name=tvq.projectstatus.showAddPage
  extends=tvq.template.default
  put-attribute name=title
  value=Add A Project Status /
  put-attribute name=content
  value=/jsp/projectstatus/AddPage.jsp
  /
  /definition
 
  definition
  name=tvq.projectstatus.ListPage
  extends=tvq.template.default
  put-attribute name=title
  value=Add A Project Status /
  put-attribute name=content
  value=/jsp/projectstatus/ListPage.jsp /
  /definition
 
  definition name=tvq.projectstatus.list
  extends=tvq.template.default
  put-attribute name=title
  value=Add A Project Status /
  put-attribute name=content
  value=/jsp/projectstatus/ListPage.jsp /
  /definition
 
 
 
  I call the page ass follows :
  http://localhost:8080/TVQ/ProjectStatus_showAddPage.action
 
  (the ProjectStatusAction.java has showAddPage, list, and
  add functions and
  these functions returns the correct strings.)
 
 
  Then, struts looks the action definition and it finds
  showAddPage function
  in ProjectStatus.
 
  In result list, there is tvq.projectstatus.showAddPage, and
  i have this
  definition in my tiles.xml.
 
  Therefore, it shows the page. The problem occures after i
  press the add
  button in tvq.projectstatus.showAddPage.
 
  here is the content of the
  tvq.projectstatus.showAddPage(meanly,/jsp/projectstatus/AddPage.jsp)
 
 
 
 
  s:form action=ProjectStatus
  validate=true  
 
  s:fielderror  /
 
  jsp:include page=AddUpdateTemplate.jsp/
  br/
 
  table
  trtd colspan=2s:submit
  method=add  value=Add
  //td/tr
  /table
 
  /s:form
 
 
 
 
  And i have a required field validator on a field in my
  form(this field is
  listed in AddUpdateTemplate.jsp)
 
 
  ProjectStatus action has add function which returns the
  ADDSUCCEED string
  on success.
 
 
  When i press the add button without filling the required
  field, 

Re: struts2 validation, tiles definition in input result type, problem!

2008-07-25 Thread Lukasz Lenart
Do you use xml based validation? If so, name the xml files correctly
according to the name of actions, read [1], section Defining
Validation Rules

ProjectStatusAction-ProjectStatus_updateAddPage-validation.xml


[1] http://struts.apache.org/2.1.2/docs/validation.html

Regards
-- 
Lukasz
http://www.lenart.org.pl/

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



Re: struts2 validation, tiles definition in input result type, problem!

2008-07-24 Thread Antonio Petrelli
2008/7/24 Halil Ağın [EMAIL PROTECTED]:
 Hello List;
 org.apache.tiles.definition.NoSuchDefinitionException: tvq.projectstatus. at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:394)
 at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
 at
 org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
 at
 org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)

Mmm... It could be a bug.
What version of Struts and Tiles are you using, exactly?
What container are you using?

Ciao
Antonio


Re: struts2 validation, tiles definition in input result type, problem!

2008-07-24 Thread Halil Ağın
tomcat : apache-tomcat-6.0.16.tar.gz


WEB-INF/lib content:

tiles-api-2.0.5.jar
tiles-core-2.0.5.jar
tiles-defs.xml
tiles-jsp-2.0.5.jar
struts2-config-browser-plugin-2.1.2.jar
struts2-core-2.1.2.jar
struts2-tiles-plugin-2.1.2.jar


-Halil AGIN


2008/7/24 Antonio Petrelli [EMAIL PROTECTED]:

 2008/7/24 Halil Ağın [EMAIL PROTECTED]:
  Hello List;
  org.apache.tiles.definition.NoSuchDefinitionException: tvq.projectstatus.
 at
 
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:394)
  at
 
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
  at
 
 org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
  at
 
 org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)

 Mmm... It could be a bug.
 What version of Struts and Tiles are you using, exactly?
 What container are you using?

 Ciao
 Antonio



Re: struts2 validation, tiles definition in input result type, problem!

2008-07-24 Thread Antonio Petrelli
2008/7/24 Halil Ağın [EMAIL PROTECTED]:
 tomcat : apache-tomcat-6.0.16.tar.gz


 WEB-INF/lib content:

 tiles-api-2.0.5.jar
 tiles-core-2.0.5.jar
 tiles-defs.xml
 tiles-jsp-2.0.5.jar
 struts2-config-browser-plugin-2.1.2.jar
 struts2-core-2.1.2.jar
 struts2-tiles-plugin-2.1.2.jar

It seems that you are pretty up-to-date :-) (except Tiles, where the
latest version is 2.0.6, but this is not important in this case).
Can you open a JIRA issue, along with a test case (read: WAR file with sources)?
https://issues.apache.org/struts/browse/WW

Thanks
Antonio


Re: struts2 validation, tiles definition in input result type, problem!

2008-07-24 Thread Dave Newton
Your action is submitting to ProjectStatus; is that action defined?

Dave


--- On Thu, 7/24/08, Halil Ağın [EMAIL PROTECTED] wrote:

 From: Halil Ağın [EMAIL PROTECTED]
 Subject: struts2 validation, tiles definition in input result type, problem!
 To: user@struts.apache.org
 Date: Thursday, July 24, 2008, 10:58 AM
 Hello List;
 
 I am trying to implement validation in struts2.
 
 My action is as follow:
 
 action name=ProjectStatus_*
 
 class=tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction
 method={1}  
 
 result name={1}
 type=tiles
 tvq.projectstatus.{1}/result
 result name=input 
 type=tiles
 tvq.projectstatus.{1}/result
 result name=error
 type=tilestvq.projectstatus.{1}/result
 
 result name=ADDSUCCEED
 type=redirect/ProjectStatus_list.action/result
 /action
 
 
 
 Since when validation process returns false, i want struts
 to show the same
 page. I search the web, and saw some solution like above.
 But, when i try to
 implement, i could not succeed.
 
 Here are my tiles definitions:
 
 definition
 name=tvq.projectstatus.showAddPage
 extends=tvq.template.default
 put-attribute name=title
 value=Add A Project Status /
 put-attribute name=content
 value=/jsp/projectstatus/AddPage.jsp
 /
 /definition
 
 definition
 name=tvq.projectstatus.ListPage
 extends=tvq.template.default
 put-attribute name=title
 value=Add A Project Status /
 put-attribute name=content
 value=/jsp/projectstatus/ListPage.jsp /
 /definition
 
 definition name=tvq.projectstatus.list
 extends=tvq.template.default
 put-attribute name=title
 value=Add A Project Status /
 put-attribute name=content
 value=/jsp/projectstatus/ListPage.jsp /
 /definition
 
 
 
 I call the page ass follows :
 http://localhost:8080/TVQ/ProjectStatus_showAddPage.action
 
 (the ProjectStatusAction.java has showAddPage, list, and
 add functions and
 these functions returns the correct strings.)
 
 
 Then, struts looks the action definition and it finds
 showAddPage function
 in ProjectStatus.
 
 In result list, there is tvq.projectstatus.showAddPage, and
 i have this
 definition in my tiles.xml.
 
 Therefore, it shows the page. The problem occures after i
 press the add
 button in tvq.projectstatus.showAddPage.
 
 here is the content of the
 tvq.projectstatus.showAddPage(meanly,/jsp/projectstatus/AddPage.jsp)
 
 
 
 
 s:form action=ProjectStatus 
 validate=true  
 
 s:fielderror  /
 
 jsp:include page=AddUpdateTemplate.jsp/
 br/
 
 table
 trtd colspan=2s:submit  
 method=add  value=Add
 //td/tr
 /table
 
 /s:form
 
 
 
 
 And i have a required field validator on a field in my
 form(this field is
 listed in AddUpdateTemplate.jsp)
 
 
 ProjectStatus action has add function which returns the
 ADDSUCCEED string
 on success.
 
 
 When i press the add button without filling the required
 field, there occure
 a validation error(which is expected)
 
 At this level, i expect struts that it enters the input
 result which is
 defined in my action as a result.
 
 Here is the result definition.
 
 result name=input  type=tiles
 tvq.projectstatus.{1}/result
 
 
 I expect the struts to enter in input result, and it does.
 but it cannot
 produces the tiles definition, it leaves {1} as empty and
 produce
 tvq.projectstatus. unlike
 tvq.projectstatus.showAddPage.
 
 What is the problem, i know i  am doing something wrong, i
 read the book
 struts2 in action, and searched the web, but
 could not find such an
 example. Meanly, i am using method action, tiles and
 validation together, i
 could not find such an example.
 
 
 Please help me,
 
 
 Thanks in advance,
 
 
 -Halil Agin
 
 
 the stack trace is below (i am using global exception
 handler, therefore i
 copied the html content and paste it here, you may want the
 output of error
 console, but please be sure that this is the exact error. i
 see this error
 in the console too)
 
 
 Error Message
 
 tvq.projectstatus.
 --
 Technical Details
 
 org.apache.tiles.definition.NoSuchDefinitionException:
 tvq.projectstatus. at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:394)
 at
 org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
 at
 org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
 at
 org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
 at
 com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:355)
 at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
 at
 com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:248)
 at
 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
 at
 

Re: struts2 validation

2008-07-16 Thread Pierrot52

Hi Nicole,

This is an action class that does validation of two parameters:

public class SignonAction extends ActionSupport {
private String username;
private String password;

@Override
public String execute() throws Exception {
Map session = null;
boolean authenticated = false;
try {
authenticated = Utils.authenticate(username,password);
} catch(Exception e) {
// Swallow the exception
}
if (authenticated) {
session = ActionContext.getContext().getSession();
User user = new User();
user.setLogin(username);
user.setEmail(set your email);
session.put(loggedIn, user);
return SUCCESS;
} else {
return ERROR;
}
}

@RequiredStringValidator(message=, key = username.required)
@StringLengthFieldValidator(message = , key =
username.invalidLength, minLength = 6 , maxLength = 15)
@RegexFieldValidator(message = , key = prompt.invalidCharacters,
expression = ^[a-zA-Z0-9]+$)
public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

@RequiredStringValidator(message=, key=password.required)
@StringLengthFieldValidator(message = , key =
password.invalidLength, minLength = 6 , maxLength = 15)
@RegexFieldValidator(message = , key = prompt.invalidCharacters,
expression = ^[a-zA-Z0-9]+$)
public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

}

It uses annotation to validate.

Hope this will help.

Regards.

Pierre


Nicole Luneburg wrote:
 
 Hi all!
 
 Been looking all over the net but my validation simply isn't working :(
 
 
 
 I have a JSP page with a dropdown box in a form.
 
 I just want to make sure the value in the dropdown box is not empty.
 
 It currently looks like this:
 
 
 
 s:form action=3Dmyaction method=3Dpost validate=3Dtrue
 
 s:actionerror /
 
 s:fielderror /
 
 
 
 s:select name=3DfieldName
 
 id=3DfieldName
 
 theme=3Dsimple
 
 size=3D1
 
 list=3DfieldList
 
 headerKey=3D
 
 headerValue=3D- - Please Select - -/
 
 s:submit name=3DSubmit/
 
 /s:form
 
 
 
 My setup is that I have an Action class, which uses a Form to set and get
 f= ield values from the JSP page.
 
 In Struts1 I was using the validate(...) method in the Form class.
 
 It seems none of the Struts2 validation examples on the net are working
 for=  me.
 
 Or I'm not doing it right.
 
 
 
 Anyone any ideas how I can do this simply?
 
 
 
 Cheers!
 
 nic
 
 
 
 The contents of this email are confidential and may be subject to legal or
 professional privilege and copyright. No representation is made that this
 email is free of viruses or other defects. If you have received this
 communication in error, you may not copy or distribute any part of it or
 otherwise disclose its contents to anyone. Please advise the sender of
 your incorrect receipt of this correspondence.
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2-validation-tp18438182p18485869.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: struts2 validation

2008-07-16 Thread Nicole Luneburg
Hi Pierre,

Thanks for your code.
Yes I did get it working with annotation, phew!

Nicole

-Original Message-
From: Pierrot52 [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 16 July 2008 9:48 PM
To: user@struts.apache.org
Subject: Re: struts2 validation


Hi Nicole,

This is an action class that does validation of two parameters:

public class SignonAction extends ActionSupport {
private String username;
private String password;

@Override
public String execute() throws Exception {
Map session = null;
boolean authenticated = false;
try {
authenticated = Utils.authenticate(username,password);
} catch(Exception e) {
// Swallow the exception
}
if (authenticated) {
session = ActionContext.getContext().getSession();
User user = new User();
user.setLogin(username);
user.setEmail(set your email);
session.put(loggedIn, user);
return SUCCESS;
} else {
return ERROR;
}
}

@RequiredStringValidator(message=, key = username.required)
@StringLengthFieldValidator(message = , key =
username.invalidLength, minLength = 6 , maxLength = 15)
@RegexFieldValidator(message = , key = prompt.invalidCharacters,
expression = ^[a-zA-Z0-9]+$)
public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

@RequiredStringValidator(message=, key=password.required)
@StringLengthFieldValidator(message = , key =
password.invalidLength, minLength = 6 , maxLength = 15)
@RegexFieldValidator(message = , key = prompt.invalidCharacters,
expression = ^[a-zA-Z0-9]+$)
public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

}

It uses annotation to validate.

Hope this will help.

Regards.

Pierre


Nicole Luneburg wrote:

 Hi all!

 Been looking all over the net but my validation simply isn't working :(



 I have a JSP page with a dropdown box in a form.

 I just want to make sure the value in the dropdown box is not empty.

 It currently looks like this:



 s:form action=3Dmyaction method=3Dpost validate=3Dtrue

 s:actionerror /

 s:fielderror /



 s:select name=3DfieldName

 id=3DfieldName

 theme=3Dsimple

 size=3D1

 list=3DfieldList

 headerKey=3D

 headerValue=3D- - Please Select - -/

 s:submit name=3DSubmit/

 /s:form



 My setup is that I have an Action class, which uses a Form to set and get
 f= ield values from the JSP page.

 In Struts1 I was using the validate(...) method in the Form class.

 It seems none of the Struts2 validation examples on the net are working
 for=  me.

 Or I'm not doing it right.



 Anyone any ideas how I can do this simply?



 Cheers!

 nic


 
 The contents of this email are confidential and may be subject to legal or
 professional privilege and copyright. No representation is made that this
 email is free of viruses or other defects. If you have received this
 communication in error, you may not copy or distribute any part of it or
 otherwise disclose its contents to anyone. Please advise the sender of
 your incorrect receipt of this correspondence.



--
View this message in context: 
http://www.nabble.com/struts2-validation-tp18438182p18485869.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


The contents of this email are confidential and may be subject to legal or 
professional privilege and copyright. No representation is made that this email 
is free of viruses or other defects. If you have received this communication in 
error, you may not copy or distribute any part of it or otherwise disclose its 
contents to anyone. Please advise the sender of your incorrect receipt of this 
correspondence.

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



Re: struts2 validation

2008-07-14 Thread Jeromy Evans

Nicole Luneburg wrote:




s:form action=3Dmyaction method=3Dpost validate=3Dtrue
  
The validate attribute here is used to enable client-side validation 
only.  That will only work if you include the s:head attribute in the 
page.






My setup is that I have an Action class, which uses a Form to set and get f= 
ield values from the JSP page.

In Struts1 I was using the validate(...) method in the Form class.

It seems none of the Struts2 validation examples on the net are working for=  
me.

  


You haven't mentioned whether you're using XML validation or 
annotation-based validation.  If by not working you mean does nothing, 
then your XML file is probably incorrectly named or your missing an 
annotation.  (You need to enable this separately from client-side 
validation)


Whatever the case, the main difference between Struts1 and Struts2 here 
is that Struts2 performs validation on the Object, not on the form 
parameters.
That means, to check that fieldName is non-blank, it will call 
getFieldName() after setFieldName() was called by the ParametersInterceptor.


A common problem is to forget the getter, but in that case Struts will 
keep returning INPUT (validation failed) instead of invoking your action.


Hope that helps,
Jeromy Evans





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



Re: struts2 validation

2008-07-14 Thread Markus Stauffer
If you want validation like in struts1 you can implement the interface
com.opensymphony.xwork2.Validateable in your Action class. The method
validate() is the same as in your struts1 FormBean.

But maybe that's a bit old fashioned :)

Regards
-- 
Markus Stauffer

On Mon, Jul 14, 2008 at 8:54 AM, Jeromy Evans
[EMAIL PROTECTED] wrote:
 Nicole Luneburg wrote:



 s:form action=3Dmyaction method=3Dpost validate=3Dtrue


 The validate attribute here is used to enable client-side validation only.
  That will only work if you include the s:head attribute in the page.




 My setup is that I have an Action class, which uses a Form to set and get
 f= ield values from the JSP page.

 In Struts1 I was using the validate(...) method in the Form class.

 It seems none of the Struts2 validation examples on the net are working
 for=  me.



 You haven't mentioned whether you're using XML validation or
 annotation-based validation.  If by not working you mean does nothing,
 then your XML file is probably incorrectly named or your missing an
 annotation.  (You need to enable this separately from client-side
 validation)

 Whatever the case, the main difference between Struts1 and Struts2 here is
 that Struts2 performs validation on the Object, not on the form parameters.
 That means, to check that fieldName is non-blank, it will call
 getFieldName() after setFieldName() was called by the ParametersInterceptor.

 A common problem is to forget the getter, but in that case Struts will keep
 returning INPUT (validation failed) instead of invoking your action.

 Hope that helps,
 Jeromy Evans





 -
 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: struts2 validation

2008-07-14 Thread Nicole Luneburg
ps. My post added some 3D text that isn't supposed to be there ...

Thanks Jeromy.

Yes I do have a s:head attribute, maybe not *exactly* but I have:
s:head theme=ajax /

Apologies for the confusion.
What I meant in my pevious post was that I had tried a few ways to do this 
validation task.
In my initial post I had described one of these attempts which I think should 
have worked.

What I am getting regardless of what sort of validation I try to implement is 
this error:

java.lang.StringIndexOutOfBoundsException: String index out of range: -7

You mentioned the getters and setters for the fieldnames ... this only works 
though if the fields are stored in the action right?
coz the fields I have aren't stored in the action, they are stored in a Form 
class.

Ie my action looks something like:

public String execute() {
MyForm myForm = (MyForm)super.form;
String myField = myForm.getFieldName();
}

Markus: Thanks for your reply too, I am trying it right now. Just want this to 
work grrr


-Original Message-
From: Jeromy Evans [mailto:[EMAIL PROTECTED]
Sent: Monday, 14 July 2008 4:25 PM
To: Struts Users Mailing List
Subject: Re: struts2 validation

Nicole Luneburg wrote:



 s:form action=3Dmyaction method=3Dpost validate=3Dtrue

The validate attribute here is used to enable client-side validation
only.  That will only work if you include the s:head attribute in the
page.




 My setup is that I have an Action class, which uses a Form to set and get f= 
 ield values from the JSP page.

 In Struts1 I was using the validate(...) method in the Form class.

 It seems none of the Struts2 validation examples on the net are working for=  
 me.



You haven't mentioned whether you're using XML validation or
annotation-based validation.  If by not working you mean does nothing,
then your XML file is probably incorrectly named or your missing an
annotation.  (You need to enable this separately from client-side
validation)

Whatever the case, the main difference between Struts1 and Struts2 here
is that Struts2 performs validation on the Object, not on the form
parameters.
That means, to check that fieldName is non-blank, it will call
getFieldName() after setFieldName() was called by the ParametersInterceptor.

A common problem is to forget the getter, but in that case Struts will
keep returning INPUT (validation failed) instead of invoking your action.

Hope that helps,
Jeromy Evans





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


The contents of this email are confidential and may be subject to legal or 
professional privilege and copyright. No representation is made that this email 
is free of viruses or other defects. If you have received this communication in 
error, you may not copy or distribute any part of it or otherwise disclose its 
contents to anyone. Please advise the sender of your incorrect receipt of this 
correspondence.

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



Re: struts2 validation

2008-07-14 Thread Markus Stauffer
Struts2 does not have FormBeans anymore. All the form fields are
instance variables directly in your Action class. Simply include a
variable fieldName of type String with getters and setters in your
Action class. The setFieldName() method will be called when you submit
the form. In the execute() and validate() methods you can use the
fieldName variable directly.

What you can also do is put a instance variable of a bean in your
Action class. You can then acces the getters and setters of this bean
in the jsp:

s:form action=myaction
   s:select name=myBeanVariableName.fieldName
 theme=simple
 list=fieldList
 headerKey=
 headerValue=- - Please Select - -/
/s:form

If you submit this form struts will call
myaction.getMyBeanVariableName().setFieldName(selectedValue).


Regards
-- 
Markus Stauffer


On Mon, Jul 14, 2008 at 9:16 AM, Nicole Luneburg
[EMAIL PROTECTED] wrote:
 ps. My post added some 3D text that isn't supposed to be there ...

 Thanks Jeromy.

 Yes I do have a s:head attribute, maybe not *exactly* but I have:
 s:head theme=ajax /

 Apologies for the confusion.
 What I meant in my pevious post was that I had tried a few ways to do this 
 validation task.
 In my initial post I had described one of these attempts which I think should 
 have worked.

 What I am getting regardless of what sort of validation I try to implement is 
 this error:

 java.lang.StringIndexOutOfBoundsException: String index out of range: -7

 You mentioned the getters and setters for the fieldnames ... this only works 
 though if the fields are stored in the action right?
 coz the fields I have aren't stored in the action, they are stored in a Form 
 class.

 Ie my action looks something like:

 public String execute() {
MyForm myForm = (MyForm)super.form;
String myField = myForm.getFieldName();
 }

 Markus: Thanks for your reply too, I am trying it right now. Just want this 
 to work grrr


 -Original Message-
 From: Jeromy Evans [mailto:[EMAIL PROTECTED]
 Sent: Monday, 14 July 2008 4:25 PM
 To: Struts Users Mailing List
 Subject: Re: struts2 validation

 Nicole Luneburg wrote:



 s:form action=3Dmyaction method=3Dpost validate=3Dtrue

 The validate attribute here is used to enable client-side validation
 only.  That will only work if you include the s:head attribute in the
 page.




 My setup is that I have an Action class, which uses a Form to set and get f= 
 ield values from the JSP page.

 In Struts1 I was using the validate(...) method in the Form class.

 It seems none of the Struts2 validation examples on the net are working for= 
  me.



 You haven't mentioned whether you're using XML validation or
 annotation-based validation.  If by not working you mean does nothing,
 then your XML file is probably incorrectly named or your missing an
 annotation.  (You need to enable this separately from client-side
 validation)

 Whatever the case, the main difference between Struts1 and Struts2 here
 is that Struts2 performs validation on the Object, not on the form
 parameters.
 That means, to check that fieldName is non-blank, it will call
 getFieldName() after setFieldName() was called by the ParametersInterceptor.

 A common problem is to forget the getter, but in that case Struts will
 keep returning INPUT (validation failed) instead of invoking your action.

 Hope that helps,
 Jeromy Evans





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


 The contents of this email are confidential and may be subject to legal or 
 professional privilege and copyright. No representation is made that this 
 email is free of viruses or other defects. If you have received this 
 communication in error, you may not copy or distribute any part of it or 
 otherwise disclose its contents to anyone. Please advise the sender of your 
 incorrect receipt of this correspondence.

 -
 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: struts2 validation

2008-07-14 Thread Dave Newton
If you don't have an action property named fieldname then not only will 
validation not work but neither will normal property copying (from form to 
action).

If, for example, you have a MyForm named form, and has an appropriate 
getter/setter, its form element would look like this:

s:textfield name=form.fieldName/

If you're handling validation programmatically (via the Validateable interface 
and the action's validate() method) you'd then validate against the MyForm 
instance, for example:

public void validate() {
if (StringUtils.isBlank(this.form.getFieldName())) {
...
}
...
}

It sort of seems like you're implementing a bit of ModelDriven, but 
manually--not a problem, but seems a bit duplicative.

Dave

--- On Mon, 7/14/08, Nicole Luneburg wrote:

 From: Nicole Luneburg [EMAIL PROTECTED]
 Subject: RE: struts2 validation
 To: Struts Users Mailing List user@struts.apache.org
 Date: Monday, July 14, 2008, 3:16 AM
 ps. My post added some 3D text that isn't
 supposed to be there ...
 
 Thanks Jeromy.
 
 Yes I do have a s:head attribute, maybe not
 *exactly* but I have:
 s:head theme=ajax /
 
 Apologies for the confusion.
 What I meant in my pevious post was that I had tried a few
 ways to do this validation task.
 In my initial post I had described one of these attempts
 which I think should have worked.
 
 What I am getting regardless of what sort of validation I
 try to implement is this error:
 
 java.lang.StringIndexOutOfBoundsException: String index out
 of range: -7
 
 You mentioned the getters and setters for the fieldnames
 ... this only works though if the fields are stored in the
 action right?
 coz the fields I have aren't stored in the action, they
 are stored in a Form class.
 
 Ie my action looks something like:
 
 public String execute() {
 MyForm myForm = (MyForm)super.form;
 String myField = myForm.getFieldName();
 }
 
 Markus: Thanks for your reply too, I am trying it right
 now. Just want this to work grrr
 
 
 -Original Message-
 From: Jeromy Evans
 [mailto:[EMAIL PROTECTED]
 Sent: Monday, 14 July 2008 4:25 PM
 To: Struts Users Mailing List
 Subject: Re: struts2 validation
 
 Nicole Luneburg wrote:
 
 
 
  s:form action=3Dmyaction
 method=3Dpost validate=3Dtrue
 
 The validate attribute here is used to enable client-side
 validation
 only.  That will only work if you include the
 s:head attribute in the
 page.
 
 
 
 
  My setup is that I have an Action class, which uses a
 Form to set and get f= ield values from the JSP page.
 
  In Struts1 I was using the validate(...) method in the
 Form class.
 
  It seems none of the Struts2 validation examples on
 the net are working for=  me.
 
 
 
 You haven't mentioned whether you're using XML
 validation or
 annotation-based validation.  If by not working you mean
 does nothing,
 then your XML file is probably incorrectly named or your
 missing an
 annotation.  (You need to enable this separately from
 client-side
 validation)
 
 Whatever the case, the main difference between Struts1 and
 Struts2 here
 is that Struts2 performs validation on the Object, not on
 the form
 parameters.
 That means, to check that fieldName is
 non-blank, it will call
 getFieldName() after setFieldName() was called by the
 ParametersInterceptor.
 
 A common problem is to forget the getter, but in that case
 Struts will
 keep returning INPUT (validation failed) instead of
 invoking your action.
 
 Hope that helps,
 Jeromy Evans
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 The contents of this email are confidential and may be
 subject to legal or professional privilege and copyright.
 No representation is made that this email is free of
 viruses or other defects. If you have received this
 communication in error, you may not copy or distribute any
 part of it or otherwise disclose its contents to anyone.
 Please advise the sender of your incorrect receipt of this
 correspondence.
 
 -
 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: struts2 validation

2008-07-14 Thread Nicole Luneburg
Ah!
Now I understand ... Looks like I will be changing a few things in this project 
...
Thanks for your help!

-Original Message-
From: Dave Newton [mailto:[EMAIL PROTECTED]
Sent: Monday, 14 July 2008 10:22 PM
To: Struts Users Mailing List
Subject: RE: struts2 validation

If you don't have an action property named fieldname then not only will 
validation not work but neither will normal property copying (from form to 
action).

If, for example, you have a MyForm named form, and has an appropriate 
getter/setter, its form element would look like this:

s:textfield name=form.fieldName/

If you're handling validation programmatically (via the Validateable interface 
and the action's validate() method) you'd then validate against the MyForm 
instance, for example:

public void validate() {
if (StringUtils.isBlank(this.form.getFieldName())) {
...
}
...
}

It sort of seems like you're implementing a bit of ModelDriven, but 
manually--not a problem, but seems a bit duplicative.

Dave

--- On Mon, 7/14/08, Nicole Luneburg wrote:

 From: Nicole Luneburg [EMAIL PROTECTED]
 Subject: RE: struts2 validation
 To: Struts Users Mailing List user@struts.apache.org
 Date: Monday, July 14, 2008, 3:16 AM
 ps. My post added some 3D text that isn't
 supposed to be there ...

 Thanks Jeromy.

 Yes I do have a s:head attribute, maybe not
 *exactly* but I have:
 s:head theme=ajax /

 Apologies for the confusion.
 What I meant in my pevious post was that I had tried a few
 ways to do this validation task.
 In my initial post I had described one of these attempts
 which I think should have worked.

 What I am getting regardless of what sort of validation I
 try to implement is this error:

 java.lang.StringIndexOutOfBoundsException: String index out
 of range: -7

 You mentioned the getters and setters for the fieldnames
 ... this only works though if the fields are stored in the
 action right?
 coz the fields I have aren't stored in the action, they
 are stored in a Form class.

 Ie my action looks something like:

 public String execute() {
 MyForm myForm = (MyForm)super.form;
 String myField = myForm.getFieldName();
 }

 Markus: Thanks for your reply too, I am trying it right
 now. Just want this to work grrr


 -Original Message-
 From: Jeromy Evans
 [mailto:[EMAIL PROTECTED]
 Sent: Monday, 14 July 2008 4:25 PM
 To: Struts Users Mailing List
 Subject: Re: struts2 validation

 Nicole Luneburg wrote:
 
 
 
  s:form action=3Dmyaction
 method=3Dpost validate=3Dtrue
 
 The validate attribute here is used to enable client-side
 validation
 only.  That will only work if you include the
 s:head attribute in the
 page.


 
 
  My setup is that I have an Action class, which uses a
 Form to set and get f= ield values from the JSP page.
 
  In Struts1 I was using the validate(...) method in the
 Form class.
 
  It seems none of the Struts2 validation examples on
 the net are working for=  me.
 
 

 You haven't mentioned whether you're using XML
 validation or
 annotation-based validation.  If by not working you mean
 does nothing,
 then your XML file is probably incorrectly named or your
 missing an
 annotation.  (You need to enable this separately from
 client-side
 validation)

 Whatever the case, the main difference between Struts1 and
 Struts2 here
 is that Struts2 performs validation on the Object, not on
 the form
 parameters.
 That means, to check that fieldName is
 non-blank, it will call
 getFieldName() after setFieldName() was called by the
 ParametersInterceptor.

 A common problem is to forget the getter, but in that case
 Struts will
 keep returning INPUT (validation failed) instead of
 invoking your action.

 Hope that helps,
 Jeromy Evans





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


 The contents of this email are confidential and may be
 subject to legal or professional privilege and copyright.
 No representation is made that this email is free of
 viruses or other defects. If you have received this
 communication in error, you may not copy or distribute any
 part of it or otherwise disclose its contents to anyone.
 Please advise the sender of your incorrect receipt of this
 correspondence.

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


The contents of this email are confidential and may be subject to legal or 
professional privilege and copyright. No representation is made that this email 
is free of viruses or other defects. If you have received this communication in 
error, you may not copy or distribute any part of it or otherwise disclose its 
contents

RE: struts2 validation

2008-07-14 Thread Nicole Luneburg
In case it helps anyone else, I found a simple solution ... Annotations.
I did exactly what is here:
http://struts.apache.org/2.x/docs/validation-annotation.html

Thanks again for everyone's help!


The contents of this email are confidential and may be subject to legal or 
professional privilege and copyright. No representation is made that this email 
is free of viruses or other defects. If you have received this communication in 
error, you may not copy or distribute any part of it or otherwise disclose its 
contents to anyone. Please advise the sender of your incorrect receipt of this 
correspondence.

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



Re: Struts2 validation issue when internet is not available in the application server.

2008-03-26 Thread Dave Newton
Is your DTD correct? 

As a trivial test I turned off my WiFi and restarted a webapp that uses a
validation configuration file and no issues throught he startup or validation
process.

Dave

--- Nuwan Chandrasoma [EMAIL PROTECTED] wrote:

 Hi All,
 
 Has any one come across this issue? . we dont have internet in our app 
 server and the struts2 validation fails as it cant access 
 www.opensymphony.com.
 
 Thanks,
 
 Nuwan.
 
 Caused by: java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at
 freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
 at 
 freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
 ... 160 more
 Caused by: java.lang.ExceptionInInitializerError
 at 

com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(ValidatorFileParser.java:177)
 at 

com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorConfigs(ValidatorFileParser.java:72)
 at 

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:357)
 at com.opensymphony.xwork2.va
 26 Mar 2008 17:58:04,489 INFO  [STDOUT] 

lidator.AnnotationActionValidatorManager.buildAliasValidatorConfigs(AnnotationActionValidatorManager.java:240)
 at 

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:339)
 at 

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69)
 at 

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:49)
 at org.apache.struts2.components.Form.getValidators(Form.java:412)
 ... 166 more
 Caused by: www.opensymphony.com - [unknown location]
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123)
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:71)
 at 

com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:114)
 at 

com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:99)
 at 

com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators(ValidatorFactory.java:314)
 at 

com.opensymphony.xwork2.validator.ValidatorFactory.clinit(ValidatorFactory.java:220)
 ... 174 more
 Caused by: java.net.UnknownHostException: www.opensymphony.com
 at java.net.PlainSocketImpl.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at sun.net.NetworkClient.doConnect(Unknown Source)
 at sun.net.www.http.HttpClient.openServer(Unknown Source)
 at sun.net.www.http.HttpClient.openServer(Unknown Source)
 at sun.net.www.http.HttpClient.init(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at 
 sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
 Source)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown 
 Source)
 at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
 at 
 sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
 at 
 org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
 at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
 at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown 
 Source)
 at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown 
 Source)
 at 

org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown
 
 Source)
 at 
 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
 Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
 Source)
 at javax.xml.parsers.SAXParser.parse(Unknown Source)
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121)
 ... 179 more
 
 -
 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: Struts2 validation issue when internet is not available in the application server.

2008-03-26 Thread Martin Gainty
So to take an example in the supplied validators xml

validators
field name=count
field-validator type=int short-circuit=true
param name=min1/param
param name=max100/param
message key=invalid.countInvalid Count!/message
/field-validator
field-validator type=int
param name=min20/param
param name=max80/param
message key=invalid.count.badSmaller Invalid Count:
${count}/message
/field-validator
/field
/validators

The xwork package ValidatorFileParser.java hunts for
type attribute of field-validator element
short-circuit attribute of field-validator

param sub element
name attribute of subelement

message element
key attribute of the message element

M-
- Original Message -
From: Nuwan Chandrasoma [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, March 26, 2008 8:16 AM
Subject: Struts2 validation issue when internet is not available in the
application server.


 Hi All,

 Has any one come across this issue? . we dont have internet in our app
 server and the struts2 validation fails as it cant access
 www.opensymphony.com.

 Thanks,

 Nuwan.

 Caused by: java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at
freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
 at
 freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
 ... 160 more
 Caused by: java.lang.ExceptionInInitializerError
 at

com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(Va
lidatorFileParser.java:177)
 at

com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorCo
nfigs(ValidatorFileParser.java:72)
 at

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(
AnnotationActionValidatorManager.java:357)
 at com.opensymphony.xwork2.va
 26 Mar 2008 17:58:04,489 INFO  [STDOUT]

lidator.AnnotationActionValidatorManager.buildAliasValidatorConfigs(Annotati
onActionValidatorManager.java:240)
 at

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildVali
datorConfigs(AnnotationActionValidatorManager.java:339)
 at

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValida
tors(AnnotationActionValidatorManager.java:69)
 at

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValida
tors(AnnotationActionValidatorManager.java:49)
 at org.apache.struts2.components.Form.getValidators(Form.java:412)
 ... 166 more
 Caused by: www.opensymphony.com - [unknown location]
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123)
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:71)
 at

com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefiniti
ons(ValidatorFileParser.java:114)
 at

com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefiniti
ons(ValidatorFileParser.java:99)
 at

com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators(Validator
Factory.java:314)
 at

com.opensymphony.xwork2.validator.ValidatorFactory.clinit(ValidatorFactory
java:220)
 ... 174 more
 Caused by: java.net.UnknownHostException: www.opensymphony.com
 at java.net.PlainSocketImpl.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at sun.net.NetworkClient.doConnect(Unknown Source)
 at sun.net.www.http.HttpClient.openServer(Unknown Source)
 at sun.net.www.http.HttpClient.openServer(Unknown Source)
 at sun.net.www.http.HttpClient.init(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at
 sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
 Source)
 at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
 at
 sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
 at
 org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
 at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
 at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown
 Source)
 at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown
 Source)
 at

org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown
 Source)
 at
 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
 Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at 

Re: Struts2 validation issue when internet is not available in the application server.

2008-03-26 Thread Nuwan Chandrasoma
This is my xml file. when we run in a local machine that has internet 
access this works fine.


?xml version=1.0 encoding=UTF-8?

!DOCTYPE validators PUBLIC

 -//OpenSymphony Group//XWork Validator 1.0.2//EN

 http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd;



validators

   field name=username

   field-validator type=required
   messageLogin name is required/message

   /field-validator

   /field

   field name=password

   field-validator type=required
   messagePassword is required/message

   /field-validator

   /field

/validators

Dave Newton wrote:
Is your DTD correct? 


As a trivial test I turned off my WiFi and restarted a webapp that uses a
validation configuration file and no issues throught he startup or validation
process.

Dave

--- Nuwan Chandrasoma [EMAIL PROTECTED] wrote:

  

Hi All,

Has any one come across this issue? . we dont have internet in our app 
server and the struts2 validation fails as it cant access 
www.opensymphony.com.


Thanks,

Nuwan.

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
at 
freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)

... 160 more
Caused by: java.lang.ExceptionInInitializerError
at 



com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(ValidatorFileParser.java:177)
  
at 



com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorConfigs(ValidatorFileParser.java:72)
  
at 



com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:357)
  

at com.opensymphony.xwork2.va
26 Mar 2008 17:58:04,489 INFO  [STDOUT] 



lidator.AnnotationActionValidatorManager.buildAliasValidatorConfigs(AnnotationActionValidatorManager.java:240)
  
at 



com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:339)
  
at 



com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69)
  
at 



com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:49)
  

at org.apache.struts2.components.Form.getValidators(Form.java:412)
... 166 more
Caused by: www.opensymphony.com - [unknown location]
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123)
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:71)
at 



com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:114)
  
at 



com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:99)
  
at 



com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators(ValidatorFactory.java:314)
  
at 



com.opensymphony.xwork2.validator.ValidatorFactory.clinit(ValidatorFactory.java:220)
  

... 174 more
Caused by: java.net.UnknownHostException: www.opensymphony.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.init(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at 
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown

Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown 
Source)

at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at 
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)

at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown 
Source)
at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown 
Source)
at 



org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown
  

Source)
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

Re: Struts2 validation issue when internet is not available in the application server.

2008-03-26 Thread Dave Newton
--- Nuwan Chandrasoma [EMAIL PROTECTED] wrote:
 This is my xml file. when we run in a local machine that has internet 
 access this works fine.
 
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE validators PUBLIC
   -//OpenSymphony Group//XWork Validator 1.0.2//EN
   http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd;

Hmm, AFAICT that's exactly what I'm using.

What container are you running in? I'm running via a local Tomcat via Eclipse
Europa; it's possible that Eclipse has cached my DTD or something. I'll look
in to it a bit more.

Dave



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



Re: Struts2 validation issue when internet is not available in the application server.

2008-03-26 Thread Nuwan Chandrasoma

I am using jboss-4.0.5-GA

Dave Newton wrote:

--- Nuwan Chandrasoma [EMAIL PROTECTED] wrote:
  
This is my xml file. when we run in a local machine that has internet 
access this works fine.


?xml version=1.0 encoding=UTF-8?
!DOCTYPE validators PUBLIC
  -//OpenSymphony Group//XWork Validator 1.0.2//EN
  http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd;



Hmm, AFAICT that's exactly what I'm using.

What container are you running in? I'm running via a local Tomcat via Eclipse
Europa; it's possible that Eclipse has cached my DTD or something. I'll look
in to it a bit more.

Dave



-
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: Struts2 validation issue when internet is not available in the application server.

2008-03-26 Thread Dave Newton
--- Dave Newton [EMAIL PROTECTED] wrote:
 --- Nuwan Chandrasoma [EMAIL PROTECTED] wrote:
  This is my xml file. when we run in a local machine that has internet 
  access this works fine.
  
  ?xml version=1.0 encoding=UTF-8?
  !DOCTYPE validators PUBLIC
-//OpenSymphony Group//XWork Validator 1.0.2//EN
http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd;
 
 Hmm, AFAICT that's exactly what I'm using.
 
 What container are you running in? I'm running via a local Tomcat via
 Eclipse Europa; it's possible that Eclipse has cached my DTD or 
 something. I'll look in to it a bit more.

Just as a quick followup, with no internet access and no DTD caching it still
seems to work okay.

It's also giving me confusing log entries; I have no annotations in my action
class that's being validated, but the debugs are from the annotation
validation manager. The messages being displayed are from the XML file. So
I'm a little lost and potentially less useful than I thought ;)

Dave


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



RE: Struts2 Validation

2008-01-24 Thread Jeff Hill (RR)
Kevin,
You didn't mention what page has the form you're submitting, but let me call
that page0. Let's say it has two buttons: Button1 for Action1, and Button2
for Action2. I'm assuming that you entered data and hit Button2, and this
worked fine until you added the validation descriptor for Action2. 

The fact that it did stop working, and that it's trying to handle input,
says there was a vaidation failure. Trying to coerce input to take you to
page2 isn't likely to help, since on the validation failure the action
isn't invoked, so edit() is never called.

So, I have to assume that, from the data you entered, you didn't *expect*
validation to fail. I'd suggest you review the validation you added,
especially if there are any custom validators - maybe there's a combination
of validators on some field that can never evaluate to true. If there's
nothing obvious then I'd suggest adding an actionerror or some fielderror
tags to page0, and let it redisplay so you can see what field is failing
validation.

...Jeff

-Original Message-
From: djia002 [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 24, 2008 8:14 PM
To: user@struts.apache.org
Subject: Struts2 Validation


Hello , I am new to struts2. Please help me on this problem.

I have a configuration like this 
action name=Action1.* method={1} class=ActionClass1
result name=summary/page1.jsp/result
result name=detail/page2.jsp/result
/action

action name=Action2.* method={1} class=ActionClass2
result name=summary/page1.jsp/result
result name=detail/page2.jsp/result
result name=input/page2.jsp/result
/action


The flow is I submit a form from page1 to Action ActionClass2.edit method, 

public String edit() throws Exception {

// fetch some data and push into session for rendering page2.jsp ...


return detail; // This will forward to page2.jsp
}

You can see from the code that edit() method try to store some data in
session for displaying page2.jsp.

Everything works fine until i added ActionClass2-validation.xml for
validating the form on page2.jsp.

I got error says No result defined for action  and result input.
so I added result name=inputpage2.jsp/result into configuration. and
then of course it just simply try to display page2.jsp without having data
preloaded by edit() because edit() not get called at all.

How can I work around with this problem?

Thanks in advance.
Kevin
-- 
View this message in context:
http://www.nabble.com/Struts2-Validation-tp15079124p15079124.html
Sent from the Struts - User mailing list archive at Nabble.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: struts2 validation - wildcard mappings and the submit tag method parameter

2007-10-26 Thread Igor Vlasov

use  @SkipValidation annotation for methods, which you do not need to
validate.
This affects on StrutsValidationFramework

For validate() method you must manually analyse the situation and skip its
executing.



Lindell, Andrew wrote:
 
 The problem I'm having is getting validation to run when the wildcard
 mapped method is specified in the submit tag method parameter and not in
 the form tag action parameter (action-method).
 
 Everything works fine when I set the form action param to specify the
 action and method.
 
  
 
 If the method is specified in the submit tag does it use the same format
 for validation files (actionclass-alias-method).
 
  
 
 Thanks
 
  
 
 -Andrew
 
  
 
  
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2-validation---wildcard-mappings-and-the-submit-tag-%22method%22-parameter-tf4691287.html#a13423851
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2 validation for only one method in action

2007-10-18 Thread Igor Vlasov

Thank you for your answer. It was very helpful.



Ian Roughley wrote:
 
 you can always use s:submit name=method:delete value=Delete / and 
 s:submit value=Execute / - then you don't need the logic to 
 determine which button was clicked in the execute() method, and you can 
 use the validation config below.
 
 /ian
 
 Igor Vlasov wrote:
 This is not a solution.

 I have 2 submit button in one form: one for save and another for delete.
 All
 of them submit the form data to execute() method. There I can determine
 which button was pressed and do  an appropriate bussines action.

 The problem is that i must to validate the data when OK button is
 pressed
 and  NOT validate when DEL button is pressed.


 ros wrote:
   
 For struts it's 
 interceptor-ref name=validation
 cancel,execute,delete,edit,list,print
 /interceptor-ref

 Hope this helps.

 ros


 Igor Vlasov wrote:
 
 And how to disable the SERVER side validation when delete button
 clicked
 ?



 ros wrote:
   
 Java Script validation fro button disabled by 

 s:submit cssClass=button method=delete key=button.delete

 onclick=document.getElementById('ticketForm').onsubmit = null; /


 ros wrote:
 
 If I have in one form DELETE and SAVE buttons, how to turn off client
 side validation for DELETE button?

   
 
   
 

   
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13269628
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2 validation for only one method in action

2007-10-17 Thread shan99


I have 2 mothods caled edit() and create() I used annotation based
validation
but tthing is i want to validate some of experssions in edit method and some
of the in create() method
cant use @skipValidation in this
my problem is i can not difine this seperatly in my actiion class ..both
methods get validate from all expressions? any 1 have a ida?
-- 
View this message in context: 
http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13249573
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2 validation for only one method in action

2007-10-17 Thread Igor Vlasov

And how to disable the SERVER side validation when delete button clicked ?



ros wrote:
 
 Java Script validation fro button disabled by 
 
 s:submit cssClass=button method=delete key=button.delete

 onclick=document.getElementById('ticketForm').onsubmit = null; /
 
 
 ros wrote:
 
 If I have in one form DELETE and SAVE buttons, how to turn off client
 side validation for DELETE button?
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13253735
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2 validation for only one method in action

2007-10-17 Thread ros

For struts it's 
interceptor-ref name=validation
cancel,execute,delete,edit,list,print
/interceptor-ref

Hope this helps.

ros


Igor Vlasov wrote:
 
 And how to disable the SERVER side validation when delete button clicked ?
 
 
 
 ros wrote:
 
 Java Script validation fro button disabled by 
 
 s:submit cssClass=button method=delete key=button.delete

 onclick=document.getElementById('ticketForm').onsubmit = null; /
 
 
 ros wrote:
 
 If I have in one form DELETE and SAVE buttons, how to turn off client
 side validation for DELETE button?
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13254840
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2 validation for only one method in action

2007-10-17 Thread Igor Vlasov

This is not a solution.

I have 2 submit button in one form: one for save and another for delete. All
of them submit the form data to execute() method. There I can determine
which button was pressed and do  an appropriate bussines action.

The problem is that i must to validate the data when OK button is pressed
and  NOT validate when DEL button is pressed.


ros wrote:
 
 For struts it's 
 interceptor-ref name=validation
 cancel,execute,delete,edit,list,print
 /interceptor-ref
 
 Hope this helps.
 
 ros
 
 
 Igor Vlasov wrote:
 
 And how to disable the SERVER side validation when delete button clicked
 ?
 
 
 
 ros wrote:
 
 Java Script validation fro button disabled by 
 
 s:submit cssClass=button method=delete key=button.delete

 onclick=document.getElementById('ticketForm').onsubmit = null; /
 
 
 ros wrote:
 
 If I have in one form DELETE and SAVE buttons, how to turn off client
 side validation for DELETE button?
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13254948
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2 validation for only one method in action

2007-10-17 Thread Ian Roughley
you can always use s:submit name=method:delete value=Delete / and 
s:submit value=Execute / - then you don't need the logic to 
determine which button was clicked in the execute() method, and you can 
use the validation config below.


/ian

Igor Vlasov wrote:

This is not a solution.

I have 2 submit button in one form: one for save and another for delete. All
of them submit the form data to execute() method. There I can determine
which button was pressed and do  an appropriate bussines action.

The problem is that i must to validate the data when OK button is pressed
and  NOT validate when DEL button is pressed.


ros wrote:
  
For struts it's 
interceptor-ref name=validation

cancel,execute,delete,edit,list,print
/interceptor-ref

Hope this helps.

ros


Igor Vlasov wrote:


And how to disable the SERVER side validation when delete button clicked
?



ros wrote:
  
Java Script validation fro button disabled by 


s:submit cssClass=button method=delete key=button.delete
   
onclick=document.getElementById('ticketForm').onsubmit = null; /



ros wrote:


If I have in one form DELETE and SAVE buttons, how to turn off client
side validation for DELETE button?

  

  



  


Re: Struts2 Validation formating error messages

2007-08-12 Thread Laurie Harper

WiltOnTilt wrote:

Hi, I've searched around here and googling to try to find a good answer but I
haven't found one.

I'm using the basic struts2 validation with the validate=true on my
s:form so the validation is done client side.

I'd like to change the error messages so they do not show up ABOVE my
controls.  (I dont know about you guys but wow that's so annoying... default
should have been right or left of the control)...

I'd like to get the error messages to show up to the right of my control and
I'd like those messages to be in red.  Alternatively, I wouldn't mind having
all the errors listed at the top of the page with red *'s next to each
field.  Either is fine.

Do I need to create my own version of s:textfield to make this happen?  Or
a new theme perhaps?  If so do you know of any good resources for this?

I've tried using the s:actionerror / tag but nothing ever renders from it?


Customizing whichever theme you are using is probably the easiest way to 
tailor the page layout as you wish. See here for relevant documentation:


http://struts.apache.org/2.x/docs/themes-and-templates.html
http://struts.apache.org/2.x/docs/extending-themes.html

HTH,

L.


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



RE: Struts2 validation with portlet

2007-07-05 Thread King, William S.
Can you point me to the location of the portlet example app?  

Thanks,
Shane 

-Original Message-
From: Nils-Helge Garli [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 05, 2007 9:34 AM
To: Struts Users Mailing List
Subject: Re: Struts2 validation with portlet

If you look at the portlet example application it has an example of
using xml validation.

Nils-H

On 7/5/07, devsahu [EMAIL PROTECTED] wrote:

 Hi,

 Does stuts2 support its validation feature with portlet.
 Any help is highly appreciated.

 Thanks,
 Sabyasachi
 --
 View this message in context: 
 http://www.nabble.com/Struts2-validation-with-portlet-tf4029490.html#a
 11445797 Sent from the Struts - User mailing list archive at 
 Nabble.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]


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



Re: Struts2 validation with portlet

2007-07-05 Thread Nils-Helge Garli

If you look at the portlet example application it has an example of
using xml validation.

Nils-H

On 7/5/07, devsahu [EMAIL PROTECTED] wrote:


Hi,

Does stuts2 support its validation feature with portlet.
Any help is highly appreciated.

Thanks,
Sabyasachi
--
View this message in context: 
http://www.nabble.com/Struts2-validation-with-portlet-tf4029490.html#a11445797
Sent from the Struts - User mailing list archive at Nabble.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: Struts2 Validation Question

2006-10-17 Thread Ted Husted

S2 Validation follows a config-behind-class model. You define a
validation file for the Action class (or other JavaBean) that needs to
be validated, and place it in the same package/folder. The validation
follows the class hierarchy, so that if a class is extended, the
subclass inherits the validator. There is also an alternative syntax
so that you can specify a validation for a particular method on an
Action class. The latter is helpful when you are passing several
CRUD methods through the same Aciton class, dispatch-style.

For more, see

* http://cwiki.apache.org/WW/validation.html

-- HTH, Ted.
* http://www.husted.com/struts/

On 10/17/06, Jim Reynolds [EMAIL PROTECTED] wrote:

Downloaded and extracted the struts2-showcase-2.0.1.war file to my
tomcat server. I am looking at the validation/quizBasic!input.action
and I am confused on how the validtion on these fields is set. I am
accustomzed to using 1.x.

Could someone please explain how the validation for these three fields works?

Thanks,


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