jstlラベルの使い方

2462 ワード

    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 =\u4f60\u7684\u9519\u8bef\u662f{0}\u5468\u6d77{1}

err2 =hello {0}



  :\u4f60\u7684\u9519\u8bef\u662f    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 }