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. MySQL table_id原理及风险分析

    1. 什么是table_id MySQL binlog文件按格式分为文件头部和事件信息.文件头部占4字节,内容固定为:"\xfe\x62\x69\x6e",接下来就是各个event ...

  2. 树莓PI交叉编译BOOST库(asio网络例子)

    环境搭建参考上一篇文章[http://www.cnblogs.com/yuliyang/p/4023758.html] 客户端(use boost.asio on raspberry pi )clie ...

  3. mybatis系列-03-入门程序

    3.1     需求 根据用户id(主键)查询用户信息 根据用户名称模糊查询用户信息 添加用户 删除 用户 更新用户 3.2     环境 java环境:jdk1.7.0_79 eclipse mys ...

  4. 【转载】计算机视觉(CV)前沿国际国内期刊与会议

    计算机视觉(CV)前沿国际国内期刊与会议这里的期刊大部分都可以通过上面的专家们的主页间接找到1.国际会议 2.国际期刊 3.国内期刊 4.神经网络 5.CV 6.数字图象 7.教育资源,大学 8.常见 ...

  5. HW6.29

    public class Solution { public static void main(String[] args) { int count = 0; int[] card = new int ...

  6. POJ-2926 Requirements 最远曼哈顿距离

    题目链接:http://poj.org/problem?id=2926 题意:求5维空间的点集中的最远曼哈顿距离.. 降维处理,推荐2009武森<浅谈信息学竞赛中的“0”和“1”>以及&l ...

  7. 企业DC Windows运维监控规范及C辅助监控开发实战前奏;

    春天来了,小草发芽了,花儿开了,你还在等什么? 人家都自驾游了,ruiy可还是徒步游的,并且还留着汗+油; 什么是生活,我的理解就是跟着gd生,跟着gd活,可是讲到这我又自恋了,人家开二会也没想起我来 ...

  8. Java for循环的几种用法详解

    本文非常适合初学Java的程序员,主要是来了解一下Java中的几种for循环用法,分析得十分详细,一起来看看. J2SE 1.5提供了另一种形式的for循环.借助这种形式的for循环,可以用更简单地方 ...

  9. DTD - XML Building Blocks

    The main building blocks of both XML and HTML documents are elements. The Building Blocks of XML Doc ...

  10. 如何计算ModBus超时时间?

    波特率:每秒钟通过信道传输的信息量称为位传输速率,也就是每秒钟传送的二进制位数,简称比特率.比特率表示有效数据的传输速率,用b/s .bit/s.比特/秒,读作:比特每秒. 如9600b/s:指总线上 ...