Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring variables not carrying into view
    primarykey
    data
    text
    <p>I'm very new to Spring and can't seem to figure out what's wrong here. I'm sure it has to be something simple, but anyway:</p> <p>I was going through the tutorial on <a href="http://viralpatel.net/blogs/2010/06/spring-3-mvc-create-hello-world-application-spring-3-mvc.html" rel="nofollow">this page</a>, and I have nearly identical code. After pulling down the Apache Commons library and the JSTL stuff, I was in business. Everything works, down to it actually using the jsp I specified as the view, but the variable "message" in the controller is not being displayed when the site is rendered. It's not because of the expression language stuff, either, because I'm not getting the ${message} text displaying either. It's just a blank page.</p> <p>The only reason I know that the jsp is actually being triggered is because I put a title in there that is no where else and it is being used on page display. I also know that the variable is being set in the controller and the action is being called because of a simple sysout that I put in the mapped function.</p> <p>Thanks for any help!</p> <p><strong>EDIT</strong></p> <p>Here's the jsp:</p> <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8" isELIgnored="false"%&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;om nom JSP Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; ${message} &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And the controller:</p> <pre><code>package org.me.home.controllers; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.portlet.ModelAndView; @Controller public class SomeController { @RequestMapping("/somepage") public ModelAndView someAction() { String mymsg = "Saying hi!"; System.out.println(mymsg); return new ModelAndView("somepage", "message", mymsg); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload