Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic for display JSP page

 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to display JSP page after user login. If user click on application button before login i want to dispaly login page otherwise application page.

How I can do it?

Thanks

Vaishali
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.servlet.Filter
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean I have to write write class which implements filter interface and check it session has authorised user or not if yes then redirect to jsp page otherwise login page. is this correct?

If I have 2-3 JSP then do I have to write filter for each.
In my project have following options
New Temparary phone connection
New Paramanant phone connection
Phone Transfer


I need to write separate filter class for above each option right?

I am using struts1.3 . this filter mechanisum can work in struts1.3?


Thanks for help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. One filter can handle it all.
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using struts1.3 . this filter mechanisum can work in struts1.3?
 
Stefan Evans
Bartender
Pie
Posts: 1670
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The filter mechanism is part of the servlet spec, and can be used with any framework build on top of it.
In other words... yes - it can be used with struts 2.

For another option: rather than re-inventing the wheel, you could take advantage of standard web application security.

Check out the tutorial at http://download.oracle.com/javaee/5/tutorial/doc/bncat.html
Tomcat specific link: http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html

Basically it would involve
- declaring which sections of your website are secure in your web.xml file
- creating a login page with a form that invokes j_security_check

The standard forms implementation doesn't give you quite as much control as a custom solution would, but it is much quicker to implement, and you are less likely to get it wrong :-)
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan Evans

I will read about it and ask you if i have any query.

Thanks again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic