Load new page when succesfully logged in "JSP java" -


We created a login page, where the user can enter a username and password, while clicking on the login, When clicking on the "Nominated" button you can use some advice about loading a new page.

My code is now from "validatelogin"

  & lt;% @ page language = "java" contentType = "Text / html; charset = ISO-8859-1" page encoding = "ISO-8859-1" import = "Java.O., Java.uppress. *"% "& Lt ;! DOCTYPE HTML PUBLIC" - / / W3C // DTD HTML 4.01 transcription // n "" http://www.w3.org/TR/html4/loose.dtd">" gt;  gt; top & gt; & lt; Meta http-equiv = "content-type" content = "text / html; Charset = ISO-885 9 -1 "& gt; & gt; title & gt; insert the title here & lt; / title & gt; & lt; / head & gt; & lt; body & gt; & lt;% String UID, pass; Uid = request.getParameter ("userid"); pass = request.getParameter ("password"); if ("mk 123". Amends (uid) and amp; amp; amp ; 1234 & amp; nbsp;; equal (pass)) {// SLT Attitant "Login Inn" session session. Settet ("Login", "Yes"); out.println ("You have successfully logged in & lt ; Br & gt; "); // string site = new string (" http: // localhost: 8080 / CDIO3 _-_ gruppe17 / ScaleWeb.jsp ") again New location to be directed; Response.setHeader ("location", site);} other {// fjern attributten "logget ind" fra sessionen session.removeAttribute ("log in"); out.println ("incorrect user id or Password. & Lt; br & gt; ");}% & Gt; enter & lt; a href =" ScaleWeb.jsp "& gt; Protected page & lt; / a & gt; or & lt; a href = "Login. Jsp "& gt; Back to page & lt; / a & gt; & lt; / body & gt; & lt; / html & gt;   

But it does not really work properly.

I think that you have PHP Because you are setting the header response.setHeader (instead of "location", site); :

  response.sendRedirect (site); return ;   

Just setting the location header does not work with JSP.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -