aspose file tools*
The moose likes Struts and the fly likes How to restrict direct accessing .jsp and .do in struts webapp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to restrict direct accessing .jsp and .do in struts webapp" Watch "How to restrict direct accessing .jsp and .do in struts webapp" New topic
Author

How to restrict direct accessing .jsp and .do in struts webapp

vamsi kris
Greenhorn

Joined: Feb 04, 2009
Posts: 28

Please help me

I need to restrict the user from accessing the jsp pages and .do directly ie through url and redirect him to the index page


SCJP 1.5 97%
vivek mahajan
Greenhorn

Joined: Jun 18, 2009
Posts: 22
You can use filter for that which will be monitoring for *.do pages it is the simplest and easiest way
Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
vivek mahajan wrote:You can use filter for that which will be monitoring for *.do pages it is the simplest and easiest way


More details please.

I am new to java and jsp.

vivek mahajan
Greenhorn

Joined: Jun 18, 2009
Posts: 22
Filter are special java class which get called on the mapped resource. You don't need to call them. If you have configured any filter on *.do file then firstly the filter associated with it will be called in which you can do the appropriate coding for handling the request. For more details visit this
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
I hope you are asking in such a way like there are 2 roles like "Admin" and "User"
Where user is not supposed to access all the pages.

In that case while you authenticate the person who logins into the application, keep the role in session.
And in jsp you can write logic of "IF" condition. And in condition check the role whether its User or Admin, if its user dont display the link but in Admin it has to show.

Post if you needed any brief information about this like which struts are you using and etc.....
vamsi kris
Greenhorn

Joined: Feb 04, 2009
Posts: 28

HI all,

thanks all for your support.

I am using a request processor (Controller) in struts to force login the user.
But I need to restrict the direct acess of urls as the user need to fill some data in the first page of application.
So i need to redirect the url to index page as soon as a user logged in.

can some one explain more about the filter class how to map forward to index page

Thanks a lot.
 
wood burning stoves
 
subject: How to restrict direct accessing .jsp and .do in struts webapp