Announcement Announcement Module
No announcement yet.
Problem is displaying the data in JSP using spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem is displaying the data in JSP using spring

    Hi everyone,

    I am facing a problem displaying the user name and login time on successful login. I have tried hard but fail to figure out the problem. Below is my controller class which redirects to the successfulLogin.jsp page also listed below-

    * The Class LogonSimpleFormController.
    public class LogonSimpleFormController extends SimpleFormController {

    * Default Constructor
    public LogonSimpleFormController() {
    System.out.println("in LogonSimpleFormController constructor");

    * On submit.
    * @param command
    * the command
    * @return the model and view
    * @throws ServletException
    * the servlet exception
    public ModelAndView onSubmit(Object command) throws ServletException {
    User user = (User) command;
    System.out.println("in LogonSimpleFormController onSubmit="
    + user.getUsername());

    Map myModel = new HashMap();
    String now = (new java.util.Date()).toString();

    myModel.put("user", user);
    myModel.put("now", now);
    return new ModelAndView(new RedirectView(getSuccessView()), "model",

    And my jsp page is -

    <%@ include file="/WEB-INF/jsp/include.jsp"%>
    <%@page import="java.util.HashMap," %>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Logged In</title>
    System.out.println("in succeesfullogon.jsp=" + request.getParameter("model"));
    <h1>You have sucessfully logged in as <core:out value="${model.user.username}"/> at <core:out value="${}"/> </h1>

    but the jsp does not show the value of "now" and "username" although the System.out.println shows that the model object is there in the jsp page and also the username is getting printed on the console from the controller's onSubmit method.

    What gets displayed on the jsp page is
    You have sucessfully logged in as at
    and the querystring is
    http://localhost:8080/spring/successfulLogin.htm?model=%7Bnow%3DFri+Dec+15+11%3 01873%7D

    Any idea what the issue might be?

    Ashish Abrol

  • #2
    You will probably get an answer for this question in the Web forum: