Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: java servlet- want to redirect to custoem URL

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java servlet- want to redirect to custoem URL

    hi , can anybody help me !

    I am java beginner ( very new).

    I have website http://mywebsite.com ( html site) and java webpages in http://mywebsite.com/app/index.jsp ( which is user login page)

    when I login with user credintials i can see logout (http://mywebsite.com/app/Logout.do) option on right corner when i click on it it is redirecting to again login page . i found that /apps/WEB_INF/LogoutAction class is responsible for this redirection .

    Now i want to change the code to redirect it to my html homepage http://mywebsite.com after clicking on logout

    LogoutAction.java file is below , please suggest me the appropriate changes for this .




    package logout;

    import javax.servlet.http.*;
    import org.apache.struts.action.*;

    public class LogoutAction extends Action
    {

    public LogoutAction()
    {
    }

    public ActionForward execute(ActionMapping p_mapping, ActionForm p_form, HttpServletRequest p_request, HttpServletResponse p_response)
    {
    String target = "login";
    p_request.getSession(true).invalidate();
    return p_mapping.findForward(target);
    }
    }


    Thank you


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,355
    Thanks
    182
    Thanked 833 Times in 776 Posts
    Blog Entries
    5

    Default Re: java servlet- want to redirect to custoem URL

    Thread moved from What's wrong with my code

    This thread has been cross posted here:

    http://www.java-forums.org/advanced-java/63176-java-servlet-redirecting-url.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


Similar Threads

  1. HOW TO REDIRECT TO LOGIN PAGE IF NOT LOGGED IN
    By divyatejak in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: March 6th, 2012, 05:19 AM
  2. Follow redirect Link
    By jalalirs in forum Java Networking
    Replies: 2
    Last Post: October 10th, 2011, 08:58 AM
  3. Problem in Servlet redirect
    By surendran610 in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: August 17th, 2011, 01:15 PM
  4. [SOLVED] Redirect command prompt output to log file.
    By goldest in forum File I/O & Other I/O Streams
    Replies: 9
    Last Post: November 24th, 2010, 05:26 AM
  5. Redirect error and output stream using java program
    By leenabora in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: June 16th, 2009, 05:12 AM

Tags for this Thread