📄 fileshareaction.java
字号:
/*
* 创建日期 2005-12-11
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package bit.jeffy.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.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 bit.jeffy.db.DataStore;
import java.sql.SQLException;
/**
* @author jeffy
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class FileShareAction extends Action {
/* (非 Javadoc)
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public ActionForward execute(ActionMapping map, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO 自动生成方法存根
ActionErrors errors = new ActionErrors();
HttpSession s = request.getSession();
String str_1 = (String)request.getParameter("t_page");
String user = (String)s.getAttribute("current_user");
String filename = (String)request.getParameter("file");
String activity = (String)request.getParameter("activity");
String sql = null;
DataStore ds = null;
if( filename == null || activity == null ) {
errors.add("fail_1",new ActionError("file.share.action.a"));
saveErrors(request,errors);
return (map.findForward("filesharefail"));
}
user = new String(user.getBytes("ISO-8859-1"),"GB2312");
filename = new String(filename.getBytes("ISO-8859-1"),"GB2312");
if( user == null ) {
errors.add("fail_2",new ActionError("file.share.action.b"));
saveErrors(request,errors);
return (map.findForward("filesharefail"));
}
if( activity.equals("share") ) {
sql = "update ClientFile set IFPUBLIC='1' where ZH='"+user+"' and FILENAME='"+filename+"'";
}else {
sql = "update ClientFile set IFPUBLIC='0' where ZH='"+user+"' and FILENAME='"+filename+"'";
}
try {
ds = DataStore.getInstance();
ds.execute(sql);
}catch(Exception e) {
errors.add("fail_3",new ActionError("file.share.action.c"));
saveErrors(request,errors);
return (map.findForward("filesharefail"));
}
if( str_1 != null ){
request.setAttribute("page",str_1);
}
request.setAttribute("view","2");
return (map.findForward("fileshareok"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -