wood burning stoves 2.0*
The moose likes Struts and the fly likes Calling action without form (Struts) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Calling action without form (Struts)" Watch "Calling action without form (Struts)" New topic
Author

Calling action without form (Struts)

Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

Zak,
In your example, response.redirect() is commented out. I assume it is uncommented when you try it. What error did it give you?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
please post your error message for more detail in this problem.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
prabhat kumar
Ranch Hand

Joined: Apr 11, 2001
Posts: 114
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling action without form (Struts)
 
Similar Threads
Struts redirect tag
Session problem
IllegalStateException when redirecting the response...
Referring Page in Struts
session handling problem