效果
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'common-tag.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<s:debug></s:debug>
<br>
url:
<s:url value="/testUrl" var="url" >
<s:param name="productId" value="1001"></s:param>
</s:url>
<br>
${url }
<br>
<br>
<br>
url:
<s:url value="/testUrl" var="url" >
<!-- 会自动进行ognl解析 如果不需要自动解析 则用单引号''引起来 -->
<s:param name="productId" value="'productId'"></s:param>
</s:url>
<br>
${url }
<br>
<s:url action="testAction" method="testTag" var="url"></s:url>
<br>
<a href="${url }">${url }</a>
<br><br>
包含请求参数get
<s:url value="testUrl" var="url5" includeParams="get"></s:url>
<br>
${url5 }
<br><br>
包含请求参数get
<s:url value="testUrl" var="url6" includeParams="all"></s:url>
<br>
${url6 }
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<h1>
<a href="Product_input.action">Product_input</a><br>
<a href="testTag.action">testTag</a><br>
<form action="testTag.action" method="get">
<input type="text" name="username"/>
<input type="submit" />
</form>
</h1>
</body>
</html>