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. mkimage的-a 和 –c参数和内核引导

    目录 一.mkimage工具简介二.-a参数与-e参数和内核引导的关系三.实例测试 3.1 -a参数与-e参数相同,可以将内核下载到SDRAM的任何地址,然后从这启动 3.2 -a参数与-e参数不同, ...

  2. C++基类和派生类之间的转换

    本文讲解内容的前提是派生类继承基类的方式是公有继承,关键字public 以下程序为讲解用例. #include<iostream> using namespace std; class A ...

  3. 同样的JS写法,为啥只有IE9模式正常?

    使用 IE F12 开发者工具,选择不同的“文档模式” 从IE7 - IE9,只有IE9正常! <!DOCTYPE html> <html> <script type=& ...

  4. as3+java+mysql(mybatis) 数据自动工具(四)

    现在介绍一下只配置 as3 与 java 公用的数据类,这种配置一般是该数据类只需要在 as3 与 java 之间转换,跟数据库没有关系.比如在客户端与服务端的数据交换中,需要定义一个统一返回请求的数 ...

  5. H5制作1--母亲节快乐

    H5作品现在很流行额. 早上起的很早.就自己试着去了解了一下.感觉很easy. 用了百度的H5在线制作工具.感觉很easy.顺便给百度做下推广吧.h5.baidu.com 于是就有了自己的第一个dem ...

  6. Quartz动态配置表达的方法

    在项目中有一个需求,需要灵活配置调度任务时间,并能自由启动或停止调度.有关调度的实现我就第一就想到了Quartz这个开源调度组件,因为很多项目使用过,Spring结合Quartz静态配置调度任务时间, ...

  7. 题目1023:EXCEL排序(多关键字+快排+尚未解决)

    http://ac.jobdu.com/problem.php?pid=1023 题目描述: Excel可以对一组纪录按任意指定列排序.现请你编写程序实现类似功能. 对每个测试用例,首先输出1行“Ca ...

  8. Uber将在泰国首推"优步摩托"服务

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  9. 32位Ubuntu12.04搭建Hadoop2.5.1完全分布式环境

    准备工作 1.准备安装环境: 4台PC,均安装32位Ubuntu12.04操作系统,统一用户名和密码 交换机1台 网线5根,4根分别用于PC与交换机相连,1根网线连接交换机和实验室网口 2.使用ifc ...

  10. 转载ASP.NET 状态管理Application,Session,Cookie和ViewState用法

    转载原地址 http://www.cnblogs.com/cuishao1985/archive/2009/09/24/1573403.html ASP.NET状态管理 APPlication,Ses ...