Results 1 to 6 of 6

Thread: ${object.memberName} doesn't work

  1. #1
    Join Date
    Sep 2009
    Posts
    10

    Question ${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. #2

    Default

    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

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #4
    Join Date
    Mar 2010
    Posts
    11

    Default

    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>

  5. #5
    Join Date
    Sep 2009
    Posts
    10

    Default

    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.

  6. #6
    Join Date
    Sep 2009
    Posts
    10

    Default

    >> 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,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •