如何将一个jsp页面的值重定向<s:property/>
到<input type="text"/>
另一个jsp页面的..?
我有两个 jsp 页面: one.jsp 和 two.jsp
一个.jsp:
<%@taglib prefix="s" uri="/struts-tags" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jsp - one</title>
</head>
<body>
<h1>One JSP</h1>
<s:iterator value="u" begin="0" end="0">
<s:property value="uid" />
</s:iterator>
<a href="two.jsp">Go to two.jsp</a>
</body>
</html>
二.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jsp - two</title>
</head>
<body>
<h1>Two JSP</h1>
<input type="text" id="two" name="two" value="<%=request.getParameter("uid")%>" /> //in this textfield i want the value of <s:property/> of one.jsp. But i am getting "null" in it.
<a href="one.jsp">Go to one.jsp</a>
</body>
</html>
请注意:one.jsp 正在使用 struts2 taglib,并且 的值<s:property/>
是从返回一些列表的动作类中获取的u
,列表是具有唯一u
性的类型。我已经正确地完成了数据库中类和表的映射。而 two.jsp 没有使用任何 taglib。two.jsp 与数据库或taglib 无关。它只有一个来自 one.jsp 的链接。在two.jsp 中,我想要 one.jsp 的值。但我正在参与其中。请给一些方法来获得它。users
uid
<input type="text">
<s:property/>
"null"