Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MultiActionController issue

 
Abhi Singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Spring and my problem is that I am unable to fetch data from a jsp page in my MultiActionController.....I am getting null value there..


My jsp is as follow

<%--
Document : viewProfile
Created on : Feb 25, 2010, 8:24:36 PM
Author : Abhijeet
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="/spring" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Profile View Page</title>
</head>
<body>
<center>
<h2>My Profile</h2>
<form:form commandName="user" action="../Profile/UpdateDetail.htm" method="post">
<table border="1" bgcolor="gray">
<c:forEach items="${user}" var="user">
<tr>
<td>
<b>Login Id:</b>
</td>

<td>
<%--form:input path="loginName" /--%>
<input disabled="true" type="text" value="<cut value="${user.loginName}"/>"/>
< value="<cut value="${user.loginName}"/>" />
</td>
</tr>
<tr>
<td>
<b>Password:</b>
</td>
<td>
<input type="text" value="<cut value="${user.password}"/>"/>
</td>
</tr>
<tr>
<td>
<b>First Name:</b>
</td>
<td>
<input type="text" value="<cut value="${user.firstName}"/>"/>
</td>
</tr>
<tr>
<td>
<b>Last Name:</b>
</td>
<td>
<input type="text" value="<cut value="${user.lastName}"/>"/>
</td>
</tr>
<tr>
<td>
<b>Phone:</b>
</td>
<td>
<input type="text" value="<cut value="${user.phone}"/>"/>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Save" >
</td>

</tr>
</c:forEach>
</table>

</form:form>
</center>
</body>
</html>



I am trying to get the text box value from above jsp into my MultiActionController.......


My dispatcher-servlet.xml
..
...
..
<bean name="/Profile/*.htm" class="com.webaccess.springtrial.web.ProfileController">
<!--property name="commandName" value="profileForm"/>
<property name="commandClass" value="com.webaccess.springtrial.domain.User"-->
<property name="login" ref="login"/>



and ProfileController

public ModelAndView UpdateDetail(HttpServletRequest request,
HttpServletResponse response,Object command)throws Exception{

User user=(User)command;
// String userName=request.getParameter("loginName");
// String pass=request.getParameter("password");
// String fName=request.getParameter("firstName");
// String lName=request.getParameter("lastName");
// Long phn=Long.parseLong(request.getParameter("phone"));
String userName=user.getLoginName();
String pass=user.getPassword();
String fName=user.getFirstName();
String lName=user.getLastName();
Long phn=user.getPhone();
return new ModelAndView("home");

}

can anyone suggest me the fault in above coding or the alternate solution

</bean>
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic