struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "prasad.th16" <dattaprasad_tha...@syntelinc.com>
Subject Getting following exception while trying validation mechanism in struts2
Date Fri, 27 Jul 2012 12:11:35 GMT
Hi,
I am trying to use struts 2 xml validation framework. But I come across
errors. I am using Struts 2.1.8.1.

Here is my action :
public class RegistrationAction extends ActionSupport{
	private String fName;
	private String lName;
	private String selGender;
	private Date dob; 
	private String selMStatus;
	private String email;
	private String cellNumber;
	private String postalAddrs;
	private String passwd;
	private String confPasswd;
	private String secQuestion;
	private String secAnswer;
	private UserAccountDeligatorImpl userAccount;
	
	
	
	public UserAccountDeligatorImpl getUserAccount() {
		return userAccount;
	}


	public void setUserAccount(UserAccountDeligatorImpl userAccount) {
		this.userAccount = userAccount;
	}


	public String getFName() {
		return fName;
	}


	public void setFName(String name) {
		fName = name;
	}


	public String getLName() {
		return lName;
	}


	public void setLName(String name) {
		lName = name;
	}


	public String getSelGender() {
		return selGender;
	}


	public void setSelGender(String selGender) {
		this.selGender = selGender;
	}


	public Date getDob() {
		return dob;
	}


	public void setDob(Date dob) {
		this.dob = dob;
	}


	public String getSelMStatus() {
		return selMStatus;
	}


	public void setSelMStatus(String selMStatus) {
		this.selMStatus = selMStatus;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getCellNumber() {
		return cellNumber;
	}


	public void setCellNumber(String cellNumber) {
		this.cellNumber = cellNumber;
	}


	public String getPostalAddrs() {
		return postalAddrs;
	}


	public void setPostalAddrs(String postalAddrs) {
		this.postalAddrs = postalAddrs;
	}


	public String getPasswd() {
		return passwd;
	}


	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}


	public String getConfPasswd() {
		return confPasswd;
	}


	public void setConfPasswd(String confPasswd) {
		this.confPasswd = confPasswd;
	}


	public String getSecQuestion() {
		return secQuestion;
	}


	public void setSecQuestion(String secQuestion) {
		this.secQuestion = secQuestion;
	}


	public String getSecAnswer() {
		return secAnswer;
	}


	public void setSecAnswer(String secAnswer) {
		this.secAnswer = secAnswer;
	}


	public String execute()
	{
		UserRegistrationInfoVO userRegistrationInfo=new UserRegistrationInfoVO();
		userRegistrationInfo.setFName(getFName());
		userRegistrationInfo.setLName(getLName());
		userRegistrationInfo.setSelGender(getSelGender());
		userRegistrationInfo.setDob(getDob());
		userRegistrationInfo.setSelMStatus(getSelMStatus());
		userRegistrationInfo.setEmail(getEmail());
		userRegistrationInfo.setCellNumber(getCellNumber());
		userRegistrationInfo.setPostalAddrs(getPostalAddrs());
		if(null!=getPasswd()&& !(getPasswd().equals("")))
		{
			if(null!=getConfPasswd()&& !(getConfPasswd().equals("")))
					{
						if(getPasswd().equals(getConfPasswd()))
						{
							userRegistrationInfo.setPasswd(getPasswd());	
						}
					}
		}
		
		
		userRegistrationInfo.setSecQuestion(getSecQuestion());
		userRegistrationInfo.setSecAnswer(getSecAnswer());
		userRegistrationInfo.setUserID(getEmail());
		int returnCode=userAccount.registerUser(userRegistrationInfo);
		
		if(returnCode==0)
			return "SUCCESS";
		else
			return "FAILLURE";
	}

}

Here is my validation file:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE validators PUBLIC 
			&quot;-//OpenSymphony Group//XWork Validator 1.0.2//EN&quot;          
			&quot;http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd&quot;>
<validators>
	
	<field name="email">
		<field-validator type="email">
			<message>Please enter valid email address</message>
		</field-validator>
	</field>
	
</validators>

Bellow is the stack trace of my error:
org.apache.jasper.JasperException: Class:
org.apache.struts2.components.template.TemplateEngineManager
File: TemplateEngineManager.java
Method: getTemplateEngine
Line: 102 -
org/apache/struts2/components/template/TemplateEngineManager.java:102:-1

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)

org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)

com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)

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

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

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:237)

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

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

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:237)

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:237)

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

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

org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)

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

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

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

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

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

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

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

com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)

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

org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)

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

com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)

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

com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)

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

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

com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)

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

org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)

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

com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)

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

com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)

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

org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)


root cause 

Class: org.apache.struts2.components.template.TemplateEngineManager
File: TemplateEngineManager.java
Method: getTemplateEngine
Line: 102 -
org/apache/struts2/components/template/TemplateEngineManager.java:102:-1
	org.apache.struts2.components.UIBean.end(UIBean.java:515)

org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)

org.apache.jsp.jsps.useraccount.registration_jsp._jspx_meth_s_005ftextfield_005f2(registration_jsp.java:308)

org.apache.jsp.jsps.useraccount.registration_jsp._jspx_meth_s_005fform_005f0(registration_jsp.java:154)

org.apache.jsp.jsps.useraccount.registration_jsp._jspService(registration_jsp.java:92)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)

org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)

com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)

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

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

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:237)

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

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

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:237)

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:237)

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

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

org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)

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

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

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

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

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

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

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

com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)

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

org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)

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

com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)

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

com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)

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

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

com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)

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

org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)

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

com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)

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

com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)

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

org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)


root cause 

java.lang.NullPointerException

org.apache.struts2.components.template.TemplateEngineManager.getTemplateEngine(TemplateEngineManager.java:102)
	org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:549)
	org.apache.struts2.components.UIBean.end(UIBean.java:513)

org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)

org.apache.jsp.jsps.useraccount.registration_jsp._jspx_meth_s_005ftextfield_005f2(registration_jsp.java:308)

org.apache.jsp.jsps.useraccount.registration_jsp._jspx_meth_s_005fform_005f0(registration_jsp.java:154)

org.apache.jsp.jsps.useraccount.registration_jsp._jspService(registration_jsp.java:92)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)

org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)

com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)

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

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

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:237)

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

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

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:237)

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:237)

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

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

org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)

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

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

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

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

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

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

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

com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)

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

org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)

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

com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)

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

com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)

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

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

com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)

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

org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)

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

com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)

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

com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)

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

org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)

Please help me to run the validations successfully.





--
View this message in context: http://struts.1045723.n5.nabble.com/Getting-following-exception-while-trying-validation-mechanism-in-struts2-tp5710310.html
Sent from the Struts - User mailing list archive at Nabble.com.

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


Mime
View raw message