This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to get the modified value from Struts 1.2  RSS feed

dhaya nidhi
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!