?? fileshareaction.java
字號:
/*
* 創(chuàng)建日期 2005-12-11
*
* TODO 要更改此生成的文件的模板,請轉(zhuǎn)至
* 窗口 - 首選項 - 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 要更改此生成的類型注釋的模板,請轉(zhuǎn)至
* 窗口 - 首選項 - 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 + -