【Java开源代码栏目提醒】:网学会员为广大网友收集整理了,ContentAction.java,希望对大家有所帮助!
package com.myEdition.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//导入struts包
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.myEdition.bean.Content;
import com.myEdition.domain.SetContentType;
import com.myEdition.domain.Edit;
//继承action
public class ContentAction extends Action {
private SetContentType setContentType;
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
//获取用户提交的信息
String username = (String)request.getParameter("username");
String userId = (String)request.getParameter("userId");
//获取内容类别
List contentTypes = getSetContentType().queryContentType();
//将用户提交的信息和是否保存成功的信息存放在request中
request.setAttribute("contentTypes", contentTypes);
request.setAttribute("username", username);
request.setAttribute("userId", userId);
//返回页面
return mapping.findForward("success");
}
/**返回setContentType
*/
public SetContentType getSetContentType() {
return setContentType;
}
/**设定setContentType
*/
public void setSetContentType(SetContentType setContentType) {
this.setContentType = setContentType;
}
}
上一篇:
Content.java
下一篇:
扛起年轻化大旗,哈弗F系玩转行业新风潮