JSP Files - JobFinder Application
In the project JobFinder we have three .jsp files named as
Main-menu.jsp- Have content of the home page to be displayed on the browser once the server sends a response to the client.
Visitor-form.jsp- Have main content where the visitor will fill his/her details and then it will be stored by Model attribute.
Visitor-details.jsp- Is the file where the data entered by the visitor is stored and displayed back to the visitor as a response.
main-menu.jsp
<h3>Main Menu</h3>
<h3>Are you a visitor?</h3>
<a href="visitor/showForm">
<button>click for Form</button>
</a>
The above snippet is in the body tag of main-menu.jsp
visitor-form.jsp
<h3>Visitor Form</h3>
<form:form action="processForm" modelAttribute="visitor">
First Name:(*) <form:input path="firstName" />
<form:errors path="firstName" cssClass="error" />
Last Name: <form:input path= "lastName" />
<br><br><hr>
City:
<form:select path="city">
<form:options items="${visitor.cityOptions }" />
<br><br>
</form:select><hr>
<p> Can you relocate ? </p>
Yes <form:radiobutton path="relocate" value="Yes" />
No <form:radiobutton path="relocate" value="No" />
<br><br><hr>
Languages Known:
Hindi <form:checkbox path="languagesKnown" value="Hindi" />
English <form:checkbox path="languagesKnown" value="English" />
Marathi <form:checkbox path="languagesKnown" value="Marathi" />
German <form:checkbox path="languagesKnown" value="German" />
Korean <form:checkbox path="languagesKnown" value="Korean" />
<br><br><hr>
Country Code: <form:input path="conCode" />
<form:errors path="conCode" cssClass="error" />
<br><br><hr>
<input type="submit" value="submit" />
</form:form>
<style>.error{color:red;}</style>
Above are code snippets for the main HTML form which visitor will submit along with CSS style.
Visitor-details.jsp
The Visitor details are: ${visitor.firstName }${visitor.lastName}<br><hr>
City: ${visitor.city }<br><hr>
Can Relocate: ${visitor.relocate}<br>
<hr>
Languages Known:
<ul>
<c:forEach var="temp" items="${visitor.languagesKnown }">
<li>${temp}</li>
</c:forEach>
</ul><hr>
Country Code: ${visitor.conCode}<hr>
The JSP files are returned by the controller methods. These are the views part of Spring MVC architecture and the response by the server to the client.
Previous Steps: Entity Class and Controller Classes.
Comments
Post a Comment