File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use Servlet Filter in Struts Framework

 
Mark Henryson
Ranch Hand
Posts: 200
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic