Java/JSTL/Form Parameter
JSTL-Form Action And Passing Parameter
<source lang="java">
<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %> <c:if test="${pageContext.request.method=="POST"}">
<c:set var="uid" value="${param.uid}" scope="session" /> <jsp:forward page="session2.jsp" />
</c:if> <html>
<head> </head> <body> <form method="POST">
Please Login |
|
User Name |
<input type="text" name="uid" size="20" /> |
Password |
<input type="password" name="pwd" size="20" /> |
<input type="submit" value="Submit" name="action" /> <input type="reset" value="Reset" name="B2" /> |
</form>
Note: you may use any ID/Password, security is not checked.
</body>
</html>
//////////////////////////////////////////////////////////////////////////////////////////// <%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %> <html>
<head> <title>Session Example</title> </head> <body>
Welcome <c:out value="${uid}" />
Your favorite color is: <c:out value="${param.color}" />
Choose your favorite color: