📄 getdownloadaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package org.adam.struts.action;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;
import org.adam.bean.Download;
import org.adam.bean.DB;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
* MyEclipse Struts
* Creation date: 08-12-2008
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class GetDownLoadAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
int download_id=Integer.parseInt(request.getParameter("download_id"));
ServletContext context=servlet.getServletContext();
DataSource ds=(DataSource)context.getAttribute("download");
DB db=new DB(ds);
HttpSession session=request.getSession();
Download down=Download.getDownload(db, download_id);
session.setAttribute("download",down);
int visitcount=down.getVisitcount()+1;
Download d=new Download();
d.setVisitcount(visitcount);
//ServletContext context=servlet.getServletContext();
//DataSource ds=(DataSource)context.getAttribute("download");
DB db1=new DB(ds);
d.updateVisitcount(db1, download_id);
return mapping.findForward("download");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -