站内搜索: 请输入搜索关键词
当前页面: 图书首页 > JavaServer Pages, Second Edition

JavaServer Pages, Second Edition

[ directory ] Previous Section Next Section

4.11 Tags Learned in this Chapter

c:forEach Repeats a section of the page for every item in an array
Parameters:
    items: An expression specifying the array to use, most likely a bean property
    var: The name of the variable with which each element in the array will be 
    referred
Body:Arbitrary JSP code

c:out Displays a value
Parameters:
    value: An expression to be evaluated and displayed
Body: Arbitrary JSP code; the body content will be displayed if value is null

c:if Conditionally include a portion of the page
Parameters:
    test: An expression that should be a logical test of a property
    var: If present, names a variable where the result of the expression will be 
    stored
Body: Arbitrary JSP code

c:choose Includes one of several portions of a page
Parameters: None
Body: Arbitrary number of c:when tags and, optionally, one c:otherwise tag

c:when One possibility for a c:choose tag
Parameters:
    test: An expression that should be a logical test of a property
Body: Arbitrary JSP code

c:otherwise The catch-all possibility for a c:choose tag. If none of the expressions 
in the c:when tags evaluates to true, the body of the c:otherwise will be 
included.
Parameters: None
Body: Arbitrary JSP code

c:set Set a property in a bean
Parameters:
    target: The name of a bean
    property: The property within the bean to set
    value: The value to assign; may be a script
Body: None

fmt:formatNumber Format a number for output
Parameters:
    value: The value to be formatted; may be a script
    pattern: A pattern specifying how the number should be formatted
Body: None

fmt:formatDate Format a date and/or time for output
Parameters:
    value: The value to be formatted; may be a script
    pattern: A pattern specifying how the date should be formatted
Body: None

    [ directory ] Previous Section Next Section