servlet層調用biz業務層出現瀏覽器 500錯誤,解決方法
阿新 • • 發佈:2017-10-02
protected post https string pub 代碼 失敗 uid row
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) throwsServletException, 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); } }
servlet層調用biz業務層出現瀏覽器 500錯誤,解決方法