Related information:
"21-Day Learning Java Web Development"
Get parameter values for parameters (one value)
requestform3.jsp
1 <%@ Page Language="Java"ContentType="text/html;charset=gb2312" %>2 <HTML>3 <Head>4 <title>Form</title>5 </Head>6 <Body>7 <formAction= "requestdemo3.jsp"Method= "POST">8User name:<inputtype= "text"name= "username"/><BR>9User password:<inputtype= "Password"name= "UserPassword"/>Ten <inputtype= "Submit"value= "Submit"> One </form> A </Body> - </HTML>
View Code
requestdemo3.jsp
1 <%@ Page Language="Java"ContentType="text/html;charset=gb2312"Import="java.util.*" %>2 <HTML>3 <Head>4 <title>Use the Request object to get parameter values for all parameters</title>5 </Head>6 <Body>7 <%--through the getparameternames of the request object--%> 8 <% 9 Enumeration<String>e=request.getparameternames ();//get all the parameter namesTen while(E.hasmoreelements ()) {//Traverse Enumeration One StringStr= (String) e.nextelement (); //Take out the next element value A Stringstrrequest=request.getparameter (str);//get parameter values for corresponding parameters - out.println (str+"the parameter values are:"+strrequest+"<br>");//Print output parameter names and parameter values - } the %> - </Body> - </HTML>
View Code
Java-jsp the request of the built-in object gets the parameter value of the parameter (a value)