我如何在我的示例中使用struts1中的普通html表单标记

时间:2013-09-06 03:52:49

标签: java struts1

<form id="login" action="Login.do" method="post" >
            <h1 id="ff-proof" class="ribbon">Rao & Siddhi &nbsp;&nbsp;</h1>
            <div class="apple">
                <div class="top"><span></span></div>
                <div class="butt"><span></span></div>
                <div class="bite"></div>
            </div>
            <fieldset id="inputs">
                <input id="username" type="text" onblur="if(this.value=='')this.value='User ID';" onfocus="if(this.value=='User ID')this.value='';" value="User ID" />
                <input id="password" type="password" onblur="if(this.value=='')this.value='Password';" onfocus="if(this.value=='Password')this.value='';" value="Password" />
            </fieldset>
            <fieldset id="actions"> 
                <input type="submit" id="submit" value="Login Here"/>
                <p class="option"><a href="#">Forget Password</a>&nbsp;&nbsp;|<a href="#">Registration</a></p>
            </fieldset>
    </form>


   <action-mappings>
    <action input="/JSP/Login.jsp" name="LoginBean" path="/Login"  scope="request"                                                type="com.action.LoginAction">
        <forward name="success" path="/JSP/success.jsp"/>
         <forward name="success" path="/JSP/Error.jsp"/>
    </action>

但它无法正常工作如何在setter getter方法中设置值

如何调用动作pojo类,我应该在表单动作标签中传递什么来调用动作类,任何人都帮助我plz

1 个答案:

答案 0 :(得分:0)

保持您的表单标记:

<form id="login" action="/Login.do" method="post" name="LoginBean" >..</form>

你的行动映射:

<action-mappings>
    <action input="/" name="LoginBean" path="/Login"  scope="request" type="com.action.LoginAction">
        <forward name="success" path="/JSP/success.jsp"/>
         <forward name="success" path="/JSP/Error.jsp"/>
    </action>
</action-mappings>