第二篇 struts2标签

struts2标签

struts2只用一个标签,主要分为两类:UI标签和非UI标签 

UI标签:

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>UI 标签</title>
</head>
<body>

<s:form action="exampleSubmit" method="post" enctype="multipart/form-data">
    <s:textfield 
            label="Name" 
            name="name"
            tooltip="Enter your Name here" />

    <s:datepicker
            tooltip="Select Your Birthday"
            label="Birthday"
            name="birthday" />

    <s:textarea
            tooltip="Enter your Biography"
            label="Biograph"
            name="bio"
            cols="20"
            rows="3"/>

    <s:select
            tooltip="Choose Your Favourite Color"
            label="Favorite Color"
            list="{'Red', 'Blue', 'Green'}"
            name="favoriteColor"
            emptyOption="true"
            headerKey="None"
            headerValue="None"/>

    <s:select
            tooltip="Choose Your Favourite Language"
            label="Favourite Language"
            list="favouriteLanguages"
            name="favouriteLanguage"
            listKey="key"
            listValue="description"
            emptyOption="true"
            headerKey="None"
            headerValue="None"/>

    <s:checkboxlist
            tooltip="Choose your Friends"
            label="Friends"
            list="{'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
            name="friends"/>

    <s:checkbox
            tooltip="Confirmed that your are Over 18"
            label="Age 18+"
            name="legalAge"/>

    <s:doubleselect
            tooltip="Choose Your State"
            label="State"
            name="region" list="{'North', 'South'}"
            value="'South'"
            doubleValue="'Florida'"
            doubleList="top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}" 
            doubleName="state"
            headerKey="-1"
            headerValue="---------- Please Select ----------"
            emptyOption="true" />

    <s:doubleselect
            tooltip="Choose your Vehical"
            label="Favourite Vehical"
            name="favouriteVehicalType"
            list="vehicalTypeList"
            listKey="key"
            listValue="description"
            value="'MotorcycleKey'"
            doubleValue="'YamahaKey'"
            doubleList="vehicalSpecificList"
            doubleListKey="key"
            doubleListValue="description"
            doubleName="favouriteVehicalSpecific" headerKey="-1"
            headerValue="---------- Please Select ----------"
            emptyOption="true" />

    <s:file
            tooltip="Upload Your Picture"
            label="Picture" 
            name="picture" />
            
    <s:optiontransferselect
            tooltip="Select Your Favourite Cartoon Characters"
            label="Favourite Cartoons Characters"
            name="leftSideCartoonCharacters" 
            leftTitle="Left Title"
            rightTitle="Right Title"
            list="{'Popeye', 'He-Man', 'Spiderman'}" 
            multiple="true"
            headerKey="headerKey"
            headerValue="--- Please Select ---"
            emptyOption="true"
            doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}" 
            doubleName="rightSideCartoonCharacters"
            doubleHeaderKey="doubleHeaderKey"
            doubleHeaderValue="--- Please Select ---" 
            doubleEmptyOption="true"
            doubleMultiple="true" />
               
    <s:submit οnclick="alert('aaaa');" />
    <s:reset οnclick="alert('bbbb');" />
</s:form>
    
</body>
</html>

 非UI标签 :

<s:if test="#name == 'Max'">
       Max's file here
</s:if>
<s:elseif test="#name == 'Scott'">
      Scott's file here
</s:elseif>
<s:else>
      Other's file here
</s:else>       

  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值