struts的bean标签库

骷髅头底豆豆鞋

骷髅头底豆豆鞋

2016-02-19 14:28

有一种朋友不在生活里,却在生命力;有一种陪伴不在身边,却在心间。图老师即在大家的生活中又在身边。这么贴心的服务你感受到了吗?话不多说下面就和大家分享struts的bean标签库吧。

  
   

          struts的bean标记库是对jsp的标准标记库的增强,除了提供基本的jsp:userBean、jsp:setProperty等标记的基本功能,还支持对多种对象的操作,从多种对象生产JavaBean,提供了更方便的读、写Bean的方法。

          以下是从其官方网站的User Guide摘抄的对其功能的描述,

     

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/bianchengyuyan/)

  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).(由于学识有限,这段还不太理解,所以没有翻译)

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/bianchengyuyan/)

      bean:include id="text" name="/generateXml?param1=a&param2=b"/
  Copy A JSP Implicitly Defined Object - 从JSP内置对象建立bean。

      bean:page id="app" property="application"/    bean:page id="sess" property="session"/
  

展开更多 50%)
分享

猜你喜欢

struts的bean标签库

编程语言 网络编程
struts的bean标签库

Struts之logic标签库详解

编程语言 网络编程
Struts之logic标签库详解

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

JSP Struts之HTML标签库详解

Web开发
JSP Struts之HTML标签库详解

struts标签使用举例--logic篇

编程语言 网络编程
struts标签使用举例--logic篇

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

jsp struts1 标签实例详解

Web开发
jsp struts1 标签实例详解

JSP标签库介绍

Web开发
JSP标签库介绍

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

ASP自定义函数仿VBA中域函数DLookup

ASP自定义函数仿VBA中域函数DLookup

如何拯救进水的U盘

如何拯救进水的U盘
下拉加载更多内容 ↓