File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Unable to get the modified value from Struts 1.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unable to get the modified value from Struts 1.2" Watch "Unable to get the modified value from Struts 1.2" New topic

Unable to get the modified value from Struts 1.2

dhaya nidhi

Joined: Nov 05, 2009
Posts: 4

I've a problem in reading the value modified in Text box in Struts1.2.

Action Form:

public class ResellerForm extends ActionForm{

private String name;
List<ResellerBeanByVendor> byVendorList;
public String getName() {
return name;
public void setName(String name) { = name;
public List<ResellerBeanByVendor> getByVendorList() {
return byVendorList;

public void setByVendorList(List<ResellerBeanByVendor> byVendorList) {
this.byVendorList = byVendorList;


public class ResellerBeanByVendor implements Serializable{

String vendorName;
List<ResellerBean> resellerBeanList;
public String getVendorName() {
return vendorName;
public void setVendorName(String vendorName) {
this.vendorName = vendorName;
public List<ResellerBean> getResellerBeanList() {
return resellerBeanList;
public void setResellerBeanList(List<ResellerBean> resellerBeanList) {
this.resellerBeanList = resellerBeanList;


public class ResellerBean implements Serializable{

private String email;

public String getEmail() {
return email;

public void setEmail(String email) { = email;

Action Class
public class ResellerAction extends Action{

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

String action = request.getParameter("action");
ResellerForm resellerForm = (ResellerForm)form;
if("view".equalsIgnoreCase(action) || action == null){
ResellerBeanByVendor byVendor = new ResellerBeanByVendor();
ResellerBean resellerBean = new ResellerBean();
List<ResellerBean> resellerBeanList = new ArrayList<ResellerBean>();
List<ResellerBeanByVendor> byVendorList = new ArrayList<ResellerBeanByVendor>();
}else if("edit".equalsIgnoreCase(action)){
List<ResellerBeanByVendor> byVendorList =resellerForm.getByVendorList();
for(ResellerBeanByVendor byVendor:byVendorList){
List<ResellerBean> resellerBeanList = byVendor.getResellerBeanList();
for(ResellerBean resellerBean:resellerBeanList){
return mapping.findForward("success");


<%@page import="java.util.ArrayList"%>
<%@page import="com.reseller.ResellerForm"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ page import="com.reseller.ResellerForm" %>
<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reseller Page</title>
<logic:present name="ResellerForm" property="byVendorList">
<html:form action="/reseller?action=edit">

<logic:iterate id="byVendorList" name="ResellerForm" property="byVendorList" indexId="j">
<bean:write name="byVendorList" property="vendorName" />
<logic:iterate id="resellerBeanList" name="byVendorList" property="resellerBeanList" indexId="i">
<html:text name="resellerBeanList" value="${byVendorList.resellerBeanList[i].email}" property="email" indexed="true"/>
<html:submit >SAVE</html:submit>

Url to access:

WHen my action is view, i'm displaying the value in text box but when action is edit i.e. if i click the button
what ever the value i'm entering in the text box is not able to retreive in the action class.

Reason for having this complex structure of action form is the business requirement which is already implemented for view.So now i have to implement it for edit.
So i can't modify the bean struture.Kindly help me.

I'm in deep trouble.Please suggest the solution.

Thanks well in advance.

I agree. Here's the link:
subject: Unable to get the modified value from Struts 1.2
It's not a secret anymore!