struts的标签

时间:2025-02-24 13:36:32

<%@ taglib uri="/struts-tags" prefix="s"%>

<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>

<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>

<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>

<%@ taglib uri="/WEB-INF/tld/taglibs-string.tld" prefix="str" %>

<%@ taglib uri="/WEB-INF/tld/valuelist.tld" prefix="vlh"%>

<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>(貌似自定义标签其实和这句差不多<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>)

用法(url是配置里的name—>有tag-class的那个其他的name是这个标签的属性)

<c:url value='/berheley/calendar/affairAdd.ao?method=goUrl'/>

<c:foreach items=””/>

<?xml version="1.0" encoding="UTF-8" ?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"

version="2.0">

<description>JSTL 1.1 core library</description>

<display-name>JSTL core</display-name>

<tlib-version>1.1</tlib-version>

<short-name>c</short-name>

<uri>http://java.sun.com/jsp/jstl/core</uri>

<validator>

<description>

Provides core validation features for JSTL tags.

</description>

<validator-class>

org.apache.taglibs.standard.tlv.JstlCoreTLV

</validator-class>

</validator>

<tag>

<description>

Creates a URL with optional query parameters.

</description>

<name>url</name>

<tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>

<body-content>JSP</body-content>

<attribute>

<description>

Name of the exported scoped variable for the

processed url. The type of the scoped variable is

String.

</description>

<name>var</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

<attribute>

<description>

Scope for var.

</description>

<name>scope</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

<attribute>

<description>

URL to be processed.

</description>

<name>value</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

<attribute>

<description>

Name of the context when specifying a relative URL

resource that belongs to a foreign context.

</description>

<name>context</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

<tag>

<description>

Retrieves an absolute or relative URL and exposes its contents

to either the page, a String in 'var', or a Reader in 'varReader'.

</description>

<name>import</name>

<tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>

<tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>

<body-content>JSP</body-content>

<attribute>

<description>

The URL of the resource to import.

</description>

<name>url</name>

<required>true</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

<attribute>

<description>

Name of the exported scoped variable for the

resource's content. The type of the scoped

variable is String.

</description>

<name>var</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

<attribute>

<description>

Scope for var.

</description>

<name>scope</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

<attribute>

<description>

Name of the exported scoped variable for the

resource's content. The type of the scoped

variable is Reader.

</description>

<name>varReader</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

<attribute>

<description>

Name of the context when accessing a relative

URL resource that belongs to a foreign

context.

</description>

<name>context</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

<attribute>

<description>

Character encoding of the content at the input

resource.

</description>

<name>charEncoding</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

<tag>

<description>

The basic iteration tag, accepting many different

collection types and supporting subsetting and other

functionality

</description>

<name>forEach</name>

<tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>

<tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>

<body-content>JSP</body-content>

<attribute>

<description>

Collection of items to iterate over.

</description>

<name>items</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

<type>java.lang.Object</type>

</attribute>

<attribute>

<description>

If items specified:

Iteration begins at the item located at the

specified index. First item of the collection has

index 0.

If items not specified:

Iteration begins with index set at the value

specified.

</description>

<name>begin</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

<type>int</type>

</attribute>

<attribute>

<description>

If items specified:

Iteration ends at the item located at the

specified index (inclusive).

If items not specified:

Iteration ends when index reaches the value

specified.

</description>

<name>end</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

<type>int</type>

</attribute>

<attribute>

<description>

Iteration will only process every step items of

the collection, starting with the first one.

</description>

<name>step</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

<type>int</type>

</attribute>

<attribute>

<description>

Name of the exported scoped variable for the

current item of the iteration. This scoped

variable has nested visibility. Its type depends

on the object of the underlying collection.

</description>

<name>var</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

<attribute>

<description>

Name of the exported scoped variable for the

status of the iteration. Object exported is of type

javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested

visibility.

</description>

<name>varStatus</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

</tag>

<input type="hidden" name="bysq.imageUrl" id="imageUrl" value="<s:property value="bysq.imageUrl"/>"/>

S标签的用法,value取值是不要${}EL表达式的,其实除了c标签,struts的标签都不用EL表达式就可以取到值。