jsp HTTP Status 405 - HTTP method GET is not supported by this URL
package myservlet.control; import java.io.IOException;
import java.io.PrintWriter; import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; public class method2 extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
// TODO Auto-generated method stub
super.init(config);
} @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
//super.doPost(req, resp);
req.setCharacterEncoding("gb2312");
resp.setContentType("text/html;charset=gb2312");
PrintWriter out = resp.getWriter();
String name = req.getParameter("name"); String num[] = name.split("[,,]");
String method = req.getMethod(); double sum = 0; for (String item:num) {
if(item.length()>=1)
sum += Double.parseDouble(item); } out.print("用户的请求方式为" + method );
for (String item:num) {
if(item.length()>=1)
out.print(item+""); }
out.print("和是"+sum);
} @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
// super.doGet(req, resp);
req.setCharacterEncoding("gb2312");
resp.setContentType("text/html;charset=gb2312");
PrintWriter out = resp.getWriter();
String name = req.getParameter("name"); String num[] = name.split("[,,]");
String method = req.getMethod(); double product = 1; for (String item:num) {
if(item.length()>=1)
product *= Double.parseDouble(item); } out.print("用户的请求方式为" + method );
for (String item:num) {
if(item.length()>=1)
out.print(item+""); }
out.print("积是"+product);
}
}
是因为重写doPost或doGet方法时
super.doPost(req, resp);
super.doGet(req, resp);
去掉这2句话就可以了
HTTP Status 500 -
org.apache.jasper.JasperException: /Login/login.jsp(27,12) According to TLD, tag jsp:getProperty must be empty, but is not 错误的原因是:<jsp:getProperty name="loginBean" property="backNews" />最后这里少了反斜杠
jsp HTTP Status 405 - HTTP method GET is not supported by this URL的更多相关文章
- HTTP Status 405 - HTTP method GET is not supported by this URL
问题概述: 借助MyEclipse直接建立了一个Servlet类,每次访问这个Servlet都能访问.可自己建立一个Servlet为什么总提示:HTTP Status 405 - HTTP metho ...
- tomcat报错HTTP Status 405 - HTTP method GET is not supported by this URL
servlet提交表单,结果出错. 出现HTTP Status 405 - HTTP method GET is not supported by this URL 原因是:1.继承自Httpserv ...
- HTTP Status 405 - HTTP method POST is not supported by this URL
出现这个问题, 1.在servlet中没有调用post()方法引起的 2.在serlvet中跳转没有用外跳(response.sendRedirect()) 我的是因为第一种,是没有写dopost() ...
- 405 HTTP method GET is not supported by this URL
孙鑫java web开发详解P285里面提交Get网站弹出提示405 HTTP method GET is not supported by this URL 原因父类doGet()方法未覆盖. 应写 ...
- There was an unexpected error (type=Method Not Allowed, status=405). Request method 'POST' not supported
背景:点击提交按钮ajax请求接口时,报出错误[ Whitelabel Error Page This application has no explicit mapping for /error, ...
- doPost或doGet调用出错(状态代码为405) : HTTP method GET is not supported by this URL
最近做servlet发现了个问题,解决办法记下来: Servlet eroor:HTTP method GET is not supported by this URL 错误提示: type: St ...
- HTTP method GET is not supported by this URL(转)
源地址:http://blog.csdn.net/qfs_v/article/details/2545168 Servlet eroor:HTTP method GET is not support ...
- HTTP method GET is not supported by this URL
Servlet eroor:HTTP method GET is not supported by this URL 错误提示: type: Status report message: HTTP m ...
- 使用SpringMVC时报错HTTP Status 405 - Request method 'GET' not supported
GET方法不支持.我出错的原因在于,在JSP中我希望超链接a以post方式提交,但是这里写js代码时出错. <script type="text/javascript"> ...
随机推荐
- socket基本操作
我们深谙信息交流的价值,那网络中进程之间如何通信,如我们每天打开浏览器浏览网页时,浏览器的进程怎么与web服务器通信的?当你用QQ聊天时,QQ进程怎么与服务器或你好友所在的QQ进程通信?这些都得靠so ...
- 《深入Java虚拟机学习笔记》- 第3章 安全
3.1为什么需要安全性 Java的安全模型是其多个重要结构特点之一,它使Java成为适于网络环境的技术.因为网络提供了一条攻击连人的计算机的潜在途径,因此安全性是非常重要的.Java安全模型侧重于保护 ...
- ccr1
Concurrency and Coordination Runtime Jeffrey Richter Code download available at:ConcurrentAffairs200 ...
- bzoj 1037 [ZJOI2008]生日聚会Party(DP)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1037 [题意] 一排n男m女,求满足任意连续段男女人数之差不超过k的数目. [思路] ...
- codeforce 606C - Sorting Railway Cars
题意:给你一串数,没个数只能往前提到首位,或则往后放末尾.问最少步骤使操作后的序列成上升序列. 思路:最长连续子序列. #include<iostream> #include<std ...
- poj 1704 阶梯博弈
转自http://blog.sina.com.cn/s/blog_63e4cf2f0100tq4i.html 今天在POJ做了一道博弈题..进而了解到了阶梯博弈...下面阐述一下我对于阶梯博弈的理解. ...
- 基于samba实现win7与linux之间共享文件_阳仔_新浪博客
基于samba实现win7与linux之间共享文件_阳仔_新浪博客 然后启动samba执行如下指令: /dev/init.d/smb start 至此完成全部配置.
- leptonica 学习笔记2——pixBackgroundNormSimple
1 pixBackgroundNormSimple 函数功能:自适应背影标准化 位置:adampmap.c /*-------------------------------------------- ...
- homework-01 博客记录
程序思路: 一维的主要思想是:最大序列的初始项一定是正数,然后在此项基础上向后遍历,当该连续序列的的总和小于或等于0时,就是这个序列的断点,因为若把该序列当做一个数则为负数,一定不是另一个序列的初始. ...
- 远程控制篇:用Delphi模拟键盘输入/鼠标点击
模拟键盘我们用Keybd_event这个api函数,模拟鼠标按键用mouse_event函数. Keybd_event函数能触发一个按键事件,也就是会产生一个WM_KEYDOWN或WM_KEYUP消息 ...