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

📄 customeraddtopicarticleaction.java

📁 基于struts的网上商店源码
💻 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 + -