📄 chulialwaysaction.java
字号:
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.1/xslt/JavaClass.xslpackage com.yourcompany.struts.action;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.ActionErrors;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.apache.struts.action.ActionMessage;import admin.DataControl;public class ChulialwaysAction extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ActionErrors err = new ActionErrors(); HttpSession session = request.getSession(); try{ request.setCharacterEncoding("GBK"); System.out.println(""); System.out.println("开始chulialwaysaction"); String dept = request.getParameter("dept"); System.out.println(dept); String id = request.getParameter("id"); System.out.println(id); String time = request.getParameter("time"); System.out.println(time); String FCKeditor1s[] = request.getParameterValues("FCKeditor1"); String FCKeditor1 = ""; for (int x = 0; x < FCKeditor1s.length; x++) { FCKeditor1 = FCKeditor1+FCKeditor1s[x]; } System.out.println(FCKeditor1.length()); if(FCKeditor1.length()>8000){ err.add("err",new ActionMessage("chuli.insert.error","公告内容不得大于8000字")); this.saveErrors(request,err); return mapping.getInputForward(); } FCKeditor1 = FCKeditor1.replace("'","''"); System.out.println("titles.length: "+FCKeditor1s.length); System.out.println(FCKeditor1); DataControl data = new DataControl(); String sql = "insert into chuli(fabuid,dept,content,chuliid,timea) values("+id+",'"+dept+"','"+FCKeditor1+"',dbo.fun2("+id+",'"+dept+"'),'"+time+"')"; System.out.println(sql); int i = data.getInsert(sql); System.out.println(i); data.close(); DataControl data1 = new DataControl(); String sql1 = "update fabudept set completed=1 where fabuid="+id+" and dept='"+dept+"'"; int i1 = data1.getUpdate(sql1); System.out.println(i1); data1.close(); session.setAttribute("ok","处理文件成功"); }catch(Exception e){ System.out.println("处理文件失败"+e.getStackTrace()); err.add("err",new ActionMessage("chuli.insert.error","处理文件失败")); this.saveErrors(request,err); return mapping.getInputForward(); } return mapping.findForward("ok"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -