JSP implements simple user logon and displays user information, jsp user information
This example describes how to implement simple user logon and Display User Information in JSP. Share it with you for your reference. The specific implementation method is as follows:
Login. jsp
Copy codeThe Code is as follows: <% @ page language = "java" import = "java. util. *" pageEncoding = "GB18030" %>
<%
String path = request. getContextPath ();
String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/";
%>
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
</Head>
<Body>
<Form action = "login_success.jsp" method = "post">
Username: <input type = "text" name = "username"/> <br>
Password: <input type = "password" name = "password"> <br>
<Input type = "submit" value = "submit"/>
</Form>
</Body>
</Html>
Login_success.jsp is used to display user information.
Copy codeThe Code is as follows: <% @ page language = "java" import = "java. util. *" pageEncoding = "GB18030" %>
<%
String path = request. getContextPath ();
String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/";
%>
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
</Head>
<Body>
<%
String uname = request. getParameter ("username ");
String pwd = request. getParameter ("password ");
Out. println (uname );
Out. println (pwd );
%>
</Body>
</Html>
I hope this article will help you with jsp program design.