my dog learned polymorphism*
The moose likes Struts and the fly likes org.apache.jasper.JasperException: An exception occurred processing JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "org.apache.jasper.JasperException: An exception occurred processing JSP page " Watch "org.apache.jasper.JasperException: An exception occurred processing JSP page " New topic
Author

org.apache.jasper.JasperException: An exception occurred processing JSP page

Alia Huss
Ranch Hand

Joined: Feb 13, 2009
Posts: 63
Hello!
I'm new to Struts and was doing a tutorial for connecting to a MySQL Database.

My problem is that the first jsp won't work.

Here's the code aswell as the error message:

<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Struts 2 Insert Data Application!</title>

<link href="<s:url value="/css/main.css"/>" rel="stylesheet" type="text/css"/>

</head>
<body>

<s:form action="insertData" method="POST" validate="true">

<tr>
<td colspan="2">
Please enter
</td>
</tr>

<s:actionerror />
<s:fielderror />

<s:textfield name="username" label="User Name"/>
<s:password name="password" label="Password"/>
<s:submit value="Save" align="center"/>

</s:form>
</body>
</html>


The error I get is:

org.apache.jasper.JasperException: An exception occurred processing JSP page /pages/insertData.jsp at line 6

3: <head>
4: <title>Struts 2 Insert Data Application!</title>
5:
6: <link href="<s:url value="/css/main.css"/>" rel="stylesheet" type="text/css"/>
7:
8: </head>
9: <body>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.NullPointerException
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:54)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
org.apache.jsp.pages.insertData_jsp._jspx_meth_s_005furl_005f0(insertData_jsp.java:118)
org.apache.jsp.pages.insertData_jsp._jspService(insertData_jsp.java:81)
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:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


I understand that something is wrong with either the "<link href="<s:url value="/css/main.css"/>" rel="stylesheet" type="text/css"/>" command or perhaps with the main.css itself?
Yes, the main.css is in the css folder. -smiles-

Any tips on how to fix it are highly appreciated!
Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please put your code in code tags; it's much, much easier to read.

It appears as though you're not accessing the page through an action, but instead directly accessing the URL. The use of S2 custom tags implies the presence of a value stack, which implies that they'll always be accessed through an action.

This is good design anyway; exposing JSP pages/fragments directly to users is not usually recommended when using a web app framework.
Alia Huss
Ranch Hand

Joined: Feb 13, 2009
Posts: 63
Sorry about that, I'm new to forums aswell -smiles-

I managed to fix the problem with some help from a friend.
He told me to put a filtermapping in the web.xml, and it worked.

Thank you very much for your help anyway!
Ravi Jagtap
Greenhorn

Joined: May 23, 2006
Posts: 10
Hi Alia,

I am getting the same error, could you please tell how you solved the problem and for how you added the filtermapping in web.xml


Thanks
Alia Huss
Ranch Hand

Joined: Feb 13, 2009
Posts: 63
It was a while ago, but here's a copy of my web.xml


Only works with struts2-core-2.1.3.jar or newer (I use Struts2-core-2.1.6.jar)

I hope it helps.
Alia
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

FYI, that filter is deprecated in Struts 2.1.3+; see here.
Alia Huss
Ranch Hand

Joined: Feb 13, 2009
Posts: 63
Ah, thank you, I didn't know that.
I've now changed my filter and updated the previously posted code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.apache.jasper.JasperException: An exception occurred processing JSP page
 
Similar Threads
JSF
doubleselect tag in Struts 2.1.6
can't find this error .i got this error in strut
how check javabean giving to other component correct data
i got this error in stucts???