码迷,mamicode.com
首页 > 其他好文 > 详细

OGNL逻辑标签,UI标签

时间:2015-04-28 11:35:57      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

逻辑标签

public class IndexAction extends BasicAction{
        
        private static final long serialVersionUID = 1L;

        private String name;
        private List<String> messages;
        private List<ProductType> typeList; 
        
        public String execute() {
            name = "tom";
            
            messages = new ArrayList<String>();
            messages.add("m1");
            messages.add("m2");
            messages.add("m3");
            messages.add("m4");
            
            typeList = new ProductService().findAllType();
            
            return SUCCESS;
        }
    }    

jsp中
要导入<%@ taglib prefix="s" uri="/struts-tags" %>

<s:if test="name == ‘Tom‘">
            <h1>Hello,TOM</h1>
        </s:if>
        <s:elseif test="name == ‘tom‘">
            <h1>xixi,Tom</h1>
        </s:elseif>
        <s:else>
            <h1>other</h1>
        </s:else>
        
        <ul>
            <s:iterator value="messages" var="ms" status="st">
                <li>${ms} : ${st.even}</li>
            </s:iterator>
        </ul>

UI标签,用作生成表单 了解即可

<s:form action="/product/new.action" theme="simple">
            <s:textfield label="账号" name="product.name" id="pname"/>
            <s:password label="密码" name="product.pwd"/>
            <s:radio label="性别" list="#{‘m‘:‘男‘,‘w‘:‘女‘ }" name="xxx"/>
            <s:checkbox label="体育" name="fav" value="ty"/>
            <s:checkbox label="音乐" name="fav" value="ty"/>
            <s:textarea></s:textarea>
            <s:select list="typeList" listKey="id" listValue="typename"></s:select>
            <s:submit></s:submit>
            <s:reset></s:reset>
        </s:form>

 

OGNL逻辑标签,UI标签

标签:

原文地址:http://www.cnblogs.com/itliucheng/p/4462256.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!