• 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

How to use Servlet Filter in Struts Framework

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing a web application with Struts 1.3.10.
I have placed all the jsp files inside the WEB-INF folder.
Then only realised the problem of not able to access it directly.
So I have decided to move it outside the WEB-INF and but still I want the jsp not to be accessed directly.
So I have decided to use Servlet Filter to restrict it and can use it for security purpose also.

Now I have two questions:

1. Placing the jsp files outside the WEB-INF folder:

How to implement the Filter with Struts?

I have written a sample filter and configured it in web.xml



web.xml


When I am invoking the below url: http://127.0.0.1:8080/Struts/reg.do, filter is not invoking and it goes to the actionservlet alone.
Whether any specific configuration setting is there for using Filter in Struts?

2. Placing the jsp files inside the WEB-INF folder:

I know we can't directly access the jsp files. But through the servlet we can get it. If suppose I am keeping the jsp files of header.jsp, footer.jsp and menu.jsp and I am trying to use frame for it. How can we get those pages?
 
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
If you don't want to be able to access the JSP files directly then why move them out of WEB-INF?!
 
Mark Henryson
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:If you don't want to be able to access the JSP files directly then why move them out of WEB-INF?!



Ok. Then please suggest me how to access the jsp files inside the WEB-INF folder?
Tell me how to refer the jsp page in the following?
 
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
Oh; if you're going to access *some* files outside of the framework then you'll either have to move those particular ones out of WEB-INF or access them via an action. You could also use a mechanism that loads those pages from the server side, like Tiles.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic