Results 1 to 5 of 5

Thread: ${message} not displayed!

  1. #1
    Join Date
    Jan 2006
    Posts
    101

    Default ${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. #2
    Join Date
    Jul 2005
    Location
    Russia
    Posts
    118

    Default

    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

  3. #3
    Join Date
    Apr 2006
    Location
    Oslo, Norway
    Posts
    23

    Default 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...

  4. #4
    Join Date
    Jan 2006
    Posts
    101

    Default 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

  5. #5
    Join Date
    Jan 2006
    Posts
    101

    Default

    Quote 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

Posting Permissions

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