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

📄 addarticle.java

📁 电信的网厅的整站代码
💻 JAVA
字号:
package com.doone.fj1w.fjmgr.config;

import java.io.IOException;
import java.io.PrintWriter;

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

import com.doone.data.DacClient;
import com.doone.data.DataTable;
import com.doone.fj1w.fjmgr.sysmgr.Util;
import com.doone.util.FileLogger;

/**
 * Created by IntelliJ IDEA. User: lizhx Date: 2005-7-15 Time: 14:32:16
 * Email:lizx@doone.com.cn
 */
public class AddArticle extends HttpServlet {
	static final private String CONTENT_TYPE = "text/html; charset=GBK";
	
	public void init() throws ServletException {
		
	}
	
	public void doGet(HttpServletRequest httpRequest,
			HttpServletResponse httpResponse) throws ServletException,
			IOException {
		httpRequest.setCharacterEncoding("GBK");
		httpResponse.setContentType(CONTENT_TYPE);
		PrintWriter out = httpResponse.getWriter();
		try {
			String articleType = httpRequest.getParameter("articleType").trim();
			String cityCode = httpRequest.getParameter("CityCode").trim();
			String areaCode = "";
			if(httpRequest.getParameter("AreaCode") == null) {
				areaCode = "";
			}
			else {
				areaCode = httpRequest.getParameter("AreaCode").trim();
			}
			ArticleBean ab = new ArticleBean();
			String yeWuName = httpRequest.getParameter("yeWuName").trim();
			String state = httpRequest.getParameter("state").trim();
			String content = httpRequest.getParameter("content").trim();
			String addOk = "";
			String affairId = "";
			articleType = Util.Replace(articleType);
			cityCode = Util.Replace(cityCode);
			areaCode = Util.Replace(areaCode);
			yeWuName = Util.Replace(yeWuName);
			state = Util.Replace(state);
			
			ab.setCityCode(cityCode);
			ab.setAreaCode(areaCode);
			ab.setYeWuName(yeWuName);
			ab.setState(state);
			ab.setContent(content);
			if(articleType.equals("P")){
				ProductBean pb = new ProductBean();
            	DataTable dt = pb.getProductId(new DacClient(),yeWuName,cityCode);
            	for(int j=0;j<dt.getRows().getCount();j++) {
            	    affairId = dt.getRow(j).getString("productId");
            	}
            	ab.setAffairId(affairId);
				ab.setArticleType(articleType);
				addOk = ab.addArticleOfP();
				/*
				if(ab.pArticleIs(new DacClient(),cityCode,affairId)==true){
				}
				else
					out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperFailure.jsp?error=对不起,该地市已经存在你所选择的产品条款协议,请你核查!';</script>");
			    */
			}
			else if(articleType.equals("C")){
				affairId = ab.getAffairId(new DacClient(),yeWuName);
				ab.setAffairId(affairId);
				ab.setArticleType(articleType);
				addOk = ab.addArticleOfC();
				/*
				if(ab.cArticleIs(new DacClient(),cityCode,affairId)==true){	
				}
				else
					out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperFailure.jsp?error=对不起,该地市已经存在你所选择的产品条款协议,请你核查!';</script>");
			    */
			}
			
			if(addOk.equals("1"))
				out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperSuccess.jsp';</script>");
			else
				out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperFailure.jsp?error=数据库操作失败';</script>");
		} catch (RuntimeException e) {
			FileLogger.getLogger().error(e);
			out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperFailure.jsp?error="
					+ Util.Replace(e.getMessage()) + "';</script>");
		} catch (Exception e) {
			FileLogger.getLogger().error(e);
			out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperFailure.jsp';</script>");
		}
	}
	
	public void doPost(HttpServletRequest httpRequest,
			HttpServletResponse httpResponse) throws ServletException,
			IOException {
		doGet(httpRequest, httpResponse);
		
	}
	
	// Clean up resources
	public void destroy() {
	}
}


⌨️ 快捷键说明

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