aspose file tools*
The moose likes Struts and the fly likes Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 " Watch "Struts2 " New topic
Author

Struts2

nelka perera
Greenhorn

Joined: Nov 04, 2012
Posts: 2
I want to apply field errors in my jsp page. It has <sj:autocompleter name="user">, <s:password name="password">, <s:textfield name="dname"> tags.

In my action class it implement as below for the password;

private String password;

if(password.equals("")){
addFieldError(password, getText("global.err.password.required"));
}



public String getPassword() {
return password;
}

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


In jsp page, it coded as below;

<s:if test="fieldErrors != null && fieldErrors.size > 0">
<s:fielderror>
<s:param value="%{'password'}" />
</s:fielderror>
</s:if>



But I encountered below error when I submit this jsp page.


ERROR [freemarker.runtime] (http-localhost-127.0.0.1-8080-1) : freemarker.core.InvalidReferenceException: Expression eKey is undefined on line 74, column 47 in template/simple/fielderror.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:85) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Assignment.accept(Assignment.java:90) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.MixedContent.accept(MixedContent.java:92) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:415) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.MixedContent.accept(MixedContent.java:92) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.IfBlock.accept(IfBlock.java:82) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.MixedContent.accept(MixedContent.java:92) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.MixedContent.accept(MixedContent.java:92) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.visit(Environment.java:208) [freemarker-2.3.13.jar:2.3.13]
at freemarker.core.Environment.process(Environment.java:188) [freemarker-2.3.13.jar:2.3.13]
at freemarker.template.Template.process(Template.java:237) [freemarker-2.3.13.jar:2.3.13]
at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.struts2.components.UIBean.end(UIBean.java:513) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.jsp.pages.usermanagement.manageUsers_jsp._jspx_meth_s_005ffielderror_005f0(manageUsers_jsp.java:1122)
at org.apache.jsp.pages.usermanagement.manageUsers_jsp._jspx_meth_s_005fif_005f1(manageUsers_jsp.java:1092)
at org.apache.jsp.pages.usermanagement.manageUsers_jsp._jspx_meth_s_005fform_005f0(manageUsers_jsp.java:693)
at org.apache.jsp.pages.usermanagement.manageUsers_jsp._jspService(manageUsers_jsp.java:328)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:622) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:560) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:488) [jbossweb-7.0.13.Final.jar:]
at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:159) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) [struts2-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) [xwork-core-2.2.1.jar:2.2.1]
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) [struts2-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) [struts2-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) [struts2-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) [struts2-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) [struts2-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) [struts2-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) [xwork-core-2.2.1.jar:2.2.1]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) [xwork-core-2.2.1.jar:2.2.1]
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) [struts2-core-2.2.1.jar:2.2.1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_35]


I have no idea to resolve this issue. please help.
 
 
subject: Struts2
 
Similar Threads
Deploying Web Service in JBoss7 using JAX-WS RI
java.lang.NoSuchMethodError: com.opensymphony.xwork2.util.ValueStack.findValue(Ljava/lang/String;Lja
Exception while running struts2 application.
FreeMarker template error!
FreeMarker template error