博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
struts2中<s:form>的应用
阅读量:5060 次
发布时间:2019-06-12

本文共 3595 字,大约阅读时间需要 11 分钟。

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/admin/include/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>TShop商城系统演示站 - Powered by TShop</title>
<%@include file="/admin/include/script.jsp"%>
</head>
<body>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>店铺</h3>
      <ul class="tab-base">
        <li><a href="JavaScript:void(0);" class="current"><span>基本设置</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <s:form action="addStoreSetting.action" method="post" id="form_email" name="settingForm" > 
    <input type="hidden" name="form_submit" value="ok" />
    <table class="table tb-type2">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label>开店申请:</label></td>
        </tr>
        <tr class="noborder">
        <input type="hidden" name='setting.id' value="<s:property value='setting.id'/>" />
<input type="hidden" name='setting.name' value="store_allow_isuse" />
          <td class="vatop rowform onoff">
          <s:if test='setting.value == "1"'>
            <label for="store_allow_isuse_1" class="cb-enable selected" title="开启"><span>开启</span></label>
            <label for="store_allow_isuse_0"class="cb-disable " title="关闭"><span>关闭</span></label>
          </s:if>
          <s:if test='setting.value == "0"'>
          <label for="store_allow_isuse_1" class="cb-enable " title="开启"><span>开启</span></label>
            <label for="store_allow_isuse_0"class="cb-disable selected" title="关闭"><span>关闭</span></label>
          </s:if>
            <input type="radio" id="store_allow_isuse_1" name="setting.value" value="1" <s:if test='setting.value == "1"'>checked="checked"</s:if>>
            <input type="radio" id="store_allow_isuse_0" name="setting.value" value="0" <s:if test='setting.value == "0"'>checked="checked"</s:if>>
            </td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2"><table class="table tb-type2 nomargin">
              <thead>
                <tr class="space">
                  <th colspan="16">信誉额度</th>
                </tr>
                <tr class="thead">
                  <th>等级</th>
                  <th>信用介于</th>
                </tr>
              </thead>
              <tbody>
              <s:if test="ruleList.size()>0">
              <s:iterator value="ruleList" status="status">                  
             <s:hidden   label="id" name="ruleList[%{#status.index}].id" value="%{ruleList[#status.index].id}"/> 
             <s:hidden  label="type" name="ruleList[%{#status.index}].type" value="%{ruleList[#status.index].type}"/> 
             <s:hidden  label="name" name="ruleList[%{#status.index}].name"  value="%{ruleList[#status.index].name}"/>
             <s:hidden  label="grade" name="ruleList[%{#status.index}].grade" value="%{ruleList[#status.index].grade}"/>
               <tr class="hover">
                 <td class="w200"><span class="<s:property value='name'/> <s:property value='grade'/>"><img src="http://121.52.216.217:10080/shopnc/admin/templates/images/transparent.gif"/></span></td>
                 <td>
                 <SPAN>
                 <s:textfield  name="ruleList[%{#status.index}].startValue"   value="%{ruleList[#status.index].startValue}"/>-&nbsp;&nbsp;<s:textfield  name="ruleList[%{#status.index}].endValue"  value="%{ruleList[#status.index].endValue}"/>
                 </SPAN>
                 </td>
                </tr>
                </s:iterator>
                </s:if>
              </tbody>
            </table></td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="2">
          <s:submit value="提交"  /> 
          </td>
        </tr>
      </tfoot>
    </table>
  </s:form>
</div>
</body>
</html>
 
注意:1、<s:form>表单中action属性action="addStoreSetting.action"不用写成 action="/admin/store/setting/addStoreSetting.action",struts2会自动匹配命名空间下的 addStoreSetting.action,还有就是非<s:form>表单的文本域写法也能通过<s:from>提交到后 台
2、由于使用struts2标签,页面样式受影响,所以需在struts2标签中加上theme="simple"才能够使原来的jsp页面样式不受影响。

转载于:https://www.cnblogs.com/plzdaye/p/3961230.html

你可能感兴趣的文章
Python学习资料
查看>>
多服务器操作利器 - Polysh
查看>>
[LeetCode] Candy
查看>>
Jmeter学习系列----3 配置元件之计数器
查看>>
jQuery 自定义函数
查看>>
jq 杂
查看>>
jquery datagrid 后台获取datatable处理成正确的json字符串
查看>>
作业一
查看>>
AJAX
查看>>
ActiveMQ与spring整合
查看>>
web服务器
查看>>
js数组操作大全
查看>>
创业者要处理好的10大关系
查看>>
佛教和道教对“妖”的差异
查看>>
[TimLinux] Python IDE工具
查看>>
[TimLinux] Python Django与WSGI的简介
查看>>
从其它系统登录到SharePoint 2010系统的单点登录
查看>>
ElMAH(ASP.NET错误日志记录与通知)系列文章-基础应用篇
查看>>
pexpect学习阶段
查看>>
做最多的,展示最好的
查看>>