servlet层调用biz业务层出现浏览器 500错误,解决方法

JAVA学习网 2017-10-01 23:05:01
package com.swift.jztk.servlet;

import java.io.IOException;

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

import com.swift.jztk.biz.IQuestionBiz;
import com.swift.jztk.biz.QuestionBizImpl;

@WebServlet("/getQuestions")
public class GetQuestions extends HttpServlet {
    private static final long serialVersionUID = 1L;
    IQuestionBiz biz=new QuestionBizImpl();//生成业务层对象
    public GetQuestions() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.getWriter().append("Served at: ").append(request.getContextPath());
        String testType=request.getParameter("testType");
        String json=biz.getQuestions(testType);//业务层对象调用方法,方法中使用dao数据访问层访问数据库,代码问题执行失败
        response.getWriter().println(json);
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}

 

阅读(730) 评论(0)