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的更多相关文章

  1. HTTP Status 405 - HTTP method GET is not supported by this URL

    问题概述: 借助MyEclipse直接建立了一个Servlet类,每次访问这个Servlet都能访问.可自己建立一个Servlet为什么总提示:HTTP Status 405 - HTTP metho ...

  2. 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 ...

  3. HTTP Status 405 - HTTP method POST is not supported by this URL

    出现这个问题, 1.在servlet中没有调用post()方法引起的 2.在serlvet中跳转没有用外跳(response.sendRedirect()) 我的是因为第一种,是没有写dopost() ...

  4. 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()方法未覆盖. 应写 ...

  5. 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, ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 使用SpringMVC时报错HTTP Status 405 - Request method 'GET' not supported

    GET方法不支持.我出错的原因在于,在JSP中我希望超链接a以post方式提交,但是这里写js代码时出错. <script type="text/javascript"> ...

随机推荐

  1. NetCat简介与使用方法

    精品学习网考试频道小编应广大考生的需要,特为参加考试的考生策划了“NetCat简介与使用方法”专题等有关资料,供考生参考! 在入侵中它是最经典的工具之一 ,NetCat被所有的网络安全爱好者和研究者称 ...

  2. 基于kryonet的RPC,使用kryo进行序列化

    Kryo是一个序列化框架. Kryonet是一个基于kryo的RPC框架,它实现了一套高效简洁的API,它通过NIO实现了TCP和UDP通讯,目前还不支持Http. 自己写了一个测试代码,运行了下,感 ...

  3. Java程序版权保护解决方案

    通常C.C++等编程语言开发的程序都被编译成目标代码,这些目标代码都是本机器的二进制可执行代码.通常所有的源文件被编译.链接成一个可执行文件.在这些可执行文件中,编译器删除了程序中的变量名称.方法名称 ...

  4. Flume 与Kafka区别

    今天开会讨论日志处理为什么要同时使用Flume和Kafka,是否可以只用Kafka 不使用Flume?当时想到的就只用Flume的接口多,不管是输入接口(socket 和 文件)以及输出接口(Kafk ...

  5. ADB Server Didn’t ACK ,failed to Start Daemon 解决方法

    解决方法如下: 1.adb nodaemon server 查看不能执行的原因,输出: cannot bind ‘tcp:5037’ 2.定位到了是端口的问题!是5037端口被占用了! 3.netst ...

  6. OpenCV中的矩阵乘法运算

    转载:http://blog.csdn.net/tangwei2014 OpenCV中矩阵乘法运算 1. Mat*Mat: 第一个矩阵的列数必须等于第二个矩阵的行数. [0, 1, 2, 3;     ...

  7. delphi 删除目录和创建目录,临时文件夹

    获取用户当前的Windows临时文件夹function GetWinTempPath: string;varTempDir: array[0..255] of char;beginGetTempPat ...

  8. python 面向对象高级编程

    数据封装.继承和多态只是面向对象程序设计中最基础的3个概念.在Python中,面向对象还有很多高级特性,允许我们写出非常强大的功能. 我们会讨论多重继承.定制类.元类等概念.

  9. linux磁盘简单分区方式

    1:分区 fdisk /dev/sdb 2:格式化 mkfs -t ext3  /dev/sdb1 或者 mke2fs -t ext4  /dev/sdb2 3:挂载 mount /dev/sdb1 ...

  10. vs2015中升级Nuget后,找不到Umbraco安装包问题

    打开VS2015, Tools=>Extensions and Updates=> Updates => Visual Studio Gallery   在这里check一下是否有N ...