JSTL Get Value From Form

 http://www.java2s.com/Tutorial/Java/0380__JSTL/GetvaluefromFormTextFieldAndOutputthevaluebyusingJSTL.htm


Form

<html>
  <head><title>Create Person</title></head>
  <body>
    <h1>Enter your details</h1>
    <form action="listPageParameters.jsp" method="post">
      <table>
        <tr><td>First name:</td>
            <td><input type="text" name="firstName" /></td>
        </tr>
        <tr><td>Last name:</td>
            <td><input type="text" name="lastName" /></td>
        </tr>
        <tr><td>Age:</td>
            <td><input type="text" name="age" /></td>
        </tr>
      </table>
      <input type="submit" value="Submit details" />
    </form>
  </body>
</html>

jstl get value from form

//page listPageParameters.jsp


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>

<html>
  <head><title>Display details</title></head>
  <body>
    <h1>the details you entered!)</h1>
    <table>
      <tr><td>First name</td><td><c:out value="${param.firstName}" /></td></tr>
      <tr><td>Last name</td> <td><c:out value="${param.lastName}"  /></td></tr>
      <tr><td>Age</td>       <td><c:out value="${param.age}"       /></td></tr>
    </table>
  </body>
</html>

source:  http://www.java2s.com/Tutorial/Java/0380__JSTL/GetvaluefromFormTextFieldAndOutputthevaluebyusingJSTL.htm

Comments

Popular posts from this blog

Lab Network 2024

Step to publish your static html web page to GitHub

Tutorial OOP(reversion java)