Announcement Announcement Module
Collapse
No announcement yet.
${object.memberName} doesn't work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ${object.memberName} doesn't work

    Hello expert,

    I use Spring MVC, and abstractController to handle page request. from this controller i return a new ModelAndView("ViewName", "ModelName", ModelObject);

    as expected, after this code, the dispatcher forward the page to a jsp page named "ViewName.jsp". Inside the body section of this jsp page, i have this code to retrieve value from the model object:
    Code:
    <body>
    ....
    Object is : ${ModelName.myobject}
    ....
    </body>
    My problem is at runtime, the page just shows ${ModelName.myobject} instead of the value of the model object.

    Can you tell if i need to include and jstl file?

    Thanks,

  • #2
    Hi,

    Yes ,include the JSTL tag libraray in your code and then in order to display the below text use <c:out > tag as shown below

    <c:out vaule="${ModelName.myobject}"/>

    Kartik

    Comment


    • #3
      I suggest a search as this question has been answered numerous times before.

      Either use the solution from kravicha or fix the version of jstl you are using, depends on the version of your container and the version specified in the web.xml.

      Comment


      • #4
        Are you sure your setting of applicatContext.xml follow the manual?
        Below is ordinary one
        Code:
        	<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
        		<property name="prefix" value="/WEB-INF/jsp/"/>
        		<property name="suffix" value=".jsp"/>
        	</bean>

        Comment


        • #5
          I think c:out is not necessary. Actually my code in the first post works for me. but only on this particular web server, jetty 6.1.8 that it doesn't work.

          Jetty 6.1.8 standalone, my code works without problem. but for the jetty 6.18 bundled, it doesn't work.

          Comment


          • #6
            >> Are you sure your setting of applicatContext.xml follow the manual?

            Yes, the page redirect works perfectly, the only problem is the statement ${...} which is not interpreted.


            Thanks,

            Comment

            Working...
            X