| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1088 人关注过本帖
标题:[求助]为什么用struts2.0的默认 jsp页面发送请求不知道传到什么地方去了
只看楼主 加入收藏
penjew
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-10-23
收藏
 问题点数:0 回复次数:2 
[求助]为什么用struts2.0的默认 jsp页面发送请求不知道传到什么地方去了

问题如题:
这是jsp页面

<%@ page language="java" pageEncoding="utf-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />

<title>updateradicate.jsp</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<html:form action="radicateAction?r=updateRadicate">
<table border="0">
<html:hidden property="rid" />
<tr>
<td>
项目名称:
</td>
<td>
<html:text property="name" />
</td>
</tr>
<tr>
<td>
项目类型:
</td>
<td>
<html:text property="type" />
</td>
</tr>
<tr>
<td>
用户名称:
</td>
<td>
<html:hidden property="uid"/>
<html:text property="uname" />
</td>
</tr>
<tr>
<td>
客户名称:
</td>
<td>
<html:hidden property="cid"/>
<html:text property="cname" />
</td>
</tr>
<tr>
<td>
总金额:
</td>
<td>
<html:text property="saleMoney" />
</td>
</tr>
<tr>
<td>
开发周期:
</td>
<td>
<html:text property="periods" />
</td>
</tr>
<tr>
<td>
预算费用:
</td>
<td>
<html:text property="budgerMoney" />
</td>
</tr>

<tr>
<td>
立项时间:
</td>
<td>
<html:text property="liDate" />
</td>
</tr>
<tr>
<td>
大概利润:
</td>
<td>
<html:text property="gainMoney" />
</td>
</tr>




<tr>
<td colspan="2" align="center">
<html:submit>更新项目</html:submit>
</td>
<td>
<html:reset>重置</html:reset>
</td>
</tr>
</table>
</html:form>
</body>
</html:html>

下面是Action
package com.aptech.pz.struts.action;

import java.sql.Connection;
import java.sql.Statement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.hibernate.Session;

import com.aptech.hbm.HibernateSessionFactory;
import com.aptech.pojo.Radicate;
import com.aptech.pz.service.IRadicateService;
import com.aptech.pz.service.RadicateService;
import com.aptech.pz.struts.form.RadicateForm;
import com.aptech.pz.vo.RadicateVo;

import com.aptech.tools.ConsoleDate;

public class RadicateAction extends DispatchAction {

private IRadicateService rservice = new RadicateService();

/**
*
* 查询所有项目的方法
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward queryAll(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
List<RadicateVo> listvo = rservice.queryAll();
request.setAttribute("list", listvo);
return new ActionForward("/radicatelist.jsp");
}

/**
*
* @新建项目方法
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward insertRadicate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
RadicateForm radicateform = (RadicateForm) form;
RadicateVo rvo = new RadicateVo();

rvo.setCid(radicateform.getCid());
rvo.setUid(radicateform.getUid());
rvo.setBudgerMoney(radicateform.getBudgerMoney());
rvo.setGainMoney(radicateform.getGainMoney());
rvo.setLiDate(ConsoleDate.Date2String(radicateform.getLiDate()));

rvo.setName(radicateform.getName());
rvo.setType(radicateform.getType());
rvo.setPeople(radicateform.getPeople());
rvo.setPeriods(radicateform.getPeriods());
rvo.setSaleMoney(radicateform.getSaleMoney());

rservice.insertRadicate(rvo);
return new ActionForward("/radicateAction?r=queryAll");
}

/**
* 分页查询
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward queryByPage(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

List<RadicateVo> listvo = rservice.queryByPage(1, 5);
request.setAttribute("list", listvo);
return new ActionForward("/radicatelist.jsp");
}

/**
*
* 加载项目
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward loadRadicate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
RadicateForm radicateform = (RadicateForm) form;
String strid = request.getParameter("rid");
int rid = Integer.parseInt(strid);

RadicateVo rvo = rservice.loadRadicate(rid);

radicateform.setRid(rid);
radicateform.setName(rvo.getName());
radicateform.setType(rvo.getType());
radicateform.setCid(rvo.getCid());
radicateform.setUid(rvo.getUid());

radicateform.setCname(rvo.getCname());
radicateform.setUname(rvo.getUname());
radicateform.setSaleMoney(rvo.getSaleMoney());
radicateform.setBudgerMoney(rvo.getBudgerMoney());
radicateform.setLiDate(ConsoleDate.String2Date(rvo.getLiDate()));

radicateform.setPeople(rvo.getPeople());
radicateform.setPeriods(rvo.getPeriods());
radicateform.setGainMoney(rvo.getGainMoney());

return new ActionForward("/updateradicate.jsp");
}

/**
* 更新项目
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward updateRadicate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
RadicateForm radicateform = (RadicateForm) form;
RadicateVo rvo = new RadicateVo();

Connection con = HibernateSessionFactory.getSession().connection();
Statement stam = con.createStatement();
/*
* rvo.setRid(radicateform.getRid()); rvo.setUid(radicateform.getUid());
* rvo.setCid(radicateform.getCid());
* rvo.setBudgerMoney(radicateform.getBudgerMoney());
* rvo.setGainMoney(radicateform.getGainMoney());
*
* rvo.setName(radicateform.getName());
* rvo.setType(radicateform.getType());
* rvo.setLiDate(ConsoleDate.Date2String(radicateform.getLiDate()));
* rvo.setPeople(radicateform.getPeople());
* rvo.setPeriods(radicateform.getPeriods());
*
* rvo.setSaleMoney(radicateform.getSaleMoney());
*/

String sql = "update table `radicate` set `name`= '"
+ radicateform.getName() + "'," + "`type`='"
+ radicateform.getType() + "', `cid`=" + radicateform.getCid()
+ "," + "`sale_money`=" + radicateform.getSaleMoney()
+ " ,`periods`=" + radicateform.getPeriods() + ","
+ "`budger_money`=" + radicateform.getBudgerMoney()
+ " ,`li_date`='" + radicateform.getLiDate() + "'," + "`uid`="
+ radicateform.getUid() + " ,`people`="
+ radicateform.getPeople() + ", `gain_money`="
+ radicateform.getGainMoney() + "";

stam.executeQuery(sql);
// rservice.updateRadicate(rvo);

return new ActionForward("/radicateAction?r=queryAll");
}

/**
* 删除项目
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward deleteRadicate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
RadicateForm radicateform = (RadicateForm) form;
String strid = request.getParameter("rid");
int rid = Integer.parseInt(strid);

RadicateVo rvo = rservice.loadRadicate(rid);

rservice.deleteRadicate(rvo.getRid());
System.out.println("删除项目成功!!!");
return new ActionForward("/radicateAction.do?r=queryAll");
}


public ActionForward insertRadicate2(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Connection con = HibernateSessionFactory.getSession().connection();
Statement stam = con.createStatement();
String sql = "insert into `radicate` (`rid`, `name`, `type`, `cid`, `sale_money`, `periods`, `budger_money`, `li_date`, `uid`, `people`, `gain_money`)"
+ "VALUES (1,'风起公司的5万电脑采购','产品',1,150000,111,11,'2007-10-18',1,1121,468);";

stam.executeUpdate(sql);
return new ActionForward("/radicateAction.do?r=queryAll");
}

/**
* 条件查询
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward queryByWhere(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Map map = (Map) mapping;
RadicateForm radicateform = (RadicateForm) form;
String where = request.getParameter("where");
String val = request.getParameter("truevalue");

if(where.equals("cid")){
map.put("cid",val);
}
else if(where.equals("uid")){
map.put("uid", val);
}
else if(where.equals("name")){
map.put("name", val);
}else if(where.equals("type")){
map.put("type", val);
}


rservice.queryByWhere(1, 5, map);
return new ActionForward("/radicatelist.jsp");
}
}

各位,帮忙看看是什么原因
不知道怎么搞的,当点更新的时时候就不知道请求发送到那里去了,搞了好久都没搞出来,
出现的异常是这个呢,就是不知道为什么,我明明写的是updateRadicate


javax.servlet.ServletException: BeanUtils.populate
650)this.style.width=650;"> at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.aptech.filter.SessionFilter.doFilter(SessionFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)



搜索更多相关主题的帖子: jsp 页面 请求 
2007-10-25 15:49
penjew
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-10-23
收藏
得分:0 
BeanUtils.populate
2007-10-25 15:49
黄袖标
Rank: 4
等 级:贵宾
威 望:13
帖 子:676
专家分:0
注 册:2007-3-22
收藏
得分:0 
重新下个apache的beanutils包,再44

我胡汉三又回来啦!物是人非啊,只有静夜思大大还在。
2007-11-07 18:22
快速回复:[求助]为什么用struts2.0的默认 jsp页面发送请求不知道传到什么地方去 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.058376 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved