File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Exception while running Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Exception while running Struts" Watch "Exception while running Struts" New topic
Author

Exception while running Struts

Ashok
Greenhorn

Joined: Sep 24, 2008
Posts: 3
Hi I am very new to Struts and trying to run a simple struts programme.While running the JSP(test_struts_jsp.jsp) I am getting the following error at the browser(Internet Explorer)
org.apache.jasper.JasperException: Exception in JSP: /jsp/test_struts_jsp.jsp:7

4: <html>
5: <title> Testing a struts application </title>
6: <h1>Struts application</h1>
7: <html:form method="POST" action="/sprt001">
8: <html:text name='fprt001' property='firstname' maxlength='8' size='12'>
9: </html:text>
10:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.jsp.test_005fstruts_005fjsp_jsp._jspService(test_005fstruts_005fjsp_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


java.lang.NoClassDefFoundError
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:141)
org.apache.jsp.jsp.test_005fstruts_005fjsp_jsp._jspx_meth_html_form_0(test_005fstruts_005fjsp_jsp.java:91)
org.apache.jsp.jsp.test_005fstruts_005fjsp_jsp._jspService(test_005fstruts_005fjsp_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)



my jsp(test_struts_jsp.jsp) is

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<title> Testing a struts application </title>
<h1>Struts application</h1>
<html:form method="POST" action="/sprt001">
<html:text name='fprt001' property='firstname' maxlength='8' size='12'>
</html:text>

<html:text name='fprt001' property='lastname' maxlength='8' size='12'>
</html:text>


</html:form>


</html>


struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>

<!-- ========== Data Source Configuration =============================== -->
<data-sources />

<!-- ========== Form Bean Definitions ================================== -->
<form-beans>

<!-- ========== Form Bean Definitions for MST module================= -->
<form-bean name="fprt001" type="com.myproject.actionform.FPRT001">
</form-bean>
</form-beans>
<!-- ========== Action Mapping Definitions =============================== -->
<action-mappings>

<action path="/sprt001" type="com.myproject.action.APRT001" parameter="onload" name="fprt001" validate="false" scope="request">
<forward name="success" path="/sprt001">
</forward>
<forward name="failure" path="/sprt001">
</forward>
</action>
</action-mappings>


<!-- ========== Controller Configuration ================================ -->

<controller
bufferSize="4096"
contentType="text/html;charset=UTF-8"
debug="1"
locale="true"
maxFileSize="250M"
multipartClass="org.apache.struts.upload.CommonsMultipartRequestHandler"
nocache="true"
processorClass="org.apache.struts.action.RequestProcessor"
inputForward="false" />



</struts-config>




web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/do/*</url-pattern>
</servlet-mapping>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>



</web-app>

I am using JBoss server..
Can anyone please help..
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
I don't think you have the correct URIs for the struts tab libraries. I use struts 1.2.7 and the taglib URIs I use are:



However I think some versions of struts use a different URI, so if it doesn't work let us know what version of struts you're on.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Jjava Jjava,

Please check your private messages for a message regarding an important administrative matter. You can do so by clicking My Private Messages in the upper right corner of the page.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception while running Struts
 
Similar Threads
JspException: Cannot find ActionMappings or ActionFormBeans
Client side form validation not working
Missing message for key
help on taglib and properties file in struts?
Cannot find ActionMappings or ActionFormBeans