I have a problem transferring data between two jsp
There are two controllers in which the first one accepts the input data, second generate lines with using this params
First controllers group receives two params
#RequestMapping(value = "/create", method = RequestMethod.POST)
public String ProjectSizePost(
#RequestParam("countSprints") Integer countSprints,
#RequestParam("countWorkers") Integer countWorkers) {
BigInteger a = BigInteger.valueOf(countSprints);
return "project/project_size";
}
#RequestMapping(value = "/create", method = RequestMethod.GET)
public String projectSizeGet() {
return "project/project_size";
}
And his jsp
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Size</title>
</head>
<body>
<%--<c:forEach var="inputLine" begin="1" end="4">
<td><input type="text" name="projectManagerId" size="70" value={count} ></td><br>
</c:forEach>--%>
<form action="/project/show_size" method="post" name="/project/show_size"
commandName="projectSizeForm">
<tr>
<td>Count of sprints:</td>
<td><input type="text" name="countSprints" size="70" value = ${countSprints} ></td>
</tr> <br>
<tr>
<td>Count of workers:</td>
<td><input type="text" name="countWorkers" size="70" value = ${countWorkers} ></td>
</tr>
<tr>
<input type="submit" value="Next page"/></td>
</tr>
</form>
</body>
</html>
Second controller and jsp must take params from first jsp
#RequestMapping(value = "/create", method = RequestMethod.POST)
public String createProject(
#RequestParam("projectId") Integer id,
#RequestParam("name") String name,
#RequestParam("startDate") String startDate,
#RequestParam("endDate") String endDate,
#RequestParam("projectStatus") OCStatus projectStatus,
#RequestParam("projectManagerId") Integer projectManagerId) {
MapperDateConverter mdc = new MapperDateConverter();
*//*Project project = new Project.ProjectBuilder()
.projectId(BigInteger.valueOf(id))
.name(name)
.startDate(mdc.convertStringToDate(startDate))
.endDate(mdc.convertStringToDate(endDate))
.build();
project.setProjectStatus(projectStatus);
project.setProjectManagerId(BigInteger.valueOf(projectManagerId));*//*
//projectDao.createProject(project);
return "project/create";
}
And second jsp:
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration</title>
</head>
<body>
<div align="center">
<form action="/project/create" method="post" name="/project/create"
commandName="projectForm">
<table border="0">
<tr>
<h2>CreateProject</h2></td>
</tr>
<tr>
<td>Project Id:</td>
<td><input type="text" name="projectId" size="70" value = ${projectId} ></td>
</tr>
<tr>
<td>Project Name:</td>
<td><input type="text" name="name" size="70" value = ${projectName} ></td>
</tr>
<tr>
<td>StartDate (mm/dd/yyyy):</td>
<td><input type="text" name="startDate" size="70" value = ${startDate} ></td>
</tr>
<tr>
<td>EndDate (mm/dd/yyyy):</td>
<td><input type="text" name="endDate" size="70" value = ${endDate} ></td>
</tr>
<tr>
<td>Status:</td>
<td><input type="text" name="projectStatus" size="70" value = ${status} ></td>
</tr>
<tr>
<td>Project Manager:</td>
<td><input type="text" name="projectManagerId" size="70" value = ${pmId} ></td>
</tr>
<tr>
<td>Count of sprints</td>
<td><input type="text" name="countSprints" size="70" value = ${countSprints} ></td>
</tr>
<tr>
<td>Count of sprints</td>
<td><input type="text" name="countWorkers" size="70" value = ${countWorkers} ></td>
</tr>
<tr>
<input type="submit" value="Create"/></td>
</tr>
</table>
</form>
</div>
</body>
</html>
Params countSprints and countWorkers
Related
My Connection String
Class.forName("com.mysql.jdbc.Driver");
conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/exam_system?useSSL=false&useUnicode=true&characterEncoding=utf8","root","Password");
My JSP File
<%#page import="java.util.ArrayList"%>
<jsp:useBean id="pDAO" class="myPackage.DatabaseClass" scope="page"/>
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style-backend.css">
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" >
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<label Style="color: black"> ছন্দে</label>
<input type="hidden" name="pgprt" value="4">
<select name="coursename" class="text">
<%
ArrayList list1=pDAO.getAllCourses();
for(int i=0;i<list1.size();i=i+2){
%>
<option value="<%=list1.get(i)%>"><%=list1.get(i)%></option>
<%
}
%>
</select>
<input type="submit" value="Show" class="form-button">
</form>
</div>
<div class="panel form-style-6" style="max-width: 420!important;float: right">
<form action="controller.jsp" >
<div class="title">Add New Question</div>
<table Style="color: black;font-color: black">
<tr>
<td><label Style="color: black">Course Name</label></td>
<td colspan="3">
<select name="coursename" class="text">
<%
ArrayList list=pDAO.getAllCourses();
for(int i=0;i<list.size();i=i+2){
%>
<option value="<%=list.get(i)%>"><%=list.get(i)%></option>
<%
} request.setCharacterEncoding("UTF-8");
%>
</select>
</td>
</tr>
<tr>
<td><label Style="color: black">Your Question:</label></td>
<td colspan="4"><input type="text" name="question" class="text" placeholder="Type your question here" style="width: 420px;" ></td><br>
</tr>
<tr>
<td><label Style="color: black">Options</label></td>
<td><input type="text" name="opt1" class="text" placeholder="First Option" style="width: 130px;" ></td>
<td><input type="text" name="opt2" class="text" placeholder="Second Option" style="width: 130px;" ></td>
<td><input type="text" name="opt3" class="text" placeholder="Third Option" style="width: 130px;" ></td>
<td><input type="text" name="opt4" class="text" placeholder="Fourth Option" style="width: 130px;" ></td>
</tr>
<tr>
<td><label>Correct Answer</label></td>
<td colspan="4"><center><input type="text" name="correct" class="text" placeholder="Correct Answer" style="width: 130px;" ></center></td>
<tr>
<td colspan="5"><input type="hidden" name="page" value="questions">
<input type="hidden" name="operation" value="addnew">
<center><input type="submit" class="form-button" value="Add" name="submit"></center></td>
When Inputting Non-English Data It is Not Inserting Correctly in MySQL Database. But
I changed Database Pattern And Test By Passing Non-English Data In String And It Works Perfectly.
INSERT INTO `exam_system`.`contact`
(`Name`,
`Email`,
`Message`)
VALUES
('<{Name:fsfsd }>',
'<{Email:sdfsdf }>',
'<{Message: 1. চর্যাপদ কোন ছন্দে লেখা? }');
Before Answering I tried
Net Bean Font Change
Tried Change String Data To Byte
And Rest
Change Are in the symbol Code.
When Accepting Parameter or User Value Convert That Value Into Char .
String crr=request.getParameter("correct");
byte[] bytesCrr = crr.getBytes(StandardCharsets.ISO_8859_1);
crr = new String(bytesCrr, StandardCharsets.UTF_8);
So I have 3 jsp-forms. The first one with general information. On completetion of the first form it should based on the value of a dropdown return eather form 2 or form 3. So far so good, the object is correctly written to the db, the check is performed and the correct jsp-form is shown, but when the user fills in the second form, nothing happens, read the postmethod of the secondform isn't called.
Any tips on how to fix this problem would be greatly appreciated.
I've bin breaking my head and searching the internet for days but can't find a straight answer.
The GeneralController:
#Controller
public class GeneralController {
#Autowired
private GeneralRepo repo;
#GetMapping("new")
public String getNew(Map<String, Object> model) {
WrapperClass wrapper = new WrapperClass();
model.put("wrapperForm", wrapper);
return "newRecord";
}
#PostMapping("new")
public String handlePost(#ModelAttribute("wrapperForm") WrapperClass wrapper)
{
Address address = new Address(wrapper.getNameOrg(), wrapper.getStreet(), wrapper.getNumber(), wrapper.getZip(),
wrapper.getCity(), wrapper.getTelephone(), wrapper.getEmail());
General general = new General(wrapper.getLanguage(), wrapper.getApplication(), wrapper.getNameKbo(), wrapper.getKboNumber(),
address, wrapper.getApplicationType(), wrapper.getNotes(), null, null, null, null);
String url;
if (general.getApplicationType().equalsIgnoreCase("voortzetting")) {
url = "invoices";
} else {
url = "employee";
}
repo.save(general);
return "redirect:/" + url;
}
}
The Generalform:
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%# page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Record Toevoegen</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/general.css">
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/modern-business.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="${pageContext.request.contextPath}/css/customUtilities.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/general.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
<link rel="icon" href="${pageContext.request.contextPath}/images/vigilis.jpg" type="image/x-icon">
</head>
<body>
<%#include file="navigation.jsp" %>
<%--#elvariable id="wrapperForm" type=""--%>
<form:form method="post" commandName="wrapperForm">
<table align="center" id="forms">
<tr>
<td>
<label>Taal:</label>
</td>
<td>
<form:select path="language" id="language" name="language">
<form:option value="Nederlands"/>
<form:option value="Français"/>
<form:option value="Deutsch"/>
<form:option value="English"/>
</form:select>
</td>
<td>
<label>Type Aanvraag: </label>
</td>
<td>
<form:select path="applicationType" id="type" name="type">
<form:option value="Nieuwe aanvraag"/>
<form:option value="Voortzetting"/>
<form:option value="Vrijwillige ontbinding"/>
<form:option value="Faillisement"/>
</form:select>
</td>
</tr>
<tr>
<td>
<label for="nameKbo">KBO-Benaming</label>
</td>
<td colspan="3">
<form:input path="nameKbo" id="nameKbo" type="text" name="nameKbo" required="required" size="100%"/>
</td>
<tr>
<td>
<label for="kboNumber">KBO-Nummer:</label>
</td>
<td>
<form:input path="kboNumber" id="kboNumber" type="text" name="kboNumber"/>
</td>
</tr>
<tr>
<td>
<label for="nameOrg">HandelsBenaming:</label>
</td>
<td colspan="3">
<form:input path="nameOrg" id="nameOrg" type="text" name="nameOrg" size="100%"/>
</td>
</tr>
<tr>
<td>
<label>Adres:</label>
</td>
<td colspan="2">
<form:input path="street" id="street" name="street" type="text" placeholder="Straatnaam" size="100%"/>
</td>
<td>
<form:input path="number" id="number" name="number" type="text" size="5"/>
</td>
</tr>
<tr>
<td></td>
<td>
<form:input path="zip" id="zip" name="zip" type="text" placeholder="Zip" size="5"/>
</td>
<td >
<form:input path="city" id="city" name="city" type="text" placeholder="Stad" size="80%"/>
</td>
</tr>
<tr>
<td>
<label>Contactgegevens:</label>
</td>
<td>
<form:input path="telephone" id="telephone" name="telephone" type="text" placeholder="Telefoonnummer"/>
</td>
<td colspan="2">
<form:input path="email" id="email" name="email" type="e-mail" placeholder="E-mailadres" size="100%"/>
</td>
</tr>
<tr>
<td>
<label for="notes" style="vertical-align: middle">Opmerkingen:</label>
</td>
<td colspan="3">
<form:textarea path="notes" id="notes" name="notes" style="width: 100%"/>
</td>
</tr>
<tr></tr>
<tr></tr>
<tr>
<td></td>
<td colspan="2" style="align-content: center;"><input type ="submit" value="Opslaan" class="button"/></td>
</tr>
</table>
</form:form>
<%#include file="footer.jsp" %>
</body>
</html>
The InvoiceController:
#Controller
public class InvoiceController {
#Autowired
private GeneralRepo repo;
#GetMapping("invoices")
public String handleGetInvoice(Map<String, Object> model) {
Invoices invoiced = new Invoices();
model.put("invoiceForm", invoiced);
return "invoices";
}
#PostMapping("invoices")
public String handlePost(#ModelAttribute("invoiceForm") Invoices invoiced, Map<String, Object> model) {
General general = repo.findLast();
general.setInvoice(invoiced);
repo.save(general);
System.out.println("invoice saved");
return "redirect:/employee";
}
}
The Invoiceform:
<%# page contentType="text/html;charset=UTF-8" %>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%# taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Facturen</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/modern-business.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="${pageContext.request.contextPath}/css/customUtilities.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/general.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
<link rel="icon" href="${pageContext.request.contextPath}/images/vigilis.jpg" type="image/x-icon">
</head>
<body>
<!-- Navigation -->
<%#include file="navigation.jsp" %>
<%--#elvariable id="invoiceForm" type=""--%>
<form:form action="invoices" method="post" commandName="invoiceForm">
<table align="center" id="forms">
<tr>
<td>
<label>Ontvangen:</label>
</td>
<td>
<form:select path="received" id="received" name="received">
<form:option value="Ok"/>
<form:option value="Niet Ok"/>
<form:option value="Niet Aanwezig"/>
<form:option value="Aanwezig"/>
</form:select>
</td>
<td>
<label>Status: </label>
</td>
<td>
<form:select path="state" id="state" name="state">
<form:option value="In Behandeling"/>
<form:option value="Goedgekeurd"/>
<form:option value="Geweigerd"/>
<form:option value="Ingetrokken"/>
<form:option value="Moraliteitsonderzoek"/>
</form:select>
</td>
</tr>
<tr>
<td>
<label>Aantal Vorig jaar:</label>
</td>
<td>
<form:input path="last" id="last" type="text" name="last" required="required"/>
</td>
<td>
<label>Aantal Andere jaren:</label>
</td>
<td>
<form:input path="early" id="early" type="text" name="early" required="required"/>
</td>
</tr>
<tr>
<td>
</td>
<td><label>BevestigingsDatum:</label></td>
<td><form:input path="confirmationDate" id="confirmationDate" type="date" name="confirmationDate"
required="required"/></td>
</tr>
<tr>
<td></td>
<td colspan="2" style="align-content: center;"><input type="submit" value="Opslaan" class="button"/>
</td>
</tr>
</table>
</form:form>
<!-- Footer -->
<%#include file="footer.jsp" %>
<!-- Bootstrap core JavaScript -->
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/popper.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
</body>
</html>
pass the complete URL inside return for example
return "http://localhost:8080/projectname/"+url;
I want to retrieve the parameters sent through the form login.jsp in the controller..but I am getting the error-"Request parameter is not present". My code for login.jsp is as follows:-
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%#taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring Security</title>
</head>
<body>
<center>
<h1>Welcome to Spring Security Learning</h1>
<c:if test="${not empty SPRING_SECURITY_LAST_EXCEPTION}">
<font color="red">
Your login attempt was not successful due to <br/><br/>
<c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>.
</font>
</c:if>
<div style="text-align: center; padding: 30px; border: 1px solid; width: 250px;">
<form method="post"
action='j_spring_security_check'>
<table>
<tr>
<td colspan="2" style="color: red">${message}</td>
</tr>
<tr>
<td>User Name:</td>
<td><input type="text" name="j_username" id="uname"/></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="j_password" /></td>
</tr>
<tr>
<td colspan="1"><input type="submit" value="Login" /></td>
<td colspan="1"><input name="reset" type="reset" /></td>
</tr>
</table>
</form>
</div>
</center>
</body>
</html>
The code for controller is as follows:-
#RequestMapping("/search")
public ModelAndView search(HttpSession session2,#RequestParam("j_username") String name) {
session2.setAttribute("name", name);
Session session=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory().openSession();
String hql = "SELECT E.firstName FROM User E";
Query query = session.createQuery(hql);
List results = query.list();
//System.out.println(results.get(1).getClass().getFields());
HashMap model = new HashMap();
model.put("users", results);
return new ModelAndView("search", model);
}
Please help..thanx in advance..
I have a success.jsp page which displays multiple rows and columns with an Edit button and a checkbox for each row. If the user clicks on Edit button, the checkbox is selected.
Below is success.jsp :
<%#page import="mymvc.model.TableColumns"%>
<%#page import="java.util.ArrayList"%>
<%#page import="java.util.Iterator"%>
<%#taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%--
Document : success
Created on : Jul 8, 2014, 1:43:17 PM
--%>
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Success</title>
<script type="text/javascript">
function validate(n) {
v = document.getElementById("check"+n)
v.checked = !v.checked;
x = document.getElementById("typeId"+n).removeAttribute('readonly');
y = document.getElementById("paramSeq"+n).removeAttribute('readonly');
z = document.getElementById("paramName"+n).removeAttribute('readonly');
}
</script>
</head>
<body>
<form action="DBController" method="post">
Welcome ${requestScope['user'].username}.
<table>
<tr style="background-color:#f0a64e;">
<th class="border">ID</th>
<th class="border">Param Sequence</th>
<th class="border">Param Name</th>
</tr>
<c:forEach var="element" items="${requestScope['listData']}" varStatus="status">
<tr>
<td><input id="typeId${status.index}" value="${element.typeId}" readonly="true"</td>
<td><input id="paramSeq${status.index}" value="${element.paramSeq}" readonly="true"</td>
<td><input id="paramName${status.index}" value="${element.paramName}" readonly="true"</td>
<td>
<input id="edit${status.index}" type="button" value="Edit" name="edit" onclick="validate(${status.index})"</input>
</td>
<td><input type="checkbox" id="check${status.index}" name="selectedItems" value="<c:out value="${status.index}"/>"</td>
</tr>
</c:forEach>
</table>
<input type="submit" value="Update" name="update" />
</form>
</body>
</html>
I don't know how to send the whole row data to my servlet if more than one row is selected. I am able to get all the indexes of the checkboxes which are selected. But I am unable to extract other related values like typeId, paramSeq and paramName. My servlet is as follows :
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String[] edited = request.getParameterValues("selectedItems");
//String pName = request.getParameter("paramName"+edited[1]);
Enumeration<String> paramName = request.getParameterNames();
String[] param = new String[10];
int i=0;
while(paramName.hasMoreElements()){
param[i]=paramName.nextElement();
}
RequestDispatcher rd = null;
rd = request.getRequestDispatcher("/update.jsp");
request.setAttribute("param", param);
request.setAttribute("edited", edited);
rd.forward(request, response);
}
In the above code, currently, I am trying to get all the parameters passed and the rows which are selected. I want to modify this servlet and access the selected row along with other data like typeId, etc. to create UPDATE statements for every row. I referred this and this but not much help.
I think what you are missing is that you are giving each input type a unique id but you are not specifying the name of the input types, and in the servlet you are trying to get values by name.
So please add names along with the id's in order to get them in the servlet
<c:forEach var="element" items="${requestScope['listData']}" varStatus="status">
<tr>
<td><input name="typeId${status.index}" value="${element.typeId}" readonly="true"</td>
<td><input name="paramSeq${status.index}" value="${element.paramSeq}" readonly="true"</td>
<td><input name="paramName${status.index}" value="${element.paramName}" readonly="true"</td>
<td>
<input id="edit${status.index}" type="button" value="Edit" name="edit" onclick="validate(${status.index})"</input>
</td>
<td><input type="checkbox" id="check${status.index}" name="selectedItems" value="<c:out value="${status.index}"/>"</td>
</tr>
</c:forEach>
</table>
I have a JSP called create-account.jsp which collects a customer's details and sends the data to a Servlet. The Servlet inserts the customer's data into the database, queries the database add sets the results as request scoped attributes and the dispatches to create-account.jsp(same jsp). Now the inserted details must appear in a hidden html table in the jsp. How do I do it? Can any one help?
create-account.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Create New Account</title>
<style>
a {
text-decoration: none;
}
body {
border-color: azure;
}
</style>
</head>
<body>
<p align="right">Hi, ${sessionScope.user.userName} logout</p>
<h2 align="center">Create New Account</h2>
<form action="${pageContext.request.contextPath}/create.do" method="post">
<table border="1" align="center">
<tr>
<td>Name:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>DOB:(yyyy-mm-dd)</td>
<td><input type="text" name="dob"></td>
</tr>
<tr>
<td>Balance:</td>
<td><input type="text" name="balance"></td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Create" name="create">
</td>
</tr>
</table>
</form>
<p align="center" style="display: none">${requestScope.result} has been successfully inserted into the table</p>
<table id="hiddenTable" style="display: none" border="1">
<tr>
<td>
</td>
</tr>
</table>
</body>
</html>
Use
style="visibility: hidden;"
or
style="display:none;"
to hide the table.
for more info have a look at below links
CSS Display and Visibility
Show/Hide div javascript
How to show the result in table?
sample code:
Servlet:
public class Model{
private String name;
private String dob;
private double balance;
// getter and setter
}
...
List<Model> list = new ArrayList<Model>();
//add the data in list
request.setAttribute("list",list);
JSP:
<c:if test="${not empty list}">
<c:forEach var="ob" items="${list}">
<tr>
<td><c:out value="${ob.name}"/></td>
<td><c:out value="${ob.dob}"/></td>
<td><c:out value="${ob.balance}"/></td>
</tr>
</c:forEach>
</c:if>
For complete code have a look at jsp iterate over list