0

I tried whole things what I found on the internet but I failed about this. I investigated all issues on here or other sites but It didn't create any difference. I do something wrong but I can't see.

Now here is my jsp page :

<html>
<head>
<script src="<c:url value="/resources/js/jquery-3.2.1.min.js" />"></script>
<link href="<c:url value="/resources/css/bootstrap.css" />" rel="stylesheet"/>
<link href="<c:url value="/resources/css/bootstrap-theme.css"/>" rel="stylesheet"/>
<script type="text/javascript">
    debugger;
    var allEmployees = "${allEmployees}";
    debugger;
</script>
</head>
<body>
<div class="table-responsive">
<h2>Tüm Çalışanlar</h2>
<table class="table table-bordered">
    <div class="row">
        <div class="col-md-12">
            <tr>
                <td class="field-label col-xs-3 active">
                    <label>TC No</label>
                </td>
                <td class="field-label col-xs-3 active">
                    <label>Ad</label>
                </td>
                <td class="field-label col-xs-3 active">
                    <label>Soyad</label>
                </td>
                <td class="field-label col-xs-3 active">
                    <label>Başlama Tarihi</label>
                </td>
                <td class="field-label col-xs-3 active">
                    <label>Maaş</label>
                </td>
            </tr>
        </div>
    </div>
    <c:if test="${not empty allEmployees}">
        <c:forEach items="${allEmployees}" var="employee">
            <tr>
                <div class="row">
                    <div class="col-md-12">
                        <td>${employee.citizenNumber}</td>
                        <td>${employee.name}</td>
                        <td>${employee.surname}</td>
                        <td>${employee.joiningDate}</td>
                        <td>${employee.salary}</td>
                        <td>
                            <a href="<c:url value='/edit-${employee.oid}-employee' />">${employee.oid}</a>
                        </td>
                        <td>
                            <a href="<c:url value='/delete-${employee.oid}-employee' />">delete</a>
                        </td>
                    </div>
                </div>
            </tr>
        </c:forEach>
    </c:if>
</table>
</div>
</body>
</html>

and here is my controller:

@Controller
@RequestMapping("/employee")
public class EmployeeController {

@Autowired
EmployeeService employeeService;

@RequestMapping(value = {"/","/list"},method = RequestMethod.GET)
public String lisEmployees(Model model){
    List<Employee> employees = employeeService.findAllEmployees();

    model.addAttribute("allEmployees",employees);

    return "allemployees";

  }
}

I debugged on firebug but I can't handle model value and here investigate my jsp pages html code I try to fill a table with model value but it can't fill. I debugged controller and employees list have a record and model have allEmployees key to mapped employees list.

So where am I wrong? How to I cope with this? Please, Could you help me?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.