Results 1 to 5 of 5

Thread: Trouble with passing ModelAndView Object to JSP Page

Threaded View

  1. #1
    Join Date
    Apr 2011
    Posts
    3

    Default Trouble with passing ModelAndView Object to JSP Page

    Hi,
    I am new to spring and trying to pass the ModelAndView object from the controller to the JSP page.
    Here is my controller code.
    Code:
    @RequestMapping("/login")
        public ModelAndView login() {
        	LOGGER.info("Inside LOGIN");
        	Health health = null;
        	health.setPasskey("abcd");
        	return new ModelAndView("/admin/login", "health",health);
        	/
        }
    Here is my HTML/JSP code
    HTML Code:
    <html>
    <head>
    <title>
    Health Page Login
    </title>
    </head>
     
    <body  style="overflow: auto; padding:10px;">
    <div class="sectionheader">
    	<div class="sectionheader-left"><h1>Health Page Login</h1></div>
    </div>
    <form id="command" action="mediareport" method="post">
    <div class="formlayout">
    <fieldset title="Search" >
    	<div class="formelements">
    		<div class="floatleft" style="clear:both;">
    			<label style="width:200px;">Please enter password:</label>
    			<input type="Password" name="Password" size="10"></input>
    			<INPUT TYPE="HIDDEN" NAME="key" <c:out VALUE="${health.getPasskey}" /> </INPUT>
    			<input type="submit" value="Login" name="submit" />
    		</div>
    	</div>
    </fieldset>
    </div>
    </form>
    
    </body>
    </html>
    on the mediareport page...when I am trying to get the value of variable ${health.getPasskey} via request.getParameter("key"); it displays ${passkey} instead of "abcd". Please help me regarding this....
    Last edited by sumittyagi; Apr 24th, 2011 at 10:48 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •