1. #1
    Sencha User
    Join Date
    Apr 2011
    Location
    Surat, Gujarat, India
    Posts
    126
    Vote Rating
    0
    rushi2440 is on a distinguished road

      0  

    Default Unanswered: how to redirect to another jsp from java

    Unanswered: how to redirect to another jsp from java


    Hi.. sencha forum member

    I am having some problem with redirect to another jsp page from my java class.

    I am using spring 3.0, JPA and extjs 4.0.

    I am having login form which takes the username and password from the user and on server side after proper verification, I will redirect them to valid jsp page.

    I am using the below code to redirect to another jsp page

    private String LOGIN_PAGE = "../index.jsp";

    Code:
    @RequestMapping(value = "/login/GetLoginCheck.action")
    	public void sitemap (HttpServletRequest request, HttpServletResponse response)  throws Exception {
    		try {
    			System.out.println("QUERY TO GET LOGIN");
    			response.sendRedirect(LOGIN_PAGE);
    			return ;
    		} catch (Exception e) {
    			return ;
    		}
    	}
    but don't know why the jsp page didn't get opened instead I just get the requested full page to my firebug console as response as below image
    login.jpg


    so kindly please suggest me what's wrong with my above code.


    Yogendra Singh
    Sr. Programmer
    Kintudesigns.com

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,982
    Answers
    662
    Vote Rating
    453
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I am unable to see your screenshot, but are you getting the correct information back to the client from the server?

    Can you just redirect to the page send back from the server using: window.location = URL;

    Regards,
    Scott.

  3. #3
    Sencha User
    Join Date
    Feb 2010
    Posts
    125
    Answers
    7
    Vote Rating
    3
    börn is on a distinguished road

      0  

    Default


    yap unfortunately - if you submit your form - the ext form makes an ajax request and waits for a success message made by the server. If you want a standard form submit behaviour you have to set standardSubmit:true.

    Alternatively as said in the answer above you can redirect manually with "document.location.href" in the success callback function of your js-submit function (so you have to send a success-object to the client in your server's method instead of making a redirect).

  4. #4
    Sencha User
    Join Date
    Feb 2010
    Posts
    125
    Answers
    7
    Vote Rating
    3
    börn is on a distinguished road

      0  

    Default


    besides you should consider using spring-security if using spring-mvc already.

Thread Participants: 2

Tags for this Thread