Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MVC: Controller Servlet forwarding without login

 
Michael Knaus
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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 ]
 
Vijitha Kumara
Bartender
Pie
Posts: 3918
10
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • 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
  • 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 Java Windows XP
  • Mark post as helpful
  • send pies
  • 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
  • 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 :/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic