<C: URL> tag-related knowledge points

Source: Internet
Author: User
I,

<C: URL> A tag is used to generate a string-type URL instead of a hyperlink. Note the difference between a URL (Uniform Resource Locator) and a hyperlink.

<C: URL value = "http://www.baidu.com"/> the output form on the JSP page is as follows:
It can be seen that this is a string on the page, not a hyperlink that can be clicked. second, to use this <C: URL> to generate a hyperlink, you must use the HTML element <A>. example: <a href = "<C: URL value = ". /testparamimported. JSP "> <C: Param name =" username "value =" yangmu "> </C: param> <C: param name = "password" value = "hello"> </C: param> </C: the following code is displayed on the URL> "> jump page </a> page:
This forms a clickable hyperlink. example 3: You can also use the <C: param> tag to append the URL string generated by <C: URL>. The URL string in the preceding example is as follows:

These two tags can be used together to automatically generate a URL in a valid format. comment 4. Use the <A> element, <C: URL>, and <C: param> tags in combination: Display Results:
Result After clicking this hyperlink:

5. You can use the VaR and scope attributes to store the string-type URLs generated by the <C: URL> tag in the attributes of the four scopes, then, the URL stored in the four-scope attribute is retrieved using the El expression.

Is the result of the above Code displayed on the page. Click the link:

Tip 6. before using the <C: URL> label, you must use the relative or absolute path of the document to locate the target resource. If you use the root relative path, an error occurs, for details, see the absolute path & root Relative Path & document relative path in J2EE. However, when using <C: you can use the root directory of the Web application as the reference point to locate the resource, that is, the use of the root relative path. example:
Lightning.jpg resource location:
Result of location using the root relative path:

In this case, the lightning.jpg address under the pagefolder will be automatically linked, without having to spend time calculating the relative address of the image. When the domain name changes, the absolute path does not need to be changed. The absolute path generated by the above image is as follows:

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.