?? customeraddtopicarticleaction.java
字號:
/*
* 作者:管磊
* 時間:2007年11月27日
* 功能:添加會員博客主題文章
*/
package com.mole.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.mole.struts.dao.CustomerAddSonDAO;
/**
* path:/customerAddTopicArticle.do MyEclipse Struts Creation date: 11-27-2007
*
* XDoclet definition:
*
* @struts.action validate="true"
*/
public class CustomerAddTopicArticleAction extends Action {
private CustomerAddSonDAO dao;
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String userid = String.valueOf(request.getSession()
.getAttribute("user"));
String content = null;
String title = null;
String articleType = null;
String state = request.getParameter("state");
String insertSql = null;
String nickname = request.getSession().getAttribute("nickname")
.toString();
if (userid == null)
return new ActionForward("/index.jsp");// 驗證
if (dao == null)
dao = new CustomerAddSonDAO();
if (state == null) {
return new ActionForward("/customerAddArticle.jsp");
} else {
content = request.getParameter("content");
title = request.getParameter("title");
articleType = request.getParameter("select");
// 向數據庫中插入會員博客文章。有內容,時間,標題,博客類型
insertSql = "insert into blogloglist values('" + content
+ "',getDate(),0," + userid + "," + articleType + ","
+ content.length() + "," + "'" + title + "','" + nickname
+ "')";
dao.executeUpdate(insertSql);
return new ActionForward("/customerGetBlogInfo.do");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -