0

I have created application in two versions. For personal and mobile browsers.

Simply, client logins on page login.jsp. Then authorization took place in the servlet.java( auto.jsp). IF authorization was correct, the client were moving on page dane.jsp, otherwise were moving him on page login.jsp.

Unfortunately, forwarding in first and second version, dosen't work in 100%. After good authorization, client see content of page dane.jsp but he still was on page auto.jsp. For personal browser I have changed method from request.getRequestDispatcher("dane.jsp").forward (request, response); to response.sendRedirect("dane.jsp"); and it worked. But I don't have idea for mobile edition.

will sb save me?

Robbert
  • 6,481
  • 5
  • 35
  • 61
user3557849
  • 55
  • 3
  • 8
  • Welcome to SO. When posting questions about your code, please share what you've written so that we can see what may be causing the problem. – Robbert Apr 21 '14 at 20:40

1 Answers1

0

You can check user-agent type and redirect accordingly by having if..else.. loop on serverside before serving jsp page.

Pls check this link for more information.

Community
  • 1
  • 1
Meet Mehta
  • 4,839
  • 3
  • 20
  • 27
  • I did it. i used script form this page : http://detectmobilebrowsers.com/. In mobile version, after successful login user see content of dane.jsp but the adddress bar still shows ...auto.jsp and not dane.jsp – user3557849 Apr 21 '14 at 20:34
  • instead of requestDispatcher, use response.sendRedirect(request.getContextPath() + "/dane.jsp"); – Meet Mehta Apr 21 '14 at 20:55
  • @user3557849: sorry no idea for that. It worked for me though. Try giving absolute path instead of "request.getContextPath()" – Meet Mehta Apr 21 '14 at 22:17