JSP learning note (6) ----- Transfer parameters between multiple JSP pages

xiaoxiao2021-03-06  89

1. How do you perform parameter passing between multiple JSP pages? A built-in scope object Session is required to use JSP. Use it two methods setttribute (), getattribute ()

2. The following instance implements the function of passing the parameters of the first JSP page to the third page.

3. The code is as follows: 1.Jsp

What's your name

4. 2.Jsp

<%

String name = Request.getParameter ("UserName");

Session.setttribute ("UserName", Name);

%>

Your name is: <% = Request.getParameter ("UserName")%>


What's your hobby

5. 3.jsp

Your name is: <% = session.getattribute ("username")%>


Your Hobby IS: <% = Request.getParameter ("Hobby")%>


Your Password Is: <% = Request.getParameter ("pass")%>


转载请注明原文地址:https://www.9cbs.com/read-122281.html

New Post(0)