奇怪的错误HTTP Status 405 - HTTP method GET is not supported by this URL

tearsmo57 2010-11-28 04:11:44
package com.flight.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import org.apache.commons.beanutils.BeanUtils;

import com.flight.bean.City;
import com.flight.bean.flight;
import com.flight.dao.searchflightDao;

public class ticketsearchServlet extends HttpServlet {

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

doPost(request,response);

}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");

String action=request.getParameter("action");
searchflightDao sfdao=new searchflightDao();

if(action.equals("list")){



String flight_id = request.getParameter("flight_id");
String datetime = request.getParameter("datetime");

request.setAttribute("fmList", sfdao.findBy(flight_id,datetime));

request.getRequestDispatcher("ticketstatus.jsp").forward(request, response);
}
}


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

}
表单的提交方式检查过了是post方式提交的,请高手们帮忙看看是怎么回事?急用啊!!!
...全文
614 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ethenjean 2010-11-29
  • 打赏
  • 举报
回复
话说你的doget方法里面为什么会有一个String参数呢?
printf_2012 2010-11-29
  • 打赏
  • 举报
回复
1,子类重写doGet或doPost等方法;

2,在你扩展的Servlert中重写doGet或doPost等方法来处理请求和响应时 不要调用父类HttpServlet的doGet或doPost等方法,即去掉super.doGet(request, response)和super.doPost(request, response);


81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧