我在网站中输入http://localhost:8080/1.jsp?ID=123
1.jsp文件中有 String ID = request.getParameter(“ID”); 但是提示说这句参数错误 ! 用FORM的方法可以成功。请问是什么原因?如何改?才能把ID=123的值传给jsp中,不用FORM
1.jsp文件中有 String ID = request.getParameter(“ID”); 但是提示说这句参数错误 ! 用FORM的方法可以成功。请问是什么原因?如何改?才能把ID=123的值传给jsp中,不用FORM
没有问题 可以得到啊
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="com.mysql.jdbc.Driver" %>
<%@ page import="java.sql.*" %>
<%
out.println(" "+request.getParameter(“ID”)+" ");
%>然后输入 http://localhost:8080/1.jsp?ID=1就会出现错误提示 内容为:
An error occurred at line: 43 in the jsp file: /1.jsp
The method getParameter(String) in the type ServletRequest is not applicable for the arguments ()
String ID = request.getParameter(“ID”); 也是一样
这样<%=request.getParameter("ID") %>完全可以获得啊!
char* req="POST /1.jsp HTTP/1.0\r\n"
"From: local\r\n"
"User-Agent: post_test/1.0\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: 4\r\n\r\n"
"ID=1";那么我在客户端一样可以用String ID = request.getParameter(“ID”); 获得ID值吗?如果不能需要什么条件?