cerulean

jsp传递参数

**.jsp?param=1
那么request.getParameter("param")就可以勒!
原来用request.getAttribute死活不行,以为必须得用form传递呢,敢情getParameter就行~~

所以如果想只用jsp页面的话,可以这样子做:
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");
%>

posted on 2007-08-13 16:51 cerulean 阅读(665) 评论(0)  编辑  收藏 所属分类: Javaweb


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2007年8月>
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

统计

常用链接

留言簿(3)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜