Results 1 to 4 of 4

Thread: how to redirect to another jsp from java

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Apr 2011
    Location
    Surat, Gujarat, India
    Posts
    126
    Vote Rating
    0
      0  

    Default 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
    9,390
    Answers
    716
    Vote Rating
    498
      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
      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
      0  

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •