在多个jsp页面传递参数
1. 怎么在多个JSP页面之间进行参数传递?需要使用JSP的内置作用域对象session。利用它的两个方法setAttribute(),getAttribute()
2. 下面的这个实例实现了把第一个JSP页面的参数传递给第三个页面的功能
3. 代码如下:1.jsp
[img][/img]
<html>
<form method=get action=2.jsp>
what's your name<input type=text name=username>
<input type=submit value=submit>
</form>
</html>
4. 2.jsp
<html>
<form method=post action="3.jsp?pass=11">
<%
String name=request.getParameter("username");
session.setAttribute("username",name);
%>
Your name is:<%=request.getParameter("username")%>
<br>what's your hobby<input type=text name=hobby>
<input type=submit value=submit>
</form>
</html>
5. 3.jsp
<html>
your name is:<%=session.getAttribute("username")%>
<br>
your hobby is:<%=request.getParameter("hobby")%>
<br>
your password is:<%=request.getParameter("pass")%>
 
相关文档:
JSP常用问答
收藏
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
......
在jsp页面中将回车换行符存入表中方法
1.在一个textarea中输入一段文字,有换行时,将换行符一起插入数据库中
使用方法如下:
public static String TextToHtml(String sourcestr)
{   ......
1、首先登陆www.fckeditor.net/download下载FCKeditor的最新版本,需要下载2个压缩包,一个是基本应用,另一个是在为在jsp下所准备的配置。
FCKeditor 2.6 下载地址:sourceforge.net/project/downloading.php
FCKeditor.Java 下载地址:sourceforge.net/ ......
许久没有登录自己的校内网了,今天登录了一下,忽然发现校内的上传照片挺有意思的,于是乎就从网上找了一下,校内应该是使用jsp写的。在网上找到了个FileUpload控件,可以很方便的上传文件。在网上找到一篇详细介绍这个控件使用的,试验了一下,搞了好久才实现现在整理出来。
一、首 ......
<%
Cookie[] cooks = request.getCookies();
String cookieName = "Mycookie";
boolean flag = false;
for(Cookie cook : cooks)
{
if(cook.getName().equals(cookieName))
{
flag = true;
break;
}
}
if(!flag){
String str=System.currentTimeMillis()+"";
Cook ......