0

hi i had created the jsp page contains the table. the table cell values are loaded dynamically using the jstl. in the table cell contains the date. the in between space of date,month and year is two spaced. but the tabel cell shows single space only. my sample code is show below please solve my problem. sorry for my bad English. thanks in advance.

<%@ 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 uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Precision Attendance</title>
</head>
<body>
<%
ArrayList list = new ArrayList();
Map empDetails = new HashMap();
empDetails.put("EmployeeID", "1");
empDetails.put("EmployeeCode","PB131");
empDetails.put("EmployeeName","Balaji");
empDetails.put("DOJ","17  January  2014");
list.add(empDetails);
request.setAttribute("empDetailsList", list);
%>
<table cellpadding="5px" cellspacing="5px" class="TableGrid"
            id="dgEmpShiftDetails">
            <tr>
                <th>Employee ID</th>
                <th>Employee Code</th>
                <th>Employee Name</th>
                <th>DOJ</th>
            </tr>
            <c:forEach items="${empDetailsList}" var="empDetLst">
                <tr>
                    <td><c:out value="${empDetLst.EmployeeID}" /></td>
                    <td><c:out value="${empDetLst.EmployeeCode}" /></td>
                    <td><c:out value="${empDetLst.EmployeeName}" /></td>
                    <td><c:out value="${empDetLst.DOJ}" /></td>

                </tr>
            </c:forEach>
        </table>
</body>
</html>

i set DOJ as 17 January 2014 but table cell shows this like 17 January 2014. in between space is single. how can i resolve this problem.please do the needful.

bal aji
  • 25
  • 6
  • possible duplicate of [Why do multiple spaces in an HTML file show up as single spaces in the browser?](http://stackoverflow.com/questions/433493/why-do-multiple-spaces-in-an-html-file-show-up-as-single-spaces-in-the-browser) – Jukka K. Korpela Jan 17 '14 at 11:39
  • It’s odd to have two spaces between the number of day and the name of month, or the latter and the year. If you really need extra spacing there, consider putting the components in separate cells and using padding (in CSS) as desired. – Jukka K. Korpela Jan 17 '14 at 11:41

1 Answers1

0

HTML doesn't preserve two consecutive spaces except when using a space enity. See this question:

Why do multiple spaces in an HTML file show up as single spaces in the browser?

If you want doucle-spaces to be preserved use two non-breaking space characters where you want the spaces: &nbsp;&nbsp;

Community
  • 1
  • 1
RichieAHB
  • 2,030
  • 2
  • 20
  • 33