Reputation: 1407
I have problem when i read a tutorial about spring mvc.The project have jsp page like:
<html>
<head>
<title>Spring 3.0 MVC Series: Hello World - ViralPatel.net</title>
</head>
<body>
hello!
${inf}
</body>
</html>
And when i set a value for the inf in the controller,but,the "${inf}" fails to retirve the value.
what should i do now?
thx
add: the controller's code:
package net.viralpatel.spring3.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.portlet.ModelAndView;
@Controller
public class HelloWorldController {
@RequestMapping("hello")
public ModelAndView helloWorld() {
String message = "Hello World, Spring 3.0!";
System.out.println(message);
ModelAndView modelandview=new ModelAndView("hello");
modelandview.addObject("inf", message);
//return new ModelAndView("hello", "message", message);
return modelandview;
}
}
Upvotes: 0
Views: 184
Reputation: 8414
Try changing your import for ModelAndView to:
org.springframework.web.servlet.ModelAndView
Upvotes: 1