package com.wgh.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;
import com.wgh.actionForm.ShortInfoForm;
import com.wgh.core.ChStr;
import com.wgh.dao.ShortInfoDAO;
public class ShortInfo extends Action{
private ShortInfoDAO shortInfoDAO = null;
private ChStr chStr=new ChStr();
public ShortInfo() {
this.shortInfoDAO = new ShortInfoDAO();
}
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){
String action = request.getParameter("action");
System.out.println("获取的查询字符串:" + action);
if (action == null || "".equals(action)) {
return mapping.findForward("error");
}else if ("shortInfoQuery".equals(action)) {
return shortInfoQuery(mapping, form, request,response);
}else if("type".equals(action)){
return type(mapping, form, request,response);
}else if("shortInfoAdd".equals(action)){
return shortInfoAdd(mapping, form, request,response);
}else if("shortInfoDel".equals(action)){
return shortInfoDel(mapping, form, request,response);
} else if("shortInfoModifyQ".equals(action)){
return shortInfoQueryModify(mapping, form, request,response);
}else if("shortInfoModify".equals(action)){
return shortInfoModify(mapping, form, request,response);
}else if("selectShortInfo".equals(action)){
return selectShortInfo(mapping,form,request,response);
}
request.setAttribute("error", "操作失败!");
return mapping.findForward("error");
}
//查询常用短语
private ActionForward shortInfoQuery(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
request.setAttribute("shortInfoQuery", shortInfoDAO.query(null));
return mapping.findForward("shortInfoQuery");
}
//发送短信时选择常用短语
private ActionForward selectShortInfo(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response){
ShortInfoForm shortInfoForm = (ShortInfoForm) form;
shortInfoForm.setTypeID(Integer.parseInt(request.getParameter("id")));
request.setAttribute("selectShortInfo",shortInfoDAO.query(shortInfoForm));
return mapping.findForward("selectShortInfo");
}
//查询类别信息
private ActionForward type(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
request.setAttribute("typeQuery", shortInfoDAO.queryType(null));
return mapping.findForward("typeQuery");
}
//添加常用短语
private ActionForward shortInfoAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
ShortInfoForm shortInfoForm = (ShortInfoForm) form;
//此处需要进行中文转码
shortInfoForm.setContent(chStr.toChinese(shortInfoForm.getContent()));
int ret = shortInfoDAO.insert(shortInfoForm);
System.out.println("返回值ret:"+ret);
if (ret == 1) {
return mapping.findForward("shortInfoAdd");
} else if(ret==2){
request.setAttribute("error","该常用短语已经添加!");
return mapping.findForward("error");
}else {
request.setAttribute("error","添加常用短语失败!");
return mapping.findForward("error");
}
}
//修改常用短语的查询
private ActionForward shortInfoQueryModify(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
ShortInfoForm shortInfoForm = (ShortInfoForm) form;
shortInfoForm.setID(Integer.parseInt(request.getParameter("id")));
request.setAttribute("shortInfoQuery",shortInfoDAO.query(shortInfoForm));
request.setAttribute("typeQuery", shortInfoDAO.queryType(null));
return mapping.findForward("shortInfoQueryModify");
}
//修改常用短语
private ActionForward shortInfoModify(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response){
ShortInfoForm shortInfoForm=(ShortInfoForm) form;
//此处需要进行中文转码
shortInfoForm.setContent(chStr.toChinese(shortInfoForm.getContent()));
int ret=shortInfoDAO.update(shortInfoForm);
if(ret==0){
request.setAttribute("error","修改常用短语失败!");
return mapping.findForward("error");
}else{
return mapping.findForward("shortInfoModify");
}
}
//删除常用短语
private ActionForward shortInfoDel(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
ShortInfoForm shortInfoForm = (ShortInfoForm) form;
shortInfoForm.setID(Integer.parseInt(request.getParameter("id")));
int ret = shortInfoDAO.delete(shortInfoForm);
if (ret == 0) {
request.setAttribute("error","删除常用短语失败!");
return mapping.findForward("error");
} else {
return mapping.findForward("shortInfoDel");
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
企业级收发邮件系统(sturts+jsp+sql)
共129个文件
jsp:37个
class:26个
java:26个
4星 · 超过85%的资源 需积分: 10 36 下载量 171 浏览量
2009-11-26
17:10:37
上传
评论
收藏 829KB RAR 举报
温馨提示
企业级收发邮件系统(sturts+jsp+sql). 企业级收发邮件系统(sturts+jsp+sql). 功能强大。。。。
资源推荐
资源详情
资源评论
收起资源包目录
企业级收发邮件系统(sturts+jsp+sql) (129个子文件)
SendLetterDAO.class 6KB
Manager.class 5KB
SendMailDAO.class 4KB
ShortInfo.class 4KB
Personnel.class 4KB
Customer.class 4KB
CustomerDAO.class 4KB
ShortInfoDAO.class 4KB
PersonnelDAO.class 4KB
SendLetter.class 4KB
ManagerDAO.class 3KB
ConnDB.class 3KB
InfoType.class 3KB
SendMail.class 3KB
ParameterDAO.class 2KB
Parameter.class 2KB
InfoTypeDAO.class 2KB
PersonnelForm.class 2KB
CustomerForm.class 2KB
SendMailForm.class 1KB
SendLetterForm.class 1KB
ShortInfoForm.class 1KB
ManagerForm.class 1KB
ParameterForm.class 1KB
ChStr.class 930B
InfoTypeForm.class 761B
style.css 2KB
readme.doc 234KB
login_bottom.gif 77KB
login_top.gif 71KB
login_mid.gif 42KB
upFile_bg.gif 19KB
center_b.gif 10KB
left_title.gif 4KB
selectS_top.gif 3KB
item_over.gif 2KB
item_out.gif 2KB
error_b.gif 2KB
add.gif 587B
left_bg.gif 231B
selectS_bottom.gif 152B
jia.gif 129B
jian.gif 125B
selectS_right.gif 49B
selectS_left.gif 49B
ShortInfo.java 6KB
Manager.java 6KB
SendLetterDAO.java 5KB
Personnel.java 5KB
Customer.java 5KB
SendLetter.java 4KB
ManagerDAO.java 4KB
ShortInfoDAO.java 3KB
ConnDB.java 3KB
CustomerDAO.java 3KB
PersonnelDAO.java 3KB
InfoType.java 3KB
SendMailDAO.java 3KB
SendMail.java 3KB
Parameter.java 2KB
CustomerForm.java 2KB
InfoTypeDAO.java 2KB
PersonnelForm.java 2KB
ParameterDAO.java 2KB
SendMailForm.java 1KB
ParameterForm.java 1010B
SendLetterForm.java 876B
ShortInfoForm.java 735B
ManagerForm.java 691B
ChStr.java 567B
InfoTypeForm.java 390B
main.jpg 104KB
top_bg.jpg 70KB
bottom_bg.jpg 34KB
navigate_bg.jpg 28KB
error.jpg 27KB
subBG.jpg 26KB
menu.JS 4KB
function.js 2KB
onclock.JS 720B
sendMail.jsp 6KB
sendLetter.jsp 6KB
personnel_modify.jsp 5KB
customer_modify.jsp 5KB
navigation.jsp 5KB
personnel_add.jsp 5KB
customer_add.jsp 4KB
personnel.jsp 3KB
pwd_Modify.jsp 3KB
customer.jsp 3KB
login.jsp 3KB
shortInfo_modify.jsp 3KB
manager.jsp 3KB
sysParameter.jsp 3KB
shortInfo.jsp 3KB
infoType.jsp 3KB
shortInfo_add.jsp 3KB
history.jsp 3KB
manager_add.jsp 2KB
getLetter.jsp 2KB
共 129 条
- 1
- 2
资源评论
- 天涯泪小武2012-11-29不得不说功能太多了,有点看不懂了
iguohao
- 粉丝: 200
- 资源: 269
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功