关于request问题 提交表单之后出现404错误

J2EE 码拜 7年前 (2017-04-19) 1025次浏览
<%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<base href=”<%=basePath%>”>

<title>My JSP “request.jsp” starting page</title>关于request问题 提交表单之后出现404错误

<meta http-equiv=”pragma” content=”no-cache”>
<meta http-equiv=”cache-control” content=”no-cache”>
<meta http-equiv=”expires” content=”0″>
<meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
<meta http-equiv=”description” content=”This is my page”>
<!–
<link rel=”stylesheet” type=”text/css” href=”styles.css”>
–>
</head>

<body>
<form action=”request.jsp” method=”post”>
<input type=”text” name=”usename”/>
<input type=”submit” value=”提交”/>
</form>
请求方法名: <%=request.getMethod()%> <br/>
请求资源:   <%=request.getRequestURI()%><br/>
请求使用的协议:   <%=request.getProtocol()%><br/>
请求服务器IP:   <%=request.getServerName()%><br/>
请求服务器端口:   <%=request.getServerPort()%><br/>
客服端IP地址:   <%=request.getRemoteAddr()%><br/>
客户端的主机名:   <%=request.getRemoteHost()%><br/>
<%=request.getParameter(“usename”) %><br/>
</body>
</html>

解决方案

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明关于request问题 提交表单之后出现404错误
喜欢 (0)
[1034331897@qq.com]
分享 (0)