jsp 提交 返回值

wenwen1 发布于 2012/09/06 16:55
阅读 793
收藏 0
<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="utf-8"%>
<jsp:useBean id="dbConn" class="pack_convert.DBConnXmgl"/>
<jsp:useBean id="systemRelated" class="net.gvsun.database.SystemRelated"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
    <title>proApplicationSub</title>

  </head>
 
  <body>
  <%
  request.setCharacterEncoding("utf-8");//处理乱码
  String Project_ID= request.getParameter("Project_ID");
  String Project_NAME = request.getParameter("Project_NAME");
  String Setup_DATE = request.getParameter("Setup_DATE");
  String Setup_BY = request.getParameter("Setup_BY");
  String Specification = request.getParameter("Specification");
  String sql = "insert into project(Project_ID,Project_NAME,Setup_DATE,Setup_BY,Specification) values ('"+Project_ID+"','"+Project_NAME+"','"+Setup_DATE+"','"+Setup_BY +"','"+Specification+"')";
  boolean bol = dbConn.Sql(sql);
  if(bol){
       out.println("添加成功!");
   }else{
       out.println("出错了,请重新操作!");
   }
  dbConn.releaseConn();//释放链接
  response.setHeader("Refresh","1; URL=proApplication.jsp?Project_NAME="+Project_NAME);//12秒后自动跳转页面

  %>   
  </body>

</html>

红色的代码该怎么写才能将Project_NAME传到response里面来?并且
Project_NAME是字符串?这是提交之后的返回页面。


加载中
0
Eric贰
Eric贰
JSP里写太多逻辑代码了,为什么不弄到后台用servlet做?
0
Eric贰
Eric贰
还有 你要 “ Project_NAME ”来干嘛?页面显示 OR 后台处理? 看不懂~
0
唔系好后嘅后生仔
response.setHeader("Refresh","1; URL=proApplication.jsp?Project_NAME="+Project_NAME);,response是重定向跳转,原来所有的参数都掉失,肯定拿不到吧。应该用request去跳转吧
唔系好后嘅后生仔
难道你的参数是中文的?就算拿到也是乱码的吧
wenwen1
wenwen1
但是我用int型的就能拿到。
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部