newscontentaction.java

来自「这是一个上传下载的原代码」· Java 代码 · 共 41 行

JAVA
41 行
字号
package com.model.action;

import java.util.Map;

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.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.model.entity.UserInfo;
import com.model.logic.ClientLogic;

public class NewsContentAction extends Action{
	public ClientLogic clientLogic;
	public ClientLogic getClientLogic() {
		return clientLogic;
	}
	public void setClientLogic(ClientLogic clientLogic) {
		this.clientLogic = clientLogic;
	}
	
	public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){
		HttpSession session = request.getSession(true);
		UserInfo userInfo = new UserInfo();
		userInfo = (UserInfo)session.getAttribute("userInfo");
		if(userInfo != null){
			String newsId = (String)request.getParameter("newsId");
			Map map = this.getClientLogic().queryNewsContent(newsId);
			request.setAttribute("newsContent", map);
			return mapping.findForward("ok");
		}else{
			request.setAttribute("exit", "yes");
			return mapping.findForward("no");
		}
	}
}

⌨️ 快捷键说明

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