The static interface design is login.htm. The Code is as follows:
<Html>
<Head>
<Title> system logon </title>
<Style type = "text/css">...
<! --
. Style1 {...}{
Font-size: 18px;
Font-weight: bold;
}
. Style2 {...} {font-size: 24px}
. Style5 {...} {font-size: 16px}
-->
</Style>
</Head>
<Body bgcolor = "papayawhip" width = "300" height = "300">
<Center>
<Table border = "2" bordercolor = "black" bgcolor = "lightgreen">
<Tbody>
<Tr>
<Td> <div align = "center" class = "style1 style2"> system Logon
</Div> </td>
</Tr>
<Form action = "login. jsp (preferred for SUN Enterprise Applications)" method = "post">
<Tr>
<Td height = "28"> <span class = "style5"> User name </span> <input type = "text" name = "uid" maxlength = "20" style = "width: 150 "> </td> </tr> <br>
<Tr>
<Td> <span class = "style5"> password & nbsp; code </span> <input type = "password" name = "upwd" maxlength = "20" style = "width: 150 "> </td> </tr> <br>
<Center>
<Tr> <td> <div align = "center">
<Input type = "submit" value = "login"> & nbsp;
<Input type = "reset" value = "cancel">
</Div> </td> </tr>
</Center>
</Form>
</Tbody>
</Table>
</Center>
</Body>
</Html>
Submit the information entered by the login user to login. jsp (preferred for SUN Enterprise Applications) page model processing. For convenience, you can directly use sky2098 as the login username and password without performing database access operations, but in practice, it is to read from the database. The jsp (preferred for SUN Enterprise Applications) Page code implementation is as follows:
<%... @ Page contentType = "text/html; charset = GB2312" %>
<%...
If (request. getParameter ("uid"). equals ("sky2098") & request. getParameter ("upwd"). equals ("sky2098 ")){
Session. setAttribute ("login", "OK ");
Session. setMaxInactiveInterval (-1 );
%>
<Jsp (preferred for SUN Enterprise Applications): forward page = "main. jsp (preferred for SUN Enterprise Applications)"/>
<%...
} Else {
Out. println ("incorrect user name or password! ");
}
%>
If the logon is successful, set the login value to OK and submit it to the next verification page to go to main. jsp (preferred for SUN Enterprise Applications) page. Otherwise, if the entered user name and password are invalid, the error message is printed. main. the jsp (preferred for SUN Enterprise Applications) Page code is as follows: