一,使用
1,先在开头加上这行代码:
<%@ taglib prefix="s" uri="/struts-tags" %>
2,然后我们就可以用<s:form>了:
<s:form action="/gsdaction" method="post"> <div class="bd_f1"> <input id="phone" type="text" name="phone" class="bdf1_l"/> </div> <div> <input type="submit" value="查 询" class="button_s3" /> </div> </s:form>
二,注意
1,<s:form>表单中的action属性不用写茫茫长的路径,因为struts2会自动匹配命名空间下的gsdaction。还有就是非<s:form>表单的文本域写法也能通过<s:form>提交到后台!
2,由于使用struts2标签,页面样式受影响,所以需要在struts2标签中加上theme="simple"才能够使原来的jsp页面样式不受影响。