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 Getting org.apache.jasper.JasperException in Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting org.apache.jasper.JasperException in Struts2" Watch "Getting org.apache.jasper.JasperException in Struts2" New topic
Author

Getting org.apache.jasper.JasperException in Struts2

Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi All,

I am new to Struts. When i run my Struts2 application i am getting below exception.




I am able to figure out that its related to dispatcher but i do not know how to get it resolved.
Please help me.

Thanks in Advance.
Jay Shukla
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Looks like you're accessing a JSP page with Struts 2 tags in it directly (as opposed to running through an action).
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi David,

Thanks for reply.

I am using Struts Black Book and in that a starting application is given in which index.jsp page is there which makes use of struts 2 tags.

Below is the index.jsp page.

index.jsp
=======



I the above approach (directly accessing jsp with struts tags in it) is not correct, Could you let me know what needs to be done to correct it?

Thanks in Advance.
Jay Shukla
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Access it through an action.
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi David,

Thanks for your valuable reply.

I am new to Struts. could you give me any reference snippets (Tutorial) so i can take reference and access this jsp through an action.


Thanks in Advance.
Jay Shukla.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Normally, you have a Struts 2 action which is associated with one or more view-layer pages (JSPs normally, but can be other view-layer technology as well) which are applied using <result ...> elements in the struts.xml file (or via annotations, if you're using them). These result view pages can use struts tags.

In the above case, the user will browse to the action, not the JSP page. The action will perform its work, then forward to the view-layer (JSP) page.
The user would never browse directly to the view-layer page. This is how Struts 2 enforces the MVC (Model/View/Controller) design pattern.

One way to make sure this is followed is by placing the Struts 2 view-layer pages under WEB-INF somewhere. Then they can't be served independently.

Of course, your application can still have JSP pages that are not used as views for Struts 2 actions, they just can't use any Struts tags.

Does that help?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Also, I'm not convinced the subject of this thread is really accurate or helpful.
 
jQuery in Action, 2nd edition
 
subject: Getting org.apache.jasper.JasperException in Struts2