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

📄 linkadd.java

📁 前台:文章浏览、发表留言、Game、Music 后台:文章相关:发表文章、修改文章、删除文章、批量移动文章 栏目相关:增加栏目、修改栏目、删除栏目、栏目链接、栏目排序系统栏目分为系统内部栏目和外部栏目
💻 JAVA
字号:
package com.yhcms.manage.info.action;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
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 org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import com.yhcms.artclass.bean.ArtClass;
import com.yhcms.cmsinfo.bean.Link;
import com.yhcms.cmsinfo.dao.CmsInfoDaoIm;
import com.yhcms.cmsinfo.itface.CmsInfoDao;
import com.yhcms.db.DBConnException;
import com.yhcms.utils.ReqUtils;
/**
 * <p>Title:增加友情链接Action</p>
 * <li>跳转到增加友情链接页面</li>
 * <br><b>CopyRight: yyhweb[由由华网]</b>
 * @author stephen
 * @version YH-2.0
 */
public class LinkAdd extends Action {
	public ActionForward execute(ActionMapping actionmapping,ActionForm form,
			 HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException{
		
			Logger yhlog = Logger.getLogger(ArtClass.class.getName());
			ActionMessages errors = new ActionMessages();
			
			String action = "";
			int linkId = 0;
			String type = "0";
			String check = "0";
			
			action = ReqUtils.getString(request,"action");
			linkId = ReqUtils.getInt(request,"Id");
			Link curLink = null;
			CmsInfoDao infodao = CmsInfoDaoIm.getInstance();
			// 	 更新友情链接
			if(action.equals("update")){
				try {
					curLink = infodao.getLink(linkId);
					type = curLink.getType();
					check = curLink.getChecked();
				} catch (DBConnException e) {
					yhlog.info("When update a link,throw an Exception!");		
					errors.add("admin.link.update.expt",new ActionMessage("admin.link.update.expt"));
					saveErrors(request,errors);
				}
			}
			//	 若没有取得链接,则初始化.
			if(curLink == null){	
				curLink = new Link();
			}
			request.setAttribute("type", type);
			request.setAttribute("check", check);
			request.setAttribute("onelink",curLink);
			return actionmapping.findForward("Success");		
	}

}

⌨️ 快捷键说明

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