Skip to main content

Spring MVC Form validation. Unable to read Domain object in jsp.

1 reply [Last post]
jazz_619
Offline
Joined: 2011-05-17
Points: 0

I am Developing a simple Spring MVC form Validation, but Stucked. Domain object in JSP is showing null.
Validation is working fine, I checked Domain Object (user in my case) prints values using service methods.
But shows null in jsp. I even tried using Jsp:usebeans bu same happened.
OnSubmit method of userController.java

public ModelAndView onSubmit(Object command)
{
User user = (User) command;
userService.addUser(user);

return new ModelAndView("userSucess","user",user);

}
My Sucess.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page import="com.spring.domain.User;"%>
<jsp:useBean id="userDetails" class="com.spring.domain.User" scope="session"></jsp:useBean>
<html>
<head>

<title>Success Page</title>
</head>
<body>
<hr />
<%=userDetails.name %>
<%=userDetails.password %>
User Name : <c:out value="${userDetails.name}"></c:out> <br/>
Gender : <c:out value="${userDetails.gender}"></c:out><br/>
Country : <c:out value="${userDetails.name}"></c:out><br/>
About You : <c:out value="${userDetails.name}"></c:out><br/>

</body>
</html>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jazz_619
Offline
Joined: 2011-05-17
Points: 0

Any Help !!