• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting org.apache.jasper.JasperException in Struts2

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Access it through an action.
 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, I'm not convinced the subject of this thread is really accurate or helpful.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic