It is a Struts 2 MVC Project.I added jar file struts2-dojo-plugin-2.1.2
Error :
HTTP Status 500 - An exception occurred processing JSP page /index.jsp at line 22
exception
19: <s:textfield name="name" label="UserName"></s:textfield>
20: <s:textfield name="email" label="Emai ID"></s:textfield>
21: <s:password name="password" label="Password"> </s:password>
22: <d:submit validate="true" type="image" src="register-now.jpg"> </d:submit>
23: </s:form>
24: </body>
25: </html>
I cannot ditect the problem. Please help me or any idea?
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:426)
root cause
Related
So I have a form created with Spring MVC tags and it looks like this
<form:form action="/languages" method="post" modelAttribute="language">
<p>
<form:label path="name">Name</form:label>
<form:errors path="name"/>
<form:input type="text" path="name"/>
</p>
<p>
<form:label path="creator">Creator</form:label>
<form:errors path="creator"/>
<form:input type="text" path="creator"/>
</p>
<p>
<form:label path="currentVersion">Version</form:label>
<form:errors path="currentVersion"/>
<form:input type="number" path="currentVersion"/>
</p>
<input type="submit" value="Submit"/>
</form:form>
The problem is that it is only showing the labels for the form and not the input where a user can enter things. Am I missing something here? I'm pretty new to Spring boot and Spring MVC tags so im not sure what's the problem.
I figured it out. I forgot to add
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
to the jsp file.
I work with Eclipse Juno, Spring 3.2.6.RELEASE, Weblogic 10.3.6.
I have the following jsp
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%# taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<form:form id="create-survey" method="POST" action="/eusurvey/noform/management/createNewSurvey" style="display: none">
<input type="hidden" name="shortname" id="create-survey-shortname" value="" />
<input type="hidden" name="uuid" id="create-survey-uuid" value="" />
<input type="hidden" name="original" id="create-survey-original" value="" />
<input type="hidden" name="security" id="create-survey-security" value="" />
<input type="hidden" name="audience" id="create-survey-audience" value="" />
<input type="hidden" name="surveylanguage" id="create-survey-language" value="" />
<textarea style="display: none;" name="title" id="create-survey-title"></textarea>
<input type="hidden" name="listform" id="create-survey-listform" value="" />
<input type="hidden" name="contact" id="create-survey-contact" value="" />
<input type="hidden" name="contactlabel" id="create-survey-contact-label" value="" />
</form:form>
When I execute the application, I get the error:
weblogic.servlet.jsp.CompilationException: Failed to compile JSP /WEB-INF
/views/auth/tos.jsp
tos.jsp:79:21: Error in "menu.jsp" at line 358: The method
setDynamicAttribute(null, String, String) is undefined for the type FormTag
<%# include file="../menu.jsp" %>
^-----------^
at weblogic.servlet.jsp.JavelinxJSPStub.reportCompilationErrorIfNeccessary(JavelinxJSPStub.java:226)
at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:162)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:256)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:216)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:244)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:327)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
What does this error mean?. What are dynamic attributes?
It looks to be a classloading issue between your Spring and the one bundled into JRF.
Similar questions:
Weblogic 10.3 issues with spring 3.1.0 jsp compilation
Weblogic 10.3.5 Overriding Spring Version
It looks the quicker solution is to filter with prefer-web-inf-classes tag at weblogic.xml
org.apache.jasper.JasperException: An exception occurred processing JSP page /person.jsp at line
</c:if>
<tr> <td> <form:label path="name">
<spring:message text="Name"/>
</form:label></td>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:574)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:471)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
I am using Spring Boot with web mvc tiles. Also using Bootsrap CSS for front end
I have a main layout page named basic.jsp as
<%# taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<html>
<head>
<title><tiles:getAsString name="title" /></title>
</head>
<body>
<!-- Header -->
<tiles:insertAttribute name="header" />
<!-- Body -->
<tiles:insertAttribute name="body" />
<!-- Footer -->
<tiles:insertAttribute name="footer" />
</body>
</html>
and the tiles.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<!-- Templates -->
<definition name="layout.basic" template="/pages/layout/basic.jsp">
<put-attribute name="header" value="/pages/jsps/header.jsp" />
<put-attribute name="leftmenu" value="/pages/jsps/lmenu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/pages/jsps/footer.jsp" />
</definition>
<!-- Pages -->
<definition name="home" extends="layout.basic">
<put-attribute name="body" value="/WEB-INF/tiles/view/home/home.jsp" />
</definition>
<definition name="greet" extends="layout.basic">
<put-attribute name="body" value="/WEB-INF/tiles/view/home/register.jsp" />
</definition>
</tiles-definitions>
I want to include the spring form taglib in my register.jsp
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<div>
<div class="col-md-9 personal-info">
<form:form method="POST" id="frm" class="form-horizontal" role="form" commandName="box" action="Register">
<div class="form-group">
<label class="col-lg-3 control-label">Box Id:</label>
<div class="col-lg-8">
<form:input class="form-control" path="strBoxId" type="text" placeholder="Box Id"></form:input>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Box Name:</label>
<div class="col-lg-8">
<form:input class="form-control" type="text" path="strBoxName" value="" placeholder="Box Name"></form:input>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Address:</label>
<div class="col-lg-8">
<form:textarea class="form-control" placeholder="Address" path="strAddress"></form:textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input type="submit" class="btn btn-primary" id="register" value="Register" onclick="callMe()">
<span></span>
<input type="reset" class="btn btn-default" value="Cancel">
</div>
</div>
</form:form>
</div>
</div>
When I am running the application without including the taglib it is displaying the form, but when I am including the taglib in register.jsp, It is throwing error in cosole as well as Whitelabel Error Page in browser. Th error displayed is
2015-03-05 15:23:45.296 ERROR 8056 --- [nio-8080-exec-8] o.a.c.c.C.[. [localhost].[/].[jsp] : Servlet.service() for servlet jsp threw exception
java.util.NoSuchElementException: null
at java.util.ArrayList$Itr.next(Unknown Source)
at org.apache.jasper.compiler.Validator$ValidateVisitor.getJspAttribute(Validator.java:1385)
at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1262)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:876)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1538)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2429)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:895)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1538)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2429)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2435)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:474)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1841)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:688)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:682)
at org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123)
at org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)
at org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
at org.apache.jsp.pages.layout.basic_jsp._jspx_meth_tiles_005finsertAttribute_005f2(basic_jsp.java:198)
at org.apache.jsp.pages.layout.basic_jsp._jspService(basic_jsp.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:114)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:8 37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1720)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
I don't know where it went wrong. Kindly help :(
Oh God!!! I wasted 3 hours in finding the solution. Thanks to the reply from 'guido' Spring boot taglibs
I just changed my spring boot version to 1.2.2.RELEASE and it worked !!!
I am trying to rename all my JSP files used in WebFlow2 to JSPX.
I go in to my STS project and rename the files to JSPX from JSP then I change the defaultViewSuffix in my flow.xml
[CODE]<bean id="mvcViewFactoryCreator" class=
"org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="defaultViewSuffix" value=".jspx" />
</bean>[/CODE]
this is the error:
[CODE]SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /WEB-INF/flows/helloworld/helloworld.jspx (line: 1, column: 2) The markup in the document preceding the root element must be well-formed.
[/CODE]
this is my helloworld.jspx
[CODE]<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
<title>Spring 3.0 MVC - Web Flow Example</title>
</head>
<body>
<h2>Customer Registration</h2>
<form:form commandName="customer">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<table>
<tr><td>
<font color=red><form:errors path="name" /></font><b>Name: </b>
</td><td>
<form:input path="name"/><br/><p>
</td></tr><tr><td>
<font color=red><form:errors path="phoneNumber" /></font>
<b>Phone number: </b></td><td><form:input path="phoneNumber"/><br/>
</td></tr><tr><td>
<font color=red><form:errors path="address" /></font>
<b>Address: </b></td><td><form:input path="address"/><br/>
</td></tr><tr><td>
<font color=red><form:errors path="city" /></font>
<b>City: </b></td><td><form:input path="city"/><br/>
</td></tr><tr><td>
<font color=red><form:errors path="state" /></font>
<b>State: </b></td><td><form:input path="state"/><br/>
</td></tr><tr><td>
<font color=red><form:errors path="zipCode" /></font>
<b>Zip Code: </b>
</td><td>
<form:input path="zipCode"/><br/>
</td></tr>
</table>
<input type="submit" name="_eventId_submit" value="Submit" />
<input type="submit" name="_eventId_cancel" value="Cancel" />
</form:form>
</body>
</html>[/CODE]
The syntax for JSPX files (JSPs with the XML syntax) is not the same as for JSP files (JSPs with the traditional syntax). See http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPX3.html for details and examples.