新手学jsp遇到问题了,各位高手帮忙解决一下

我提交表单时候出现如下问题:

我用的是jdk1.6+tomcat6.0

在线等答案:

HTTP Status 500 -


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.NullPointerException
	BookFoodSys.servlet.OrderFomeSubmit.doGet(OrderFomeSubmit.java:56)
	BookFoodSys.servlet.OrderFomeSubmit.doPost(OrderFomeSubmit.java:83)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

 

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.

 

 

 

 

 


 

orderFormSubmit  java文件:

package BookFoodSys.servlet;

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 BookFoodSys.FoodInfo.model.FoodOrderInfo;
import BookFoodSys.data.OrderFromInfo;

public class OrderFomeSubmit extends HttpServlet {

  public OrderFomeSubmit() {
  super();
 }

  public void destroy() {
  super.destroy(); // Just puts "destroy" string in log
  // Put your code here
 }

 public void doGet(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, IOException {

  response.setContentType("text/html;charset=GB2312");
  FoodOrderInfo orderinfo = new FoodOrderInfo();
  request.setCharacterEncoding("GB2312");
  orderinfo.setCustomerName(request.getParameter("txt_userName"));
  orderinfo.setAddress(request.getParameter("txt_adress"));
  orderinfo.setZipCode(request.getParameter("txt_dakcoding"));
  orderinfo.setTelephone(request.getParameter("txt_phone"));
  orderinfo.setMovePhone(request.getParameter("txt_mobile"));
  orderinfo.setSendMethod(request.getParameter("rd_quomodel"));
  orderinfo.setEmail(request.getParameter("txt_email"));
  orderinfo.setPaymentmethod(request.getParameter("ra_shangmen"));
  orderinfo.setNotice(request.getParameter("txt_postscript"));
  orderinfo.setTotalPrice((request.getSession().getAttribute("total")).toString());
  // 添加订单
  if(new OrderFromInfo().AddOrderFroInfo(orderinfo))
  {
   request.setAttribute("orderinfo",orderinfo);
   request.getRequestDispatcher("/Shopping/ShowOrder.jsp").forward(request,response);
  }
  else
  {
   response.sendRedirect(request.getContextPath()+"/Shopping/checkOut.jsp");
  }
 }

  public void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, IOException {

  response.setContentType("text/html;charset=GBK");
  doGet(request,response);
 }

 public void init() throws ServletException {
  // Put your code here
 }

}

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

wojiaoritty

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值