• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Logic:iterator issue in Struts 1.3.10

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am initially displaying data from the form which has a list of RoleVO like

package com.web;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts.validator.ValidatorForm;

import com.vo.RoleVO;

public class ManageRoleForm extends ValidatorForm {

//Search Details of the User
private RoleVO searchRoleDetails= new RoleVO();

//ArrayList of the Search Result Roles
private List roleResults=new ArrayList();

public RoleVO getSearchRoleDetails() {
return searchRoleDetails;
}

public void setSearchRoleDetails(RoleVO searchRoleDetails) {
this.searchRoleDetails = searchRoleDetails;
}

public List getRoleResults() {
return roleResults;
}

public void setRoleResults(List roleResults) {
this.roleResults = roleResults;
}

public void reset() {
if (this.roleResults != null) {
RoleVO roleVO = null;
for (int i = 0; i < roleResults.size(); i++) {
roleVO = (RoleVO) roleResults.get(i);
roleVO.setValueSelected("N");
}
}

}

}



I use DispatchAction like

package com.web;

import java.util.List;
import java.util.ListIterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.catalina.Session;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.bao.AdminBAO;
import com.IAdminBAO;
import com.vo.RoleVO;

public class ManageRoleAction extends DispatchAction {

public ActionForward searchRoles(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// Getting the Manage User form
ManageRoleForm manageRoleForm = (ManageRoleForm) form;

RoleVO searchRoleVO = manageRoleForm.getSearchRoleDetails();
IAdminBAO adminBAO = new AdminBAO();
manageRoleForm.setRoleResults(adminBAO.searchRole(searchRoleVO));
return mapping.findForward("searchResults");
}

public ActionForward deleteRoles(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// Getting the Manage User form
HttpSession session = request.getSession();
ManageRoleForm manageRoleForm = (ManageRoleForm)form;

List searchRoleVO = manageRoleForm.getRoleResults();
System.out.println(searchRoleVO.size());
ListIterator iterator = searchRoleVO.listIterator();
RoleVO roleVO = null;
while (iterator.hasNext()) {

roleVO = (RoleVO) iterator.next();
System.out.println(roleVO.getValueSelected());
System.out.println(roleVO.getRoleID());

}

// Call the Service to get the Search Results

// Modify this
return mapping.findForward("searchResults");
}

}


package com.vo;

import java.io.Serializable;
import java.util.Date;

public class RoleVO implements Serializable {

// Role ID of the User
private String roleID;

// Role Name of the User
private String roleName;

// Status of the User
private String status;

// No of Users
private String noOfUsers;

// Updated By
private String updatedBy;

// Updated On
private Date updatedOn;

// isSelected attribute
private String valueSelected="N";

public String getRoleID() {
return roleID;
}

public void setRoleID(String roleID) {
this.roleID = roleID;
}

public String getRoleName() {
return roleName;
}

public void setRoleName(String roleName) {
this.roleName = roleName;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public String getNoOfUsers() {
return noOfUsers;
}

public void setNoOfUsers(String noOfUsers) {
this.noOfUsers = noOfUsers;
}

public String getUpdatedBy() {
return updatedBy;
}



public String getValueSelected() {
return valueSelected;
}

public void setValueSelected(String valueSelected) {
this.valueSelected = valueSelected;
}

public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}

public Date getUpdatedOn() {
return updatedOn;
}

public void setUpdatedOn(Date updatedOn) {
this.updatedOn = updatedOn;
}



}


I am unable to edit the value of text box in the jsp

<logic resent name="manageRoleForm" property="roleResults" >


<logic:iterate id="roles" name="manageRoleForm"
property="roleResults" type="com.vo.RoleVO" >

<tr>
<td>
<div align="center"><font color="#008000"><a
class="marln" href="ModifyRole.htm"><bean:write name="roles" property="roleID" /></a> </font></div>
</td>
<td>
<div align="center"><font color="#008000"><bean:write name="roles" property="roleName" /> </font></div>
</td>
<td>
<div align="center"><font color="#008000"><bean:write name="roles" property="status" /> </font></div>
</td>
<td>
<div align="center"><font color="#008000"><bean:write name="roles" property="noOfUsers" /></font></div>
</td>
<td>
<div align="center"><font color="#008000"><bean:write name="roles" property="updatedBy" /></font></div>
</td>
<td>
<div align="center"><font color="#008000">10/02/2008
10:21:12</font></div>
</td>
<td>
<div align="center"><html:text name="roles"
property="valueSelected" indexed="true"> </html:text>
</div>
</td>
</tr>
</logic:iterate>
</logic resent>
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Sri Ram,

We are migrating to Struts v1.3.10 from Struts v1.3.8.

I did not face the problem which you have mentioned in your post above. Could you please tell me what was the actual problem and how did you produce that? and how did you solved that problem??

So far it seems like a smooth migration activity. We are not facing any issue in our local environment?

can you tell me if there is/are any other issue(s) that we can face after migrating to Struts v1.3.10 from Struts v1.3.8?

Thanks and Kind Regards,
Nawaz
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic