HTML: how to use the four attributes of name, paramid, paramname, and paramproperty in link

Source: Internet
Author: User

I read some articles about using HTML: link. Most of them only talk about the use of paramid in combination with paramname and paramproperty. The following describes the effects of name, paramid, paramname, and paramproperty.

The first is to explain the simple application paramid, paramname and paramproperty.

<HTML: link action = "/atctionname" paramid = "paramvalue" paramname = "beanname" paramproperty = "beanproperty"> click the link

Suppose there is a bean named beanname in the scope, and the beanproperty value of beanname is value, then after you click the link, there will be the following link effect:

Http: // localhost: 8080/projectname/atcionname? Paramvalue = Value

The paramid attribute tells the JSP compilation engine which parameter you want to transmit.

The paramname attribute uses the bean, and the paramproperty attribute uses the bean attribute. The combination of the two is to let you tell the JSP compilation engine that you want to transmit the attribute values in the bean using parameters.

Only one parameter can be transferred, but it is often not enough in the application. The name attribute is used to transmit multiple parameters.

The name attribute must be a map-type variable.

Assume that you define the following map:

Map mapname = new hashmap ();

Mapname. Put ("paramvalue1", "value1 ");

Mapname. Put ("paramvalue2", "value2 ");

Request. setattribute ("mapname", mapname );

The following link is available on the JSP page:

<HTML: link action = "/atctionname" name = "mapname"> click the link.

Effect after clicking the link:

Http: // localhost: 8080/projectname/atcionname? Paramvalue1 = value1 & paramvalue2 = value2

In my practice, I thought that when parsing tags, I should parse all the attributes used. So I did the following test,

The following is an example of using four attributes:

<HTML: link action = "/atctionname" name = "mapname" paramid = "paramvalue" paramname = "beanname" paramproperty = "beanproperty"> click the link

The result is:

Http: // localhost: 8080/projectname/atcionname? Paramvalue1 = value1 & paramvalue2 = value2 & paramvalue = Value

All attribute values are parsed.

This effect can be applied to the link effect that you want to deduce at the first level. That is to say, after you submit, you can

The value of paramvalue is put into the map of mapname and then returned. It is used in the name attribute. When you want to return the above level, you can

Remove. Or when your parameters are stored in the cascading keys of multiple tables in the database, you can directly obtain the master key to query the upper-level tables, you do not need to go back to the database at the first level to provide primary keys.

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.