HintAction.java
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:3k
源码类别:
Jsp/Servlet
开发平台:
Java
- //Created by MyEclipse Struts
- // XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.0/xslt/JavaClass.xsl
- package com.oa.module.hints;
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.util.Map;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.servlet.http.HttpSession;
- 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 com.oa.module.office.user.Tuser;
- /**
- * MyEclipse Struts
- * Creation date: 01-26-2008
- *
- * XDoclet definition:
- * @struts.action path="/hint" name="hintForm" input="/Jsp_file/user/sethint.jsp" scope="request" validate="true"
- */
- public class HintAction extends DispatchAction {
- // --------------------------------------------------------- Instance Variables
- private HintsDAO hintdao ;
- // --------------------------------------------------------- Methods
- /**
- * Method execute
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return ActionForward
- */
- public ActionForward editshow(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) {
- HintForm hintForm = (HintForm) form;
- HttpSession session = request.getSession();
- Tuser user = (Tuser) session.getAttribute("user");
- Map map = hintdao.getHintsByUserId(user.getUno());
- hintForm.setHshowtype((String) map.get("hshowtype"));
- hintForm.setHaffair((String) map.get("haffair"));
- hintForm.setHmeeting((String)map.get("hmeeting"));
- hintForm.setHemail((String)map.get("hemail"));
- request.setAttribute("hint",map);
- return mapping.findForward("editshow");
- }
- /**
- * Method update
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return ActionForward
- * @throws IOException
- */
- public ActionForward update(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException {
- HintForm hintForm = (HintForm) form;
- PrintWriter out = response.getWriter();
- String contextPath = request.getContextPath();
- if (hintdao.updateHints(hintForm)){
- out.print("<script>");
- out.print("alert('修改个人贴士成功!');");
- out.print("top.topFrame.location.href ='"+contextPath+"/login.do?method=settop';");
- out.print("location.href ='"+contextPath+"/login.do?method=main';");
- out.print("</script>");
- }else{
- out.print("<script>");
- out.print("alert('修改个人贴士失败!');");
- out.print("history.back();");
- out.print("</script>");
- }
- return null;
- }
- public HintsDAO getHintdao() {
- return hintdao;
- }
- public void setHintdao(HintsDAO hintdao) {
- this.hintdao = hintdao;
- }
- }