Struts Tutorial Home

Struts Home

JSP Resources

Community

Site

(4) Input.jsp File


<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
<html:html>
    <html:form
action="/submitInput.do" method="post"
>
    <table>
<tr>
    <td colspan="2">
                <logic:messagesPresent>
                    <html:messages
id="msg"
>
            <p>
                    <strong><font
color="red"><bean:write name="msg"
/></font></strong>
            </p>
                    </html:messages>
                </logic:messagesPresent>
    </td>
</tr>
<tr>
    <td
colspan="2"
>
        <logic:messagesPresent
message="true"
>
            <html:messages
message="true" id="msg"
>
        <p>
            <strong><bean:write
name="msg"
/></strong>
        </p>
            </html:messages>
        </logic:messagesPresent>
    </td>
</tr>
        <tr><td>
Enter the name
</td>
        <td><html:text
property="name"
/></td></tr>
        <tr><td>
Enter the Phone
</td>
        <td> <html:text
property="phone"
/></td></tr>
        <tr><td>
Enter the Email
</td>
        <td><html:text
property="email"
/></td></tr>
        </table><html:submit>
Submit
</html:submit>
    </html:form>


</html:html>


(5) Regsiter.jsp File


<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
<html:html>
    <html:form
action="/submitRegister.do" method="post"
>
    <table>
<tr>
    <td colspan="2">
                <logic:messagesPresent>
                    <html:messages
id="msg"
>
            <p>
                    <strong><font
color="red"><bean:write name="msg"
/></font></strong>
            </p>
                    </html:messages>
                </logic:messagesPresent>
    </td>
</tr>
<tr>
    <td
colspan="2"
>
        <logic:messagesPresent
message="true"
>
            <html:messages
message="true" id="msg"
>
        <p>
            <strong><bean:write
name="msg"
/></strong>
        </p>
            </html:messages>
        </logic:messagesPresent>
    </td>
</tr>
        <tr><td>
Enter the name
</td>
        <td><html:text
property="name"
/></td></tr>
        <tr><td>
Enter the Phone
</td>
        <td> <html:text
property="phone"
/></td></tr>
        <tr><td>
Enter the Email
</td>
        <td><html:text
property="email"
/></td></tr>
        <tr><td> Enter the Address </td>
        <td><html:text property="
address
" /></td></tr>
        <tr><td> Enter the Marks </td>
        <td><html:text property="marks" /></td></tr>
        </table><html:submit>Submit
</html:submit>
    </html:form>


</html:html>


(6) Output


Note:- When user submits the Register form and calls the submitRegister.do action then automatically the control calls the submitRegisterAction class and prints " Called SubmitRegisterAction file " and same as for the submitInput.do calls the submitInputAction class and prints "Called SubmitInputAction file " on the console.

                    

Copyright © 2010 VisualBuilder. All rights reserved