📄 wsedit.java
字号:
package com.stsc.archive.jygl;
//
import java.io.IOException;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Properties;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Locale;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
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.ActionServlet;
import org.apache.struts.util.MessageResources;
import com.stsc.util.STPoolDataSet;
import com.stsc.util.STResultSet;
import com.stsc.archive.jygl.*;
import java.util.Date;
public final class Wsedit extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
System.out.println("mapping.getAttribute(): = " + mapping.getAttribute());
System.out.println("mapping.getScope(): = " + mapping.getScope());
String serialno = ""; // 文件流水号
String title = ""; // 文件(案卷)题名
String archivalcode = ""; // 存址号
String applicant = ""; // 申请人
String applytime = ""; // 申请借阅时间
String reason = ""; // 申请理由
String approver = ""; // 审批人
String approvetime = ""; // 审批时间
String approvesuggest = ""; // 审批意见
String replier = ""; // 答复人
String replytime = ""; // 答复时间
String replysuggest = ""; // 答复意见
String applystatus = ""; // 申请的状态
String todayStr = "";
int serialno_jy =0;
int borrowapplyid;
STPoolDataSet data = new STPoolDataSet();
STResultSet rs;
Properties dbBase = new Properties();
dbBase.setProperty("dsJndiName",Constants.DATABASE_KEY);
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
todayStr = sdf.format(new java.util.Date());
// Extract attributes we will need
Locale locale = getLocale(request);
MessageResources messages = getResources();
HttpSession session = request.getSession();
// Validate the request parameters specified by the user
ActionErrors errors = new ActionErrors();
String action = request.getParameter("action");
if (action==null) action="Create";
System.out.println("##############action==="+action);
// Archive archive = null;
JyForm jyform =null;
if (action.equals("Create")) {
jyform = new JyForm();
applytime = todayStr;
}
jyform = (JyForm) form;
jyform.setAction(action);
if(action.equals("Jysq")){
System.out.println("##############444444444444444444444==="+action);
serialno_jy=Integer.parseInt(request.getParameter("serialno"));
String sql6="select * from fArchive WHERE SerialNo="+serialno_jy+"";
rs=data.getSTResult(sql6,dbBase);
while (rs!=null && rs.next())
{
// serialno = String.valueOf(rs.getInt("SerialNo"));
// 由于在fArchive中的流水号改为flowno
serialno = rs.getString("FlowNo");
title = rs.getString("Title") ;
archivalcode = rs.getString("ArchivalCode");
applytime = todayStr;
}
}
if(action.equals("wsdf")){
borrowapplyid=Integer.parseInt(request.getParameter("borrowapplyid"));
String sql11="select * from fReadApply WHERE borrowapplyid="+borrowapplyid+"";
rs=data.getSTResult(sql11,dbBase);
while (rs!=null && rs.next())
{
serialno = rs.getString("SerialNo");
title = rs.getString("Title") ;
archivalcode = rs.getString("ArchivalCode");
applicant = rs.getString("Applicant");
applytime = String.valueOf(rs.getDate("ApplyTime"));
reason = rs.getString("Reason");
replytime = todayStr;
}
}
if(action.equals("Edit")){
borrowapplyid=Integer.parseInt(request.getParameter("borrowapplyid"));
String sql="select * from fReadApply WHERE borrowapplyid="+borrowapplyid+"";
rs = data.getSTResult(sql, dbBase);
while (rs!=null && rs.next())
{
serialno = rs.getString("SerialNo");
title = rs.getString("Title") ;
archivalcode = rs.getString("ArchivalCode");
applicant = rs.getString("Applicant");
applytime = String.valueOf(rs.getDate("ApplyTime"));
reason = rs.getString("Reason");
}
}
if(action.equals("See")){
borrowapplyid=Integer.parseInt(request.getParameter("borrowapplyid"));
String sql="select * from fReadApply WHERE borrowapplyid="+borrowapplyid+"";
rs = data.getSTResult(sql, dbBase);
while (rs!=null && rs.next())
{
serialno = rs.getString("SerialNo");
title = rs.getString("Title") ;
archivalcode = rs.getString("ArchivalCode");
applicant = rs.getString("Applicant");
applytime = String.valueOf(rs.getDate("ApplyTime"));
reason = rs.getString("Reason");
approver = rs.getString("Approver");
approvetime = String.valueOf(rs.getDate("ApproveTime"));
approvesuggest = rs.getString("ApproveSuggest");
replier = rs.getString("Replier");
replytime = String.valueOf(rs.getDate("ReplyTime"));
replysuggest = rs.getString("ReplySuggest");
applystatus = rs.getString("ApplyStatus");
if(replytime.equals("null")){
replytime="";
}
if(approvetime.equals("null")){
approvetime="";
}
}
}
if(action.equals("Sqcl")){
borrowapplyid=Integer.parseInt(request.getParameter("borrowapplyid"));
String sql="select * from fReadApply WHERE borrowapplyid="+borrowapplyid+"";
rs = data.getSTResult(sql, dbBase);
while (rs!=null && rs.next())
{
serialno = rs.getString("SerialNo");
title = rs.getString("Title") ;
archivalcode = rs.getString("ArchivalCode");
applicant = rs.getString("Applicant");
applytime = String.valueOf(rs.getDate("ApplyTime"));
reason = rs.getString("Reason");
}
}
if(action.equals("ecsp")){
borrowapplyid=Integer.parseInt(request.getParameter("borrowapplyid"));
String sql="select * from fReadApply WHERE borrowapplyid="+borrowapplyid+"";
rs = data.getSTResult(sql, dbBase);
while (rs!=null && rs.next())
{
serialno = rs.getString("SerialNo");
title = rs.getString("Title") ;
archivalcode = rs.getString("ArchivalCode");
applicant = rs.getString("Applicant");
applytime = String.valueOf(rs.getDate("ApplyTime"));
reason = rs.getString("Reason");
}
}
try {
jyform.setserialno(serialno);
jyform.settitle(title);
jyform.setarchivalcode(archivalcode);
jyform.setapplicant(applicant);
jyform.setapplytime(applytime);
jyform.setreason(reason);
jyform.setapprover(approver);
if(action.equals("See")){
jyform.setapprovetime(approvetime);
}else{
jyform.setapprovetime(todayStr);
}
jyform.setapprovesuggest(approvesuggest);
jyform.setreplier(replier);
jyform.setreplytime(replytime);
jyform.setreplysuggest(replysuggest);
jyform.setapplystatus(applystatus);
} catch (Throwable t) {
System.out.println("SubscriptionForm.populate" + t);
servlet.log("SubscriptionForm.populate", t);
throw new ServletException("SubscriptionForm.populate", t);
}
// Report any errors we have discovered back to the original form
if (!errors.empty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput()));
}
// Forward control to the specified success URI
//System.out.println("mapping.findForward(\"success\")=" + mapping.findForward("success"));
return (mapping.findForward("success"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -