⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 office_favo_modifyaction.java

📁 这个程序是花了好几十万请人开发的
💻 JAVA
字号:
package struts.action;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.ActionError;import org.apache.struts.action.ActionErrors;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import struts.form.Office_favo_modifyForm;import javabean.*;import java.sql.*;/* *  * @author 郑文金 * * 这个action用于修改"我的收藏"中的网址 * */public class Office_favo_modifyAction extends Action {		private ConnectionPool pool;	private Connection con;	public Office_favo_modifyAction() throws SQLException	{		pool=ConnectionPool.getInstance();               //初始化连接池		}		public ActionForward execute(		ActionMapping mapping,		ActionForm form,		HttpServletRequest request,		HttpServletResponse response)		throws Exception 	{		Office_favo_modifyForm favo_modify =(Office_favo_modifyForm) form;		CodeString getstring=new CodeString();		con=pool.getConnection();  //从池中获得一个连接		Favoritedao favodao=new Favoritedao(con);				String Kind=favo_modify.getKIND();//获取网站的类别			Kind=getstring.getString(Kind);		String Name=favo_modify.getNAME();//获取网站的网址			Name=getstring.getString(Name);		String Id=favo_modify.getID();		request.setAttribute("Id",Id);//获取ID		String s1="update Favorite set KIND= "+"'"+Kind+"'"+"where ID= "+"'"+Id+"'";		String s2="update Favorite set NAME= "+"'"+Name+"'"+"where ID= "+"'"+Id+"'";				favodao.update(s1);		favodao.update(s2);		ActionErrors errors=new ActionErrors();		errors.add("favo_modify.success",new ActionError("office_favo_modify.success"));		saveErrors(request,errors);//返回提交成功后的信息				favo_modify.reset(mapping,request);//清空表单中的内容		con.commit();		if(con!=null)		{			con.close();		}		return mapping.findForward("office_favo_modify");//返回到"修改"页面		}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -