Reputation: 1170
I am trying to send data on jsp from my controller and trying to read it with Spring EL but i am not able to do it.
Controller:
@RequestMapping("/home")
public String StudentHome(RedirectAttributes ra){
String msg="mydata";
ra.addFlashAttribute("msg", msg);
return "home";
}
jsp:
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
${msg}
</body>
</html>
Do i need to include anything else?
Upvotes: 2
Views: 145
Reputation: 259
RedirectAttribute is only used when you redirect. Try using return "redirect:home";
-BCP
Upvotes: 1
Reputation: 8113
Add the @Controller
annotation above the @RequestMapping
annotation
Make a bean for your controller in controller-spring-beans.xml
.
Sample
<bean name="yourController"
class="your.package">
<property name="successView" value="path/to/your.jsp" />
</bean>
Read about Spring
here
Upvotes: 0