getting empty objects while passing from controller to jsp

I have a problem when passing a list of objects from controller to jsp. here i the jsp page

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
 <!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>Users</title>
</head>
 <body>
 <h1>User list</h1>

   <c:url var="editImgUrl" value="/edit.png" />
   <c:url var="deleteImgUrl" value="/delete.png" />

<table style="border: 1px solid; width: 100%; text-align:center">
    <thead style="background:#d3dce3">
        <tr>
            <th>Id</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>login</th>
            <th>service line</th>
            <th colspan="2"></th>
        </tr>
    </thead>
    <tbody style="background:#ccc">
    <c:forEach items="${userList}" var="user">
        <c:url var="editUrl" value="/edit?id=${user.iduser}" />
        <c:url var="deleteUrl" value="/delete?id=${user.iduser}" />

        <tr>
            <td>${user.iduser}</td>
            <td><c:out value="${user.firstName}" /></td>
            <td><c:out value="${user.lastName}" /></td>
            <td><c:out value="${user.login}" /></td>
            <td><c:out value="${user.serviceline}" /></td>

 <td><a href="edit?id=${user.id_user}"><img src="${editImgUrl}"></img></a></td>  
  <td><a href="delete?id=${user.id_user}"><img src="${deleteImgUrl}"></img></a>        </td>  

   </tr>

  </c:forEach>
   </tbody>
  </table>

   <a href="list3">Click Here to see user List</a>  
 </body>
</html>

here is my controller:

    package test3.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import test3.model.entities.User;
import test3.service.UserService;

@Controller
public class UserController {

    @Autowired  
     public UserService userService; 

     @RequestMapping("form")  
     public String viewRegistration(Map<String, Object> model) {
            User user = new User();    
            model.put("user", user);

          /**  List<String> servicelineList = new ArrayList<String>();
            servicelineList.add("ADM");
            servicelineList.add("PBS");
            servicelineList.add("CSD");
            model.put("servicelineList", servicelineList);**/

            return "form";
     }  

     @RequestMapping("register")  
     public ModelAndView registerUser(@ModelAttribute User user) {  
      userService.add(user);
      return new ModelAndView("redirect:list");  
     }  



     @RequestMapping(value="list", method = RequestMethod.GET)  
     public ModelAndView getAll(){ 
         ModelAndView model=new  ModelAndView("list");
     try {
        model.addObject("userList",userService.getAll());
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }  
      return model;
     }  

     public String getUser(Map<String, Object> model) {
            User user = new User();    
            model.put("user", user);

          /**  List<String> servicelineList = new ArrayList<String>();
            servicelineList.add("ADM");
            servicelineList.add("PBS");
            servicelineList.add("CSD");
            model.put("servicelineList", servicelineList);**/

            return "form";
     }  

}

this is the view i get:

a table with these values : $user.iduser, $user.lastname ... (i can t post the pic)

i thought that the result of the query is empty, but i ve tried to pass a list of string and i got the same problem.

thank u for your help

Answers


well i fixed the problem by adding

<%@ page isELIgnored="false" %>

to the jsp file.


Need Your Help

Not able to add the fill between the paths. using d3js

d3.js

i am trying to fill the background between 2 lines, but i am not getting any correct output.

Errors after proguarding android project gson

android gson proguard

After running proguard on my project everything is well but i got a problem with that. I use specification for gson in rules but i still got this kind of error. Normally this code works well. Hmm d...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.