• 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

MVC: Controller Servlet forwarding without login

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,

How can I deny a Servlet forwarding if this component should be protected by a login form? I mean, I have a jsp which is denied in the web.xml. If I call the jsp by link, the login form will be displayed - that works. However, if I call the jsp by my Controller Servlet, I get the jsp without any login-form...

Does anyone has a solution?

My web.xml:



My Controller-Servlet:


[ December 03, 2008: Message edited by: Michael Knaus ]
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put "else" part in the Controller servlet and have a target(different page) there to be forwarded if the choice is not equal to 'profil'. Is this solve your problem?
 
Michael Knaus
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The default target is already index.jsp. So, target = "myprofil.jsp"; would be just set if the choice is "profil". I don't want to check the user in my Servlet by request.isUserInRole("user") to forward. I'm just looking for a declartive way in the web.xml.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so, where you are setting the value for choice?

 
Michael Knaus
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in my index.jsp:



or another way per post button:



edit, and in my servlet per:


[ December 03, 2008: Message edited by: Michael Knaus ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Knaus:
in my index.jsp:




it will work


or another way per post button:



it wont work ... here you are not passing the value for choice. use hidden field
 
Michael Knaus
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
both examples will put me through to the myprofil.jsp! But without any login-form. In this case:

<a href="adressadmin/myprofil">profil</a><br />

I will get the login-form. But thats not what I want :/
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic