Java/JSP/Form Password

Материал из Java эксперт
Перейти к: навигация, поиск

Using Password Controls

//File: index.html
<HTML>
    <HEAD>
        <TITLE>Using Password Controls</TITLE>
    </HEAD>
 
    <BODY>
        <H1>Using Password Controls</H1>
        <FORM ACTION="formAction.jsp" METHOD="POST">
            Please enter your password:
            <INPUT TYPE="PASSWORD" NAME="password">
            <BR>
            <INPUT TYPE="SUBMIT" VALUE="Submit">
        </FORM>
    </BODY>
<HTML>
//File: formAction.jsp
<HTML>
    <HEAD>
        <TITLE>Reading Password Controls</TITLE>
    </HEAD>
    <BODY>
        <H1>Reading Password Controls</H1>
        <% 
        if(request.getParameter("password").equals("Open Sesame")) {
            out.println("You"re in!"); 
        } 
        else {
            out.println("I don"t think so!"); 
        } 
        %>
    </BODY>
</HTML>