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"> ...
随机推荐
- [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.3.6
If $A$ is a contraction, show that $$\bex A^*(I-AA^*)^{1/2}=(I-A^*A)^{1/2}A^*. \eex$$ Use this to sh ...
- 数列极限---和Gauss(取整)函数有关
- 《深入Java虚拟机学习笔记》- 第17章 异常
<深入Java虚拟机学习笔记>- 第17章 异常
- 【JMeter】Jmeter-完成一个http压力测试
一 新建一个jmeter项目 1 进入/jmeter/bin路径,双击jmeter.bat,在win环境下启动jmeter. 2 点击"编辑->添加->TreadUsers-&g ...
- FZU 2127 养鸡场
Problem Description Jason买来了n米长的竹篱笆,打算将n米长的竹篱笆全部用来围成一个三角形的养鸡场.为方便起见,养鸡场三条边的长度都为正整数.同时,他想让自己的养鸡场看起来更 ...
- USB HID报告及报告描述符简介
在USB中,USB HOST是通过各种描述符来识别设备的,有设备描述符,配置描述符,接口描述符,端点描述符,字符串描述符,报告描述符等等.USB报告描述符(Report Descriptor)是HID ...
- MATLAB中的max函数的用法及含义
当A是一个列向量时候,返回一个最大值,在此不在赘述. 当Amxn是一个矩阵的时候,有以下几种情况: ① C = max(max(A)),返回矩阵最大值 ② D = max(A,[],1),返回 ...
- HW7.10
public class Solution { public static void main(String[] args) { int[][] array = new int[3][3]; for( ...
- HDU-4669 Mutiples on a circle 环形DP
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4669 题意:给一串数字连乘一个环,求连续的子串中组成的新的数字能被K整除的个数. 首先容易想到用DP来 ...
- Linux江湖01:玩转Linux系统的方法论 (转载)
http://www.blogjava.net/youxia/archive/2015/01/08/linux001.html 2014年上半年,我是在写RCP系列.然后,由于要准备研究生毕业论文和答 ...