URL tag of struts2 tag

Source: Internet
Author: User

The following are common usage of struts2 labels:
<S: URL value = "/images/copyright.jpg"/>
<S: URL action = "list" namespace = "/qxgl"/>
Note: The default value of the includeparams attribute in the URL is get. if a new value is specified in XML, all static files referenced using URL tags will carry the parameter values passed through the get method.
In addition, the attribute values of includeparams include none and all.
ALL: Add parameters in get and post to URL parameters.
;
None does not add parameters to the URL;

For example, you write data in detail. jsp

<Link href = "<s: URL value ="/CSS/styleqxgl.css "/>" rel = "stylesheet"
Type = "text/CSS">

Enter http: // localhost/detail. jsp in the browser? Id = 5

<Link href = "/Web Application name/CSS/styleqxgl.css? Id = 5 "rel =" stylesheet"
Type = "text/CSS">
In this example, styleqxgl.css is downloaded. If your system is deployed on the Internet, the bandwidth cost is very expensive. Using browser cache can effectively use bandwidth and save costs.

There are two solutions to this problem: <s: URL value = "/CSS/styleqxgl.css" includeparams = "NONE"/>

The other is configured in struts. xml. For details, refer to the following:

Setting a default value Includeparams

The propertyStruts. url. includeparamsCan be used to set the default value ofIncludeparamsAttribute.

Setting the default value of parameter deparams
<struts>
...
<constant name="struts.url.includeParams" value="none" />
...
</struts>

See constant configuration for further information.

Parameters
Name Required Default Evaluated Type Description
Action False False String The action to generate the URL for, if not using value
Anchor False False String The anchor for this URL
Encode False True False Boolean Whether to encode Parameters
Escapeamp False True False Boolean Specifies whether to escape ampersand (&) to (& amp or not
Forceaddschemehostandport False False False Boolean Specifies whether to force the addition of scheme, host and port or not
ID False False String Deprecated. Use 'var' instead
Includecontext False True False Boolean Whether actual context shocould be encoded in URL
Includeparams False Get False String The includeparams attribute may have the value 'none', 'get' or 'all'
Method False False String The method of action to use
Namespace False False String The namespace to use
Portletmode False False String The resulting Portlet Mode
Portleturltype False False String Specifies if this shoshould be a Portlet render or action URL. Default is "render". To create an action URL, use "action ".
Scheme False False String Set scheme attribute
Value False False String The target value to use, if not using action
VaR False False String Name used to reference the value pushed into the value Stack
Windowstate False False String The resulting Portlet window state

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.