Jsp Form Frame : Form Frame « JSP « Java






Jsp Form Frame

//File: index.html
<HTML>
    <HEAD>
    </HEAD>

    <BODY>
        <FORM NAME="form1" ACTION="formAction.jsp" TARGET="frame2" METHOD="POST">
            <CENTER>
                <H1>The JSP Calculator</H1>
                <INPUT TYPE="TEXT" NAME="op1" VALUE="">
                <BR>
                +
                <BR>
                <INPUT TYPE="TEXT" NAME="op2" VALUE="">
                <BR>
                <INPUT TYPE="SUBMIT" VALUE="&nbsp;&nbsp;=&nbsp;&nbsp;">
            </CENTER>
        </FORM>
    </BODY>
</HTML>


//////////////////////////////////////////////////////////
File: formAction.jsp

<HTML>
    <HEAD>
    </HEAD>

    <BODY>
        <H2>
            <CENTER>
                The sum is:
                <% 
                out.println(Integer.parseInt(request.getParameter("op1")) + 
                    Integer.parseInt(request.getParameter("op2")));
                %>
            </CENTER>
        </H2>
    </BODY>
</HTML>

           
       








JspFormFrame.zip( 89 k)

Related examples in the same category