Announcement Announcement Module
Collapse
No announcement yet.
${message} not displayed! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ${message} not displayed!

    Hello,

    I managed to get my first page loading with Spring, however I am finding a difficulty regarding the displaying messages set from the controller on the jsp page.

    Now, I am a little new to Spring, however in the book I am reading I have the example as follows:

    Code:
    <html>
    	<head>. . .</head>
    	<body>
    		<h2>${message}</h2>
    
    	</body>
    </html>
    Now my problem is that my page is loading successfully, I also placed a System.out.println in my controller to see if it is passing from it and yes it is (Was so happy to see that .

    However in the page I get printed ${message} and not the message I am setting in the ModelAndView.

    Code:
    return new ModelAndView("home", "message", "vavavoom");
    Now, I did not give up on seeing that I found a tutorial (as I think I said in another post) called Spring MVC Step by Step. In this one it prints the message doing as follows:

    Code:
    <c:out value="${prod.description}"/>
    Now my question is, do I need that c:out thing? Or I should have my message rapped all the same. In my app-servlet.xml I also have the view resolve set as follows:

    Code:
    	<bean id="viewResolver" 
    	class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="prefix">
    			<value>/WEB-INF/jsp/</value>
    		</property>
    		<property name="suffix">
    			<value>.jsp</value>
    		</property>
    	</bean>
    This seems to be working fine since my page is being find and displayed successfully (this means in the URL I insert home.htm, and it returns the data from home.jsp).

    I am planning to start using FreeMarker after this, however would really like to know whether I should have any message displayed to me before passing to the next step.

    Thanks and Regards,
    Sim085

  • #2
    You need
    Code:
    c:out
    if your container doesn't support JSP 2, or if you webapp deployed with web.xml referenced servlet version below 2.4

    Comment


    • #3
      Recent post

      Your problem seems a tad like my dilemma yesterday.
      You can read the thread here

      In shorttext you have to alter your web.xml to get all going. Maybe also make sure you are using jstl.jar v1.1. Well. It's all there...

      Comment


      • #4
        Thanks

        Hi,

        Thanks for your all your posts I tought of trying that out, but then I decided to go strait to FreeMarker and it worked fine thanks a lot for all the help

        regards,
        sim085

        Comment


        • #5
          Originally posted by betabagel
          Your problem seems a tad like my dilemma yesterday.
          You can read the thread here

          In shorttext you have to alter your web.xml to get all going. Maybe also make sure you are using jstl.jar v1.1. Well. It's all there...
          I checked your post and did what you said and it worked thanks one more time.

          regards,
          sim085

          Comment

          Working...
          X