zoukankan      html  css  js  c++  java
  • JSP两个动作(include,forward)

    include动作

    <div id="container">
     <jsp:include page="HelloWorld.jsp" flush="true|false">
     <jsp:param value="xiaoming" name="username"/>
     </jsp:include>
    </div>

    flush默认值为false

    Forward动作

    跳转页面 forward.jsp

    <jsp:forward page="another.jsp?username=xiaoming">
     <jsp:param value="18" name="age"/>
     </jsp:forward>

    接受页面 another.jsp

    <h1>Hello World!
    <%= request.getParameter("username")%>
    <br>
    age is:
    <%= request.getParameter("age")%>
    </h1>

    跳转页面:forward.jsp

    <jsp:forward page="sayHello.jsp">
           <jsp:param name="user" value="world"/>
           <jsp:param name="user" value="George"/>
    </jsp:forward>

    sayhello.jsp

    <%@page import="java.util.*"%>
    <html>
      <head><title>Say Hello</title></head>
    <body>
    <h2><center>Hello, <%=request.getParameter("user")%><br/>
    The values of parameter user are : 
    <%
            String[] values = request.getParameterValues("user");
            for(int i = 0; i < values.length; i++){
    %>
            <%=values[i]%>
    <%}%>
    </center></h2>
    </body>
    </html>
  • 相关阅读:
    Javascript FP-ramdajs
    微信小程序开发
    SPA for HTML5
    One Liners to Impress Your Friends
    Sass (Syntactically Awesome StyleSheets)
    iOS App Icon Template 5.0
    React Native Life Cycle and Communication
    Meteor framework
    RESTful Mongodb
    Server-sent Events
  • 原文地址:https://www.cnblogs.com/tianhao/p/3975860.html
Copyright © 2011-2022 走看看