html - Redirect to the same page but with a message in it -


I am creating a login page in JSP. I have a index.jsp page, where there is a present form and some javascript writers. In the database, check for username and password in check1.jsp file

My issue is after entering the user name and password, when I Pressing the login button, I have check1.jsp linked to the form, if the user matches the username and password and exists, then it is welcome.jsp Redirects to, but if the username does not exist or the password is found If not, then I'm returning a small message under the index.jsp box that the username is not present or the password does not match , currently I only Redirected to index.jsp .

How should I show the appropriate small message below the login box on the same index.jsp page ??

You can use the object here:

in check1 .jsp :

  redirect (loginSuccess) to {// welcome.jsp} {session.setAttribute ("error", "username or password is incorrect") ; // index.jsp}  index.jsp :  
  string msg = session.getAttribute ("error"); If (msg! = Null) {%> gt; & Gt; Style = "color: red" & gt; & Lt;% = msg% & gt; & Lt; / P & gt; Apart from this, there are more simple methods available with EL and JSTL, but this is for an initial tip.   

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -