zoukankan      html  css  js  c++  java
  • 几种标签库中的一些特有使用

    一、Struts1.x

    1.<html:link action="/action">不用关心Web应用程序的路径和ActionServlet的映射关系。

    可以自动附加sessionid参数进行url重写。

    可以对参数信息进行url编码。

    备注:<c:url>标准标签也有<html:link>标签的后两个功能。

      <%
       Date now=new Date();
       request.setAttribute("now",now);
       request.setAttribute("name","天地玄");
       Map<String,String> map=new HashMap<String,String>();
       map.put("x","1");
       map.put("y","2");
       map.put("z","3");
       request.setAttribute("person",map);
       %>
        <a href="/strutsdemo/RegUser.do">注册(太差)</a><br>
        <a href="${pageContext.request.contextPath}/RegUser.do">注册(一般)</a><br>
        <html:link action="/RegUserUI">注册(很好)</html:link><br>
        <html:link action="/RegUserUI" paramId="username" paramName="name">注册(url编码)</html:link><br>
        <html:link action="/RegUserUI" paramId="t" paramName="now" paramProperty="time">注册(url编码)</html:link><br>
        <html:link action="/RegUserUI" name="person">注册(多个参数)</html:link><br>

    2.depts=coporation.getDepartments();

    request.setAttribute('corp',coporation);

    Department.getId()/getName()

    <html:optionsCollection name="corp" porperty="departments"   value="id" label="name"/>

    3.<html:form>
    ①.<html:form>标签的action属性的设置值是否以/开头、是否以.do结尾都是可以的。
    ②.使用<html:text>和<html:password>等标签可以回显数据。
    ③.设置<html:password>的value属性,让密码信息不要回显。
    ④.生成html文档的<form>标签,其focus属性还可以生成相应的javaScript代码。
    ⑤.获取action属性中路径所对应的scope域中的formbean,存在则获取,不存在则创建新的,再把这个formbean以一个特殊关键字保存在request中,以便其中的<html:xxx>标签获取值时使用。
    ⑥.通过想取消保存在Session中的FormBean中的复选框的勾选操作,引入reset方法。

       <html:form action="/RegUser" focus="password2">
        用户名:<html:text property="user.username"></html:text>
        <html:errors property="username"/><br>
        密码:<html:password property="user.password" value=""></html:password><br>
        确认密码:<html:password property="password2" value=""></html:password>
        <html:errors property="password2"/><br>
        身高:<html:text property="user.height"/><br>
       <html:submit titleKey="info.title"><bean:message key='info.submit' bundle='App'/></html:submit>
       <html:checkbox property="autoLogon"></html:checkbox>两星期自动登录
        </html:form>   
        <!-- 输出错误信息2 -->
        <hr><html:errors/><hr>

  • 相关阅读:
    小水滴
    “星际穿越”观后感(宇宙只是界面,科技永远触摸不到世界的本原)
    惊涛怪浪(double dam-break) -- position based fluids
    [转]Data Structure Recovery using PIN and PyGraphviz
    [转]Adventures in Xen exploitation
    [转]iOS Tutorial – Dumping the Application Memory Part 2
    [转] Building xnu for OS X 10.10 Yosemite
    [转]iOS Tutorial – Dumping the Application Heap from Memory
    [转]Even when one byte matters
    [转]iOS IPC via NSFileCoordinator and NSFilePresenter
  • 原文地址:https://www.cnblogs.com/mingforyou/p/2275302.html
Copyright © 2011-2022 走看看