HTML Forms in JSP Lecture
HTML Forms in JSP Lecture
- Syntax:
- Example:
</form>
In submit.jsp:
<%
%>
RequestDispatcher rd = request.getRequestDispatcher("result.jsp");
rd.forward(request, response);
In result.jsp:
Files:
1. index.jsp
<html><body>
</form>
</body></html>
2. process.jsp
<%
RequestDispatcher rd = request.getRequestDispatcher("result.jsp");
rd.forward(request, response);
%>
3. result.jsp
<html><body>
<h2>Greeting Result</h2>
<a href="index.jsp">Back</a>
</body></html>
Teaching Tips
- Show how the data flows from form to JSP and then forwarded with the greeting.
- Explain request lifecycle and why attributes exist only in the request scope.
- Discuss difference between getParameter() (form data) and getAttribute() (request object data).