Announcement Announcement Module
Collapse
No announcement yet.
JSTL issue ! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JSTL issue !

    Hi Techies,

    I am using spring annotations, the following is controller,

    =========================

    @Controller
    @RequestMapping("/contactmanagement.html")
    @SessionAttributes("details")

    public class ContactManagementSystem {

    private AppoinmentDAO appoinmentDAO;

    @Autowired
    public void setAppoinmentDAO(AppoinmentDAO appoinmentDAO) {
    this.appoinmentDAO = appoinmentDAO;
    }

    @ModelAttribute("customerList")
    public List<CustomerBean> customerDetailList() {
    return appoinmentDAO.getCustomers();
    }


    @RequestMapping(method = RequestMethod.GET)
    public String showContactForm(@ModelAttribute("contact") CustomerBean contact , ModelMap model) {
    System.out.println("Am in Get Method !!");
    model.addAttribute("contact", contact);
    return "temp";
    }

    @RequestMapping(method = RequestMethod.POST)
    public String onSubmit(@ModelAttribute("bean") CustomerBean bean) {
    return "contact";
    }

    =============

    and my jsp is :
    =====================

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

    <html>
    <head>

    </head>
    <body>

    <c:forEach var="temp" items="${customerList}">
    <c:out value="${temp}"></c:out>
    <c:out value="${temp.firstName}"></c:out>
    </c:forEach>

    </body>
    </html>

    ============

    I am getting the following O/P

    com.XXXX.bean.CustomerBean@f77511
    Naveen
    com.XXXX.bean.CustomerBean@131f2b4
    // The Value is not displaying
    com.XXXX.bean.CustomerBean@ea3932
    // The Value is not displaying
    ============

    Actually am setting the Bean Attribute , whiler iterate the Last list name only am getting and the rest of the name is not displaying.


    Any idea and suggestions welcome please,

    -----------------

    Thanks & Regards,

    Thangavel L Nathan.
Working...
X