资源简介
使用的工具为:
数据库为mysql,服务器为tomcat
步骤如下:
1、把*.zip的文件包解压
2、从eclipse中导入,解压好的文件,建立的是一个WEB工程
3、导入工程下/WebRoot/WEB-INF/lib下的所有jar包
4、在mysql导入release文件下建表脚本的sql语句(为了防止乱码,建议使用QuantumDB插件)
5、修改hibernate.cfg.xml中的mysql数据库的用户名和密码
6、部署到tomcat的服务器上运行就可以了。
代码片段和文件信息
package com.tarena.pfm.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.MappingDispatchAction;
import com.tarena.pfm.biz.FixedAssetsBiz;
import com.tarena.pfm.biz.ItemBiz;
import com.tarena.pfm.biz.impl.FixedAssetsBizImpl;
import com.tarena.pfm.biz.impl.ItemBizImpl;
import com.tarena.pfm.entity.FixedAssets;
import com.tarena.pfm.entity.Item;
import com.tarena.pfm.entity.User;
import com.tarena.pfm.form.FixedAssetForm;
import com.tarena.pfm.form.ItemForm;
public class AccountAction extends MappingDispatchAction {
private ItemBiz itemBiz = new ItemBizImpl();
private FixedAssetsBiz fixedBiz = new FixedAssetsBizImpl();
public ActionForward addLifeItem(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
ItemForm itemForm = (ItemForm) form;
Item lifeItem = itemForm.getLifeItem();
lifeItem.setUser((User) session.getAttribute(“user“));
itemBiz.addItem(lifeItem);
session.setAttribute(“message“ “添加收支项目成功!“);
return mapping.findForward(“success“);
}
public ActionForward addDebtItem(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
ItemForm itemForm = (ItemForm) form;
Item debtItem = itemForm.getDebtItem();
debtItem.setUser((User) session.getAttribute(“user“));
itemBiz.addItem(debtItem);
session.setAttribute(“message“ “添加债务项目成功!“);
return mapping.findForward(“success“);
}
public ActionForward listItems(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {
User user = (User) request.getSession().getAttribute(“user“);
List- items = itemBiz.findItemsByUserId(user.getId());
request.setAttribute(“items“ items);
return mapping.findForward(“success“);
}
public ActionForward removeItem(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {
Integer itemId = Integer.valueOf(request.getParameter(“itemId“));
boolean flag = itemBiz.removeItemById(itemId);
if (!flag) {
request.getSession().setAttribute(“message“ “该项目已经被账目所使用不能被删除!“);
return mapping.findForward(“fail“);
}
return mapping.findForward(“success“);
}
public ActionForward addFixedAsset(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
FixedAssetForm faForm = (FixedAssetForm) form;
FixedAss
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2009-04-15 15:50 financing\
文件 1803 2009-04-15 15:32 financing\.classpath
目录 0 2009-04-15 15:28 financing\.myeclipse\
文件 300 2009-04-15 15:28 financing\.myme
文件 1227 2009-04-15 15:33 financing\.project
目录 0 2009-04-15 15:32 financing\.settings\
文件 88 2009-04-15 15:32 financing\.settings\org.eclipse.core.resources.prefs
文件 330 2009-04-15 15:28 financing\.settings\org.eclipse.jdt.core.prefs
目录 0 2009-04-15 16:13 financing\release\
文件 13692274 2009-04-15 16:13 financing\release\financing.war
目录 0 2009-04-15 15:56 financing\release\建表脚本\
文件 1016 2009-04-15 16:17 financing\release\建表脚本\create.sql
文件 82 2009-04-15 16:15 financing\release\建表脚本\insert.sql
目录 0 2009-04-15 16:12 financing\release\设计\
文件 150528 2009-04-15 16:12 financing\release\设计\系统需求分析(Ver1.0.0).doc
目录 0 2009-04-15 15:29 financing\src\
目录 0 2009-04-15 15:29 financing\src\com\
目录 0 2009-04-15 15:29 financing\src\com\tarena\
目录 0 2009-04-15 15:29 financing\src\com\tarena\pfm\
目录 0 2009-04-15 15:29 financing\src\com\tarena\pfm\action\
文件 4823 2008-05-25 12:34 financing\src\com\tarena\pfm\action\AccountAction.java
文件 2659 2008-05-25 10:10 financing\src\com\tarena\pfm\action\UserAction.java
文件 5602 2008-05-25 16:33 financing\src\com\tarena\pfm\action\WasteBookAction.java
文件 140 2008-05-24 19:36 financing\src\com\tarena\pfm\ApplicationResource.properties
文件 235 2008-05-24 19:37 financing\src\com\tarena\pfm\ApplicationResource_zh.properties
目录 0 2009-04-15 15:29 financing\src\com\tarena\pfm\biz\
文件 405 2008-05-20 18:18 financing\src\com\tarena\pfm\biz\FixedAssetsBiz.java
目录 0 2009-04-15 15:29 financing\src\com\tarena\pfm\biz\impl\
文件 2706 2008-05-20 18:49 financing\src\com\tarena\pfm\biz\impl\FixedAssetsBizImpl.java
文件 2436 2008-05-25 11:38 financing\src\com\tarena\pfm\biz\impl\ItemBizImpl.java
文件 2961 2008-05-20 18:35 financing\src\com\tarena\pfm\biz\impl\UserBizImpl.java
............此处省略192个文件信息
评论
共有 条评论