zoukankan      html  css  js  c++  java
  • struts2的标签和一般的html标签的区别

    1、s:textfield 和 input

        <s:textfield name="type.name" id="type_name" label="名称"></s:textfield>

    相当于

     <td ><label >名称:</label></td>
     <td>
    <
    input type="text" name="type.name" value="&#32654;&#39135;"/>
    </
    td>

    即s:textfield =lable+text+td格式

    特点:

    (1)如果action传给了jsp一个type变量,则输入框的value属性自动赋值为 type.name,但是input text的value不会根据name取赋值

    <s:textfield name="type.name"   label="名称"></s:textfield>

    (2)s:textfield的name和value不能嵌套使用,其""内的值不能任何转义,但是input text可以

    $取action的变量值

    <input type="hidden" name="type.id" value="${type.id}"></input>

    $取栈中的变量值

    <s:iterator value="subStores" id="s" status="st">
    <tr>
    <td><input type="text" name="" value="${st.index}" /></td>
    <tr>

    或者

    <% Type type= (Type)request.getAttribute("type");%>取action的变量值
    <% 
    Type type= (Type)request.getAttribute("type");
    int i=0;
    for(TypeSub sub:type.getSubs()){%>
    <input type="text"   name="subs[<%=i %>].name" value="<%=sub.getName() %>"></input>

    (3)s:hidden和input hidden也遵循上述两条特性

    Done

  • 相关阅读:
    正则表达式
    linux中的三种时间
    用户,用户组
    inode与block
    linux文件属性
    linux的启动过程
    linux的重要子目录
    mail邮箱
    spark原理
    spark部署
  • 原文地址:https://www.cnblogs.com/xingyyy/p/3919663.html
Copyright © 2011-2022 走看看