jsp傳遞參數(shù)
**.jsp?param=1
那么request.getParameter("param")就可以勒!
原來(lái)用request.getAttribute死活不行,以為必須得用form傳遞呢,敢情getParameter就行~~
所以如果想只用jsp頁(yè)面的話,可以這樣子做:
hello.jsp:
function hello(name)


{
sayHello(name);
}
function sayHello(id)


{
window.location="sayHelloCommit.jsp?id="+id;
}
sayHelloCommit.jsp:

<%
@ page contentType="text/html;charset=gb2312"%>

<%
String str = (String) request.getParameter("id");
//To Something using the "str"
//redirect to a page
response.sendRedirect("hello.jsp");
%>

那么request.getParameter("param")就可以勒!
原來(lái)用request.getAttribute死活不行,以為必須得用form傳遞呢,敢情getParameter就行~~
所以如果想只用jsp頁(yè)面的話,可以這樣子做:
hello.jsp:












sayHelloCommit.jsp:













posted on 2007-08-13 16:51 cerulean 閱讀(695) 評(píng)論(0) 編輯 收藏 所屬分類(lèi): Java 、web