Formulaire JSP: Soumetre un texte

Author:
//File: index.html
<html>
  <body>
    <h1>Hello Web Application</h1>
    <formaction="hello.jsp" method="POST" >
      <tablewidth="75%">
        <tr> 
          <tdwidth="48%">What is your name?</td>
          <tdwidth="52%">
            <inputtype="text" name="name" />
          </td>
        </tr>
      </table>
      <p> 
        <inputtype="submit" name="Submit" value="Submit name" />
        <inputtype="reset" name="Reset" value="Reset form" />
      </p>
    </form>
  </body>
</html>
 
//File: hello.jsp
<html>
  <head>
    <title>Hello Web Application</title>
  </head>
  <body>
    <h1>Hello Web Application</h1>
    <br/><br/>
 
    <%
    String name   = request.getParameter("name");
    if (name.trim().length() == 0) {
    %>
      You did not tell me your name!<br><br><br>
    <%
    } else {
    %>
      Hello <%=name%><br><br><br> 
    <%
    }
    %>
    <ahref="index.html">Try again?</a>
  </body>
</html>
 
 
           
       

Cet article Formulaire JSP: Soumetre un texte est apparu en premier sur .