• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

MultiActionController issue

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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="<c:out value="${user.loginName}"/>"/>
< value="<c:out value="${user.loginName}"/>" />
</td>
</tr>
<tr>
<td>
<b>Password:</b>
</td>
<td>
<input type="text" value="<c:out value="${user.password}"/>"/>
</td>
</tr>
<tr>
<td>
<b>First Name:</b>
</td>
<td>
<input type="text" value="<c:out value="${user.firstName}"/>"/>
</td>
</tr>
<tr>
<td>
<b>Last Name:</b>
</td>
<td>
<input type="text" value="<c:out value="${user.lastName}"/>"/>
</td>
</tr>
<tr>
<td>
<b>Phone:</b>
</td>
<td>
<input type="text" value="<c:out 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>
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic