jsp九大内置对象

1.out

  

<%
        out.println("<h2>静夜思</h2>");
        out.println("床前明月光<br>");
        out.println("疑是地上霜<br>");
        out.println("举头望明月<br>") ;
        out.println("低头思故乡<br>");
        
     %>
     缓冲区的大小:<%=out.getBufferSize() %> byte<br>
     缓冲区剩余大小<%= out.getRemaining() %> byte<br>

 

 

2. get 和post

<body>
    <h1> 用户登录</h1>
    <hr>
        <form action = "dologin.jsp" name="loginForm" method="post">
        <table>
        <tr>
            <td>用户名:</td>
            <td><input type="text" name="username"/></td>
        </tr>
        <tr>
            <td>密码:</td>
            <td><input type="password" name="username"/></td>
        </tr>
        <tr>
        
            <td colspan ="2"><input type="submit" value="登录"></td>
        </tr>
        </table>
         </form>
</body> 

 

3.request

 

<form name ="regForm" action="request.jsp" methed="post">
   
    
        用户<input type="text" name="username"/>    <br>
        爱好   &nbsp;
        <input type="checkbox" name ="favorite" value="read">读书
        <input type="checkbox" name ="favorite" value="music">音乐
        <input type="checkbox" name ="favorite" value="movie">电影
        <input type="checkbox" name ="favorite" value="interent">上网      <br><br><br>
        
        <input type="submit" value="提交">
    
    </form>
    
 <%
      request.setCharacterEncoding("utf-8");
   %>
    用户名:<%=request.getParameter("username") %>
    爱好:<%
        String [] f = request.getParameterValues("favorite");
        for(int i = 0 ; i < f.length ; i ++){
            out.println(f[i] + "&nbsp;&nbsp");
        }
     %>

 

posted @ 2016-04-03 00:15  式微胡不归  阅读(153)  评论(0编辑  收藏  举报