struts的bean标记库是对jsp的标准标记库的增强,除了提供基本的jsp:userBean、jsp:setProperty等标记的基本功能,还支持对多种对象的操作,从多种对象生产javaBean,提供了更方便的读、写Bean的方法。 
        以下是从其官方网站的User Guide摘抄的对其功能的描述, 
     
Introduce A String Constant - 从字符串常量创建bean 
    <bean:define id="foo" value="This is a new String"/>     <bean:define id="bar" value='<%= "Hello, " + user.getName() %>'/>     <bean:define id="last" scope="session"                  value='<%= request.getRequestURI() %>'/> 
 Copy An Existing Bean - 为已有的bean创建新的引用(type属性声明该引用的类型) 
    <bean:define id="foo" name="bar"/>     <bean:define id="baz" name="bop" type="com.mycompany.MyBopClass"/> 
 Copy An Existing Bean Property - 从已存在的bean的属性创建bean。可以使用的bean的属性有三种:simple, nested, or indexed。  
    <bean:define id="foo" name="bar" property="baz" scope="request"     toScope="session"/>    <bean:define id="bop" name="user" property="role[3].name"/> Other Struts Copying Tags Copy A Cookie - 从cookie创建bean。如果指定的cookie不存在则会抛出运行时异常 - 因此,常和 <logic:present cookie="xxx"> 标签一起使用来保证cookie的存在。 通过指定multiple属性,可以从多个同名cookie创建一个包含多个cookie的数组。  
    <bean:cookie id="foo" name="cookiename"/>     <bean:cookie id="all" name="JSESSIONID" multiple="true"/> 
 Copy A Request Header - 从请求头创建bean。 (其余说明同上) 
    <bean:header id="agent" name="User-Agent"/>    <bean:header id="languages" name="Accept-Language" multiple="true"/> Copy A Dynamically Created Response - You can generate an internal request to the application you are running, and turn the response data that is returned from that request into a bean (of type String). One possible use for this technique is to acquire dynamically created XML formatted data that will be stored in a bean and later manipulated (such as by applying an XSLT stylesheet). If the current request is part of a session, the generated request for the include will also include the session identifier (and thus be considered part of the same session).(由于学识有限,这段还不太理解,所以没有翻译) 
    <bean:include id="text" name="/generateXml?param1=a¶m2=b"/> Copy A JSP Implicitly Defined Object - 从JSP内置对象建立bean。 
    <bean:page id="app" property="application"/>    <bean:page id="sess" property="session"/> Copy A Request Parameter - 从请求参数建立bean。(其余说明同bean:cookie) 
    <bean:parameter id="name" name="name"/>     <bean:header id="options" name="option" multiple="true"/> 
 Copy a Web Application Resource - 从web应用程序资源建立一个包含web应用程序资源字符串、或一个InputStream输入流以供读取其中的资源的bean。 
    <bean:resource id="deployment" name="/WEB-INF/web.xml"/>    <bean:resource id="stream" name="/WEB-INF/web.xml"                   input="true"/> Copy A Struts Configuration Object - 从struts标准配置对象建立bean。 
    <bean:struts id="form" formBean="CustomerForm"/>     <bean:struts id="fwd" forward="success"/>     <bean:struts id="map" mapping="/saveCustomer"/> 
  
-------------------------------------------------------------------------------- 
Bean Output Render An Internationalized Message - 处理国际化message。在使用前要预先对该资源进行读取、配置等操作。 
    <bean:message key="label.Cancel"/>     <bean:message key="message.hello" arg0='<%= user.getFullName() %>'/> 
 Render A Bean or Bean Property - 输出bean或bean的属性。 
    <bean:write name="username"/>     <bean:write name="user" property="fullName"/>     <bean:write name="customer" property="orders[2].partNumber"                 scope="session"/> 
  
        
 
  
 
  |