This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes logic for display JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "logic for display JSP page" Watch "logic for display JSP page" New topic
Author

logic for display JSP page

Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
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


SCJP, SCJD
Preparing for SCWCD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

javax.servlet.Filter


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
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

Joined: Jan 10, 2002
Posts: 60046
    
  65

No. One filter can handle it all.
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
I am using struts1.3 . this filter mechanisum can work in struts1.3?
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
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

Joined: Mar 05, 2007
Posts: 106
Thanks Stefan Evans

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

Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: logic for display JSP page
 
Similar Threads
Retrieve current Login ID
accessing Servlet Context Path from servlet filter
I need help on developing login/logout application using struts2 frame work
Logoff problem
authenticat user with j_security_check