• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling action without form (Struts)

 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a .jsp page that
does NOT need to be accessed by typing the
URL. I would like to make sure that a user is logged in.
Once the user has been deemed invalid,I want to forward
it to the login page.

I do the following:


But using the response.sendRedirect(..), seems not to work.

Is there any other way to accomplish that?

Thanks

Zak
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34198
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zak,
In your example, response.redirect() is commented out. I assume it is uncommented when you try it. What error did it give you?
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please post your error message for more detail in this problem.
 
prabhat kumar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Zak Nixon:
I do the following:


But using the response.sendRedirect(..), seems not to work.

Is there any other way to accomplish that?
Zak[/QB]


it can be done like this:
declare a global forward like this in struts config;

<global-forwards>
<forward name="login" path="/Login.do"/>

Login.do has an entry under action mappings
<action-mappings>
<action path="/Login" forward="/admin/login.jsp" type="org.apache.struts.actions.ForwardAction"/>

you may declare actions mappings to suit your needs.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic