• bean标签


        bean的uri的路径
    bean标签是属于struts中的标签,使用要在 Struts 1.3 Libraries中 struts-taglib-1.3.8.jar
    中META-INFtldstruts-bean.tld中找到uri,然后加载到你要使用的jsp中
        <bean:write>
    <% 
            request.setAttribute("a","abc");
            Dog dog1=new Dog();
            dog1.setAge(12);
            dog1.setName("xiaohong");
            request.setAttribute("b",dog1);
         %>
         
         <bean:write name="a"/>
         <hr/>
         <bean:write name="b" property="age"/><br/>
         <bean:write name="b" property="name"/>
    记住这里取出的对象 name的值是域对象的名字。property对象中的get,set方法。
        <bean:message>
    主要是取出struct配置文件的信息。
    当使用struct时会有一个自动生成的配置文件ApplicationResources.properties
    可以在里面自己设置一些信息。用<bean:message>取出
    ApplicationResources.properties  :
    err1 =u4f60u7684u9519u8befu662f{0}u5468u6d77{1}
    err2 =hello {0}
    
    注意:u4f60u7684u9519u8befu662f这个是用java工具中的native2ascii.exe 把中文转化为java编码
    jsp中取出
    <bean:message key="err1" arg0="用户名为空" arg1="ffff"/> 
     <bean:message key="err2" arg0="wrod"/>
    
    浏览器输出:
    你的错误是用户名为空ffff hello word
    
        补充<jsp:useBean>的用法
    <jsp:useBean id="dog2" class="com.zh.domain.Dog"></jsp:useBean>
    创建一个Dog对象。
         <jsp:setProperty property="name" name="dog2" value="tom"/> 设置dog对象实例的name属性
         <jsp:setProperty property="age" name="dog2" value="2"/>
    设置dog对象实例的age属性
          ${dog2.name}--- //输出
          ${dog2.age }
  • 相关阅读:
    Super Mario
    SPOJ Count on a tree
    SPOJ DQUERY
    51nod 区间中第K大的数
    POJ2104 K-th Number
    矩阵模板
    Sasha and Array
    MVC RenderSection
    Lazy Acquisition
    .net4.5 await async 简化之后的异步编程模型
  • 原文地址:https://www.cnblogs.com/shaoshao/p/3418014.html
Copyright © 2020-2023  润新知