a.jsp:我怎能參數使用JSP頁面打開
<form method=post action="b.jsp">
<INPUT TYPE="text" name="test" value="hello world!">
</form>
b.jsp:
<%@ page language="java" contentType="text/html;charset=UTF-8" %><%
response.sendRedirect("http://example.com/c.jsp");
%>
http://example.com/c.jsp:(此頁在其它服務器)
<%@ page language="java" contentType="text/html;charset=UTF-8" %><%
System.out.println(request.getParameterValues("test")); //must use request.getParameter
%>
如何獲取c.jsp
中的參數test
?
請不要使用GET方法,如:response.sendRedirect("c.jsp?test=helloworld!");
我試着用着,但拋出異常:
404 Not Found
/acc/http:/example.com/ccc.jsp was not found on this server.
感謝幫助:)
感謝@Bozho,但我不能在其他服務器上使用'c.jsp',URL:http://xxx.com/c.jsp – Koerr 2011-04-11 09:03:43
謝謝@ Bozho,我看到你的更新,爲什麼在'b.jsp'中不能模擬
@Zenofo - 如果你想把用戶引導到頁面「c」 - 沒有。 sendRedirect只是GET。檢查我的更新以獲取使用信息的方式。 – Bozho 2011-04-11 10:22:22