Retrieves from the address bar

Address bar: 
the URL of: HTTP: // localhost: 8888 / the Test / index.jsp the Test = 123?

1. retrieves from the address bar:
  
<body>
    ${test}
    ${requestScope.test}  
    <%request.getAttribute("test"); %>
</ body> 
  above are several ways to obtain parameters !! less than the address bar
on top of this approach is only written on the page before the jump
  request.setAttribute ( "test", "123 ");
when they set the request object's properties in order to get the value of
how to get it, use the following method
2. the method for obtaining the address parameter passing
   <body>
      ${param.test}

    <%=request.getParameter("test") %>
  </ body> 
using these two methods can get url parameters in

summary:

$ {param.name} parameter request is a parameter in the form of data or url
corresponds taken as request.getParam ( "name")


And request.getAttribute ( "name")
corresponding to the sample is taken EL expression
$ {requestScope.name};




Guess you like

Origin www.cnblogs.com/MrliBlog/p/10980300.html