archieve: homework5 c_url.jsp

This commit is contained in:
2025-04-21 15:09:33 +08:00
parent aad47f2f81
commit b8d7992563
2 changed files with 36 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head></head>
<body>
<%--第1个out标签 --%>
userName属性的值为:
<c:out value="${param.username}" default="unknown"/><br />
<%--第2个out标签 --%>
userName属性的值为:
<c:out value="${param.username}">
unknown
</c:out>
</body>
</html>
+21
View File
@@ -0,0 +1,21 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Title</title>
</head>
<body>
使用绝对路径构造 URL:<br/>
<c:url var="myURL"
value="http://localhost:8080/homework5_war_exploded/c_out1.jsp">
<c:param name="username" value="msksbr"/>
</c:url>
<a href="${myURL}">c_out1.jsp</a><br/>
使用相对路径构造 URL:<br/>
<c:url var="myURL"
value="c_out1.jsp?username=msksbr">
<c:param name="username" value="msksbr515"/>
</c:url>
<a href="${myURL}">c_out1.jsp</a>
</body>
</html>