wood burning stoves 2.0*
The moose likes Spring and the fly likes MultiActionController issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "MultiActionController issue" Watch "MultiActionController issue" New topic
Author

MultiActionController issue

Abhi Singh
Greenhorn

Joined: Feb 02, 2010
Posts: 13
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

Joined: Sep 29, 2008
Posts: 12617

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MultiActionController issue
 
Similar Threads
Jsp Array Iteration
Neither BindingResult nor plain target object for bean name 'vids2m1' available as request attribute
Spring:bind tag for multiple objects
Help submitting forms via SpringMVC and RESTful Web Service
pagination exception in spring