JSTL Core <c:param> Tag
The <c:param> tag allows proper URL request parameter to be specified with URL and it does any necessary URL encoding required.
Example:
<c:url value="/index.jsp" var="myURL"> <c:param name="trackingId" value="1234"/> <c:param name="reportType" value="summary"/> </c:url> <c:import url="${myURL}"/>
"/index.jsp?trackingId=1234;reportType=summary"
JSTL Core <c:url> Tag
The <c:url> tag formats a URL into a string and stores it into a variable. This tag automatically performs URL rewriting when necessary. The var attribute specifies the variable that will contain the formatted URL.
The JSTL url tag is just an alternative method of writing the call to the response.encodeURL() method. The only real advantage the url tag provides is proper URL encoding, including any parameters specified by children param tag.
Example:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title><c:url> Tag Example</title> </head> <body> <a href="<c:url value="/jsp/index.htm"/>">TEST</a> </body> </html>
TEST
0 意見:
張貼留言