Re: Struts 2.1 validation with annotations

2009-02-20 Thread billgloff

I have the same exact problem now after upgrading to 2.1.

I have the following model-driven validation defined (which works fine in
2.0):

@VisitorFieldValidator(message=)

Now I get the same exception as above when validation fails.

If I add in any kind of text into the message param, it works but looks ugly
since it spits out that message along with the field message. So I get
something like this underneath my textfield

My default messageLast Name cannot be blank or contain invalid characters

Any ideas about what is going on here?

Thanks.



sheltonn wrote:
 
 It is null.  Can you point me in the direction of what I am missing?
 
  
 Norris Shelton
 Software Engineer
 Sun Certified Java 1.1 Programmer
 Shelton Consulting, LLC
 ICQ# 26487421
 AIM NorrisEShelton
 YIM norrisshelton
 
 
 
 
 
 From: Musachy Barroso musa...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Thursday, February 19, 2009 3:45:35 PM
 Subject: Re: Struts 2.1 validation with annotations
 
 It seems like the default message for that validator is null. Try
 adding a break point to ValidatorSupport:getMessage and see if the
 defaultMessage is null.
 
 musachy
 
 On Thu, Feb 19, 2009 at 3:31 PM, Norris Shelton norrisshel...@yahoo.com
 wrote:
 validateObject
 
 
 
 -- 
 Hey you! Would you help me to carry the stone? Pink Floyd
 
 -
 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://www.nabble.com/Struts-2.1-validation-with-annotations-tp22109064p22124783.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: Struts 2.1 validation with annotations

2009-02-20 Thread Musachy Barroso
Please open a jira ticket with as much information as possible.

thanks
musachy

On Fri, Feb 20, 2009 at 12:33 PM, billgloff bgl...@citytechinc.com wrote:

 I have the same exact problem now after upgrading to 2.1.

 I have the following model-driven validation defined (which works fine in
 2.0):

 @VisitorFieldValidator(message=)

 Now I get the same exception as above when validation fails.

 If I add in any kind of text into the message param, it works but looks ugly
 since it spits out that message along with the field message. So I get
 something like this underneath my textfield

 My default messageLast Name cannot be blank or contain invalid characters

 Any ideas about what is going on here?

 Thanks.



 sheltonn wrote:

 It is null.  Can you point me in the direction of what I am missing?


 Norris Shelton
 Software Engineer
 Sun Certified Java 1.1 Programmer
 Shelton Consulting, LLC
 ICQ# 26487421
 AIM NorrisEShelton
 YIM norrisshelton




 
 From: Musachy Barroso musa...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Thursday, February 19, 2009 3:45:35 PM
 Subject: Re: Struts 2.1 validation with annotations

 It seems like the default message for that validator is null. Try
 adding a break point to ValidatorSupport:getMessage and see if the
 defaultMessage is null.

 musachy

 On Thu, Feb 19, 2009 at 3:31 PM, Norris Shelton norrisshel...@yahoo.com
 wrote:
 validateObject



 --
 Hey you! Would you help me to carry the stone? Pink Floyd

 -
 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://www.nabble.com/Struts-2.1-validation-with-annotations-tp22109064p22124783.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





-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Struts 2.1 validation with annotations

2009-02-19 Thread Norris Shelton
I am looking to set-up validation, but I am getting errors.  I added the 
following to my struts.xml:

package name=conap extends=struts-default
interceptors
interceptor name=cookie 
class=org.apache.struts2.interceptor.CookieInterceptor/
interceptor-stack name=validationStack
interceptor-ref name=defaultStack/
interceptor-ref name=validation/
/interceptor-stack
/interceptors
default-interceptor-ref name=defaultStack/
/package

The class that I want to validate is defined as follows:
@ParentPackage(conap)
public class SubmitAction extends ActionSupport implements 
ModelDrivenApplication {
...
@VisitorFieldValidator
public Application getModel() {
return application;
}
...
@Action(
results = {
@Result(name = success, location = 
/WEB-INF/content/soldier/login-success.jsp),
@Result(name = error, location = 
/WEB-INF/content/soldier/login-error.jsp)},
interceptorRefs = {...@interceptorref(validationStack)}
)
public String execute() throws Exception {
...
}
}

The class that I want to validate is defined as follows:
public class Application {
...
@RequiredFieldValidator(type = ValidatorType.FIELD, message = Major is 
required)
public void setMajorCd(String majorCd) {
this.majorCd = majorCd;
}
...
@RequiredFieldValidator(type = ValidatorType.FIELD, message = Expected 
Entry Date is required)
public void setExpectedEntryDate(String expectedEntryDate) {
this.expectedEntryDate = expectedEntryDate;
}
}



When I submit to the action, I get an exception:
Struts Problem Report
Struts Problem Report
Struts has detected an unhandled exception: 
Messages:  
File: com/opensymphony/xwork2/util/TextParseUtil.java 
Line number: 155 


 
Stacktraces
java.lang.NullPointerException 

com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:155)

com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:116)

com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:38)

com.opensymphony.xwork2.validator.validators.ValidatorSupport.getMessage(ValidatorSupport.java:99)

com.opensymphony.xwork2.validator.validators.VisitorFieldValidator.validateObject(VisitorFieldValidator.java:156)

com.opensymphony.xwork2.validator.validators.VisitorFieldValidator.validate(VisitorFieldValidator.java:130)

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:183)

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:94)

com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:89)

com.opensymphony.xwork2.validator.ValidationInterceptor.doBeforeInvocation(ValidationInterceptor.java:208)

com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:247)

org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)

Re: Struts 2.1 validation with annotations

2009-02-19 Thread Musachy Barroso
It seems like the default message for that validator is null. Try
adding a break point to ValidatorSupport:getMessage and see if the
defaultMessage is null.

musachy

On Thu, Feb 19, 2009 at 3:31 PM, Norris Shelton norrisshel...@yahoo.com wrote:
 validateObject



-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Struts 2.1 validation with annotations

2009-02-19 Thread Norris Shelton
It is null.  Can you point me in the direction of what I am missing?

 
Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Shelton Consulting, LLC
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton





From: Musachy Barroso musa...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Thursday, February 19, 2009 3:45:35 PM
Subject: Re: Struts 2.1 validation with annotations

It seems like the default message for that validator is null. Try
adding a break point to ValidatorSupport:getMessage and see if the
defaultMessage is null.

musachy

On Thu, Feb 19, 2009 at 3:31 PM, Norris Shelton norrisshel...@yahoo.com wrote:
 validateObject



-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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