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
阅读(202)
评论(0)
编辑
收藏
所属分类:
Java
、
web
IT新闻
新用户注册
刷新评论列表
标题
姓名
主页
验证码
*
内容(请不要发表任何与政治相关的内容)
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
该文被作者在 2007-08-14 15:29 编辑过
相关文章:
Tools:Java Decompiler
调节java占用的内存大小
将RMI接口实现打jar包
Struts Form Reset方法
jsp传递参数
换行符
静态惹得祸
同时启动多个Tomcat
myeclipse中web.xml文件不识别taglib的问题
错误页面内容不能过少
导航
BlogJava
首页
新随笔
联系
聚合
管理
<
2007年8月
>
日
一
二
三
四
五
六
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
统计
随笔 - 39
文章 - 0
评论 - 3
引用 - 0
常用链接
我的随笔
我的评论
我的参与
最新评论
留言簿
(3)
给我留言
查看公开留言
查看私人留言
随笔分类
Ant(3)
(rss)
DB(6)
(rss)
eclipse(6)
(rss)
Java(15)
(rss)
other notes(6)
(rss)
Testing Related(6)
(rss)
unix/solaris(2)
(rss)
web(8)
(rss)
XP
(rss)
随笔档案
2009年6月 (1)
2007年12月 (5)
2007年9月 (1)
2007年8月 (7)
2007年7月 (5)
2007年4月 (2)
2007年3月 (11)
2007年2月 (7)
搜索
最新评论
1. re: myeclipse中web.xml文件不识别taglib的问题
特别感谢分享,好人。
--langpa
2. re: myeclipse中web.xml文件不识别taglib的问题
thanks lz 分享!1
--shohokuf
3. re: 使用ant
谢谢分享
--JAVA-HE
阅读排行榜
1. form中的"styleId"属性(1171)
2. Struts Form Reset方法(765)
3. 在eclipse中使用Ant执行JUnit(755)
4. myeclipse中web.xml文件不识别taglib的问题(743)
5. DBUnit的使用(607)
评论排行榜
1. myeclipse中web.xml文件不识别taglib的问题(2)
2. 使用ant(1)
3. 在eclipse中使用Ant执行JUnit(0)
4. 开通“技术”blog(0)
5. 错误页面内容不能过少(0)