• 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

all of jsp files to be passed to an action class

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Struts. I have some confusion.

If I want all of jsp files to be passed to an action class, how could do that ?

for example, if user type http://localhost/myapp/index.jsp, this jsp page request will go to an action class. how could I do this?

This is a good design ?

Thanks
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The point of an MVC framework such as Struts is that all requests in an application should be made through a central control. In the case of Struts, an instance of ActionServlet serves as the control, therefore all requests should be made through the ActionServlet. By going to specific JSPs individually as you have suggested, you are defeating the purpose of MVC and instead are introducing a page-centric design.

So in general, you should never have a user access any part of your application by going to a specific JSP. One exception to this is index.jsp, which should itself forward to some Action in your Struts application (possibly through the use of <logic:forward>. Even if a particular view that you wish to present is static content that requires no setup in an Action class, you should at least use a ForwardAction as opposed to linking directly to the static content.
 
reply
    Bookmark Topic Watch Topic
  • New Topic