Announcement Announcement Module
Collapse
No announcement yet.
Accessing model from view Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing model from view

    I'm sure this question has probably been asked or the answer is somewhere, but I can't seem to find it. And experimentation has let me know where.

    How to I access a model passed to the view from the controller via the View.render(model, request, response) method?

    Thanks

  • #2
    Re: Accessing model from view

    Hello,

    The model is usually a hashmap and hence you will have to use the same keys which you have used to populate this map. If you are referring to the command object then you can use the same name which you have specified in the commandName property of your controller.

    e.g. If you have put a list of Employee object in model map with key name as lst_emp, then in JSP page you can access those as follows


    Code:
    <c:forEach items="${lst_emp}" var="employee">
        <c:out value="${employee.description}"/>
    </c:forEach>
    Hope this answer's your question.

    Regards,
    Prasad P. Khandekar

    Comment

    Working...
    X