HintAction.java
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:3k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. //Created by MyEclipse Struts
  2. // XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.0/xslt/JavaClass.xsl
  3. package com.oa.module.hints;
  4. import java.io.IOException;
  5. import java.io.PrintWriter;
  6. import java.util.Map;
  7. import javax.servlet.http.HttpServletRequest;
  8. import javax.servlet.http.HttpServletResponse;
  9. import javax.servlet.http.HttpSession;
  10. import org.apache.struts.action.Action;
  11. import org.apache.struts.action.ActionForm;
  12. import org.apache.struts.action.ActionForward;
  13. import org.apache.struts.action.ActionMapping;
  14. import org.apache.struts.actions.DispatchAction;
  15. import com.oa.module.office.user.Tuser;
  16. /** 
  17.  * MyEclipse Struts
  18.  * Creation date: 01-26-2008
  19.  * 
  20.  * XDoclet definition:
  21.  * @struts.action path="/hint" name="hintForm" input="/Jsp_file/user/sethint.jsp" scope="request" validate="true"
  22.  */
  23. public class HintAction extends DispatchAction {
  24. // --------------------------------------------------------- Instance Variables
  25. private HintsDAO hintdao ;
  26. // --------------------------------------------------------- Methods
  27. /** 
  28.  * Method execute
  29.  * @param mapping
  30.  * @param form
  31.  * @param request
  32.  * @param response
  33.  * @return ActionForward
  34.  */
  35. public ActionForward editshow(
  36. ActionMapping mapping,
  37. ActionForm form,
  38. HttpServletRequest request,
  39. HttpServletResponse response) {
  40. HintForm hintForm = (HintForm) form;
  41. HttpSession session = request.getSession();
  42. Tuser user = (Tuser) session.getAttribute("user");
  43. Map map = hintdao.getHintsByUserId(user.getUno());
  44. hintForm.setHshowtype((String) map.get("hshowtype"));
  45. hintForm.setHaffair((String) map.get("haffair"));
  46. hintForm.setHmeeting((String)map.get("hmeeting"));
  47. hintForm.setHemail((String)map.get("hemail"));
  48. request.setAttribute("hint",map);
  49. return mapping.findForward("editshow");
  50. }
  51. /** 
  52.  * Method update
  53.  * @param mapping
  54.  * @param form
  55.  * @param request
  56.  * @param response
  57.  * @return ActionForward
  58.  * @throws IOException 
  59.  */
  60. public ActionForward update(
  61. ActionMapping mapping,
  62. ActionForm form,
  63. HttpServletRequest request,
  64. HttpServletResponse response) throws IOException {
  65. HintForm hintForm = (HintForm) form;
  66. PrintWriter out = response.getWriter();
  67. String contextPath = request.getContextPath();
  68. if (hintdao.updateHints(hintForm)){
  69. out.print("<script>");
  70. out.print("alert('修改个人贴士成功!');");
  71. out.print("top.topFrame.location.href ='"+contextPath+"/login.do?method=settop';");
  72. out.print("location.href ='"+contextPath+"/login.do?method=main';");
  73. out.print("</script>");
  74. }else{
  75. out.print("<script>");
  76. out.print("alert('修改个人贴士失败!');");
  77. out.print("history.back();");
  78. out.print("</script>");
  79. }
  80. return null;
  81. }
  82. public HintsDAO getHintdao() {
  83. return hintdao;
  84. }
  85. public void setHintdao(HintsDAO hintdao) {
  86. this.hintdao = hintdao;
  87. }
  88. }