Thanks but this still isnt working! Nothing I try works! WTF! AAAAAAAAAAA Help anyone? This can not be so uncommon as no one here knows how to do this?
**ERROR**
<Sep 9, 2002 8:48:10 PM EDT> <Error> <HTTP>
<[WebAppServletContext(4298512,recei
ptsplus,/receiptsplus)] Root cause of ServletException
javax.servlet.jsp.JspException: Cannot find bean aUser in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:493)
at
org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179)
at
jsp_servlet.__advanced_user_search._jspService(__advanced_user_search
.java:1534)
Here's one of the many errors.
Users object contains getUsers() that returns an ArrayList of User value
objects.
I've tried many combinations of these lines
<logic:iterate collection="<%= users.getUsers() %>" id="aUser"
name="users" scope="request">
<logic:iterate id="aUser" name="users" scope="request">
<logic:iterate id="aUser" name="users" property="users"
scope="request">
with these combinations of bean writers
<td><bean:write name="aUser" property="users.userID"/></td>
<td><bean:write name="aUser" property="userID"/></td>
<td><bean:write name="aUser" property="users.userID"
scope="request"/></td>
<td><bean:write name="aUser" property="userID"
scope="request"/></td>
But if I explicitly go through the object I can iterate through it. It seems
as though this tag needs better documentation and real world examples.
This works
<% Users users =
(Users)request.getAttribute("users");
if(users != null)
{
Iterator iterator = users.getUsers().iterator();
while(iterator.hasNext())
{%><tr><%
User user = (User)iterator.next();
out.print("<td>"+user.getUserID()+"</td>");
out.print("<td>"+user.getUserType()+"</td>");
out.print("<td>"+user.getFirstName()+"</td>");
out.print("<td>"+user.getMiddleName()+"</td>");
out.print("<td>"+user.getLastName()+"</td>");
out.print("<td>"+user.getAccountDisabled()+"</td>");
out.print("<td>"+user.getEmail()+"</td></tr>");
}
%>
<%}%>
Code is attached.
Help! I'm doing everything I can see/think of in the docs/examples/etc and
nothing is working.
Mike
----- Original Message -----
From: "Todd Pierce" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 7:41 PM
Subject: RE: How to user logic:iterate
> Your arraylist isn't in the page context. Try this:
>
> <%
> ArrayList users = (ArrayList) request.getAttribute("users");
> pageContext.setAttribute("userList", users);
> %>
>
> <logic:iterate name="userList" id="aUser" scope="request">
> <tr>
> <td><bean:write name="aUser" property="user.userID"/></td>
> ...
>
> or use the collection attribute instead of the name attribute in the
iterate
> tag, ike this:
>
> <%
> ArrayList users = (ArrayList) request.getAttribute("users");
> %>
>
> <logic:iterate collection="<%= users %>" id="aUser" scope="request">
> <tr>
> <td><bean:write name="aUser" property="user.userID"/></td>
> ...
>
> -----Original Message-----
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 10 September 2002 6:56 AM
> To: Struts Users Mailing List
> Subject: How to user logic:iterate
>
>
> Im having a helluva time getting logic:iterate to work..
> I have a Users object that contains an array list of
> User objects.
> you call Users.getUsers() and it returns an arrayList
> I stick that in the request object in the perform() method using
> request.setAttribute("users", users.getUsers());
> In the JSP the code I have is;
>
> <% ArrayList users = (ArrayList) request.getAttribute("users");
> if(users != null)
> {%>
> <logic:iterate name="users" id="aUser" scope="request">
> <tr>
> <td><bean:write name="aUser" property="user.userID"/></td>
> <td><bean:write name="aUser" property="user.userType"/></td>
> <td><bean:write name="aUser" property="user.fName"/></td>
> <td><bean:write name="aUser" property="user.mName"/></td>
> <td><bean:write name="aUser" property="user.lName"/></td>
> <td><bean:write name="aUser" property="user.accoundDisabled"/></td>
> <td><bean:write name="aUser" property="user.email"/></td>
> </tr>
> </logic:iterate>
> <%}%>
>
> The error I'm getting is;
>
> <Sep 9, 2002 4:52:00 PM EDT> <Error> <HTTP>
> <[WebAppServletContext(4398493,recei
> ptsplus,/receiptsplus)] Root cause of ServletException
> javax.servlet.jsp.JspException: Cannot find bean aUser in scope null
> at
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:493)
> at
> org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179)
> at
> jsp_servlet.__advanced_user_search._jspService(__advanced_user_search
> .java:1541)
> at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:265)
>
> what am I doing wrong?
> help!
> thanks,
> Mike
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
advanced_user_search.jsp
Description: Binary data
package com.afterbot.receiptsplus.user;
import com.afterbot.util.SearchCriteria;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class UserSearchCriteria extends SearchCriteria
{
public static final short USER_ID = 0 + SEARCH_CRITERIA_INDEX;
public static final short USER_TYPE = 1 + SEARCH_CRITERIA_INDEX;
public static final short LAST_NAME = 2 + SEARCH_CRITERIA_INDEX;
public static final short MIDDLE_NAME = 3 + SEARCH_CRITERIA_INDEX;
public static final short FIRST_NAME = 4 + SEARCH_CRITERIA_INDEX;
public static final short ACCOUNT_DISABLED = 5 + SEARCH_CRITERIA_INDEX;
public static final short LOYALTY_CARD_NUM = 6 + SEARCH_CRITERIA_INDEX;
public static final short EMAIL = 7 + SEARCH_CRITERIA_INDEX;
public static final short ADDRESS1 = 8 + SEARCH_CRITERIA_INDEX;
public static final short ADDRESS2 = 9 + SEARCH_CRITERIA_INDEX;
public static final short CITY = 10 + SEARCH_CRITERIA_INDEX;
public static final short STATE = 11 + SEARCH_CRITERIA_INDEX;
public static final short ZIP = 12 + SEARCH_CRITERIA_INDEX;
public static final short COUNTRY = 13 + SEARCH_CRITERIA_INDEX;
public static final short USER_ROLE = 14 + SEARCH_CRITERIA_INDEX;
public static final short LANGUAGE = 15 + SEARCH_CRITERIA_INDEX;
public static final short VARIANT = 16 + SEARCH_CRITERIA_INDEX;
public static final short TELEPHONE = 17 + SEARCH_CRITERIA_INDEX;
public static final short SECURITY_QUESTION = 18 + SEARCH_CRITERIA_INDEX;
public static final short SECURITY_ANSWER = 19 + SEARCH_CRITERIA_INDEX;
public static final short PASSWORD = 20 + SEARCH_CRITERIA_INDEX;
public static short CRITERIA_SIZE = 21 + SEARCH_CRITERIA_INDEX;
private String userID;
private String userType;
private String lName;
private String mName;
private String fName;
private String password;
private boolean accountDisabled = true;
private String loyaltyCardNum;
private String email;
private String address1;
private String address2;
private String city;
private String state;
private String zip;
private String country;
private String[] userRole;
private int language;
private String variant;
private String telephone;
private String securityQuestion;
private String securityAnswer;
private String namespace;
public UserSearchCriteria()
{
criteriaList = new boolean[CRITERIA_SIZE];
System.out.println("Search criteria size="+CRITERIA_SIZE);
System.out.println("listsize="+super.criteriaList.length);
}
public String getUserID() { return userID; }
public void setUserID(String userID) { this.userID = userID; criteriaList[USER_ID] = true; }
public String getUserType() { return userType; }
public void setUserType(String userType) { this.userType = userType; criteriaList[USER_TYPE] = true; }
public String getLastName() { return lName; }
public void setLastName(String lastName) { this.lName = lastName; criteriaList[LAST_NAME] = true; }
public String getMiddleName() { return mName; }
public void setMiddleName(String mName) { this.mName = mName; criteriaList[MIDDLE_NAME] = true; }
public String getFirstName() { return fName; }
public void setFirstName(String fName) { this.fName = fName; criteriaList[FIRST_NAME] = true; }
public String getPassword() { return password; }
public void setPassword(String password) { this.password = password; criteriaList[PASSWORD] = true; }
public boolean getAccountDisabled() { return accountDisabled; }
public void setAccountDisabled(boolean accountDisabled) { this.accountDisabled = accountDisabled; criteriaList[ACCOUNT_DISABLED] = true; }
public String getLoyaltyCardNumber() { return loyaltyCardNum; }
public void setLoyaltyCardNumber(String loyaltyCardNum) { this.loyaltyCardNum = loyaltyCardNum; criteriaList[LOYALTY_CARD_NUM] = true; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; criteriaList[EMAIL] = true; }
public String getAddress1() { return address1; }
public void setAddress1(String address1) { this.address1 = address1; criteriaList[ADDRESS1] = true; }
public String getAddress2() { return address2; }
public void setAddress2(String address2) { this.address2 = address2; criteriaList[ADDRESS2] = true; }
public String getCity() { return city; }
public void setCity(String city) { this.city = city; criteriaList[CITY] = true; }
public String getState() { return state; }
public void setState(String state) { this.state = state; criteriaList[STATE] = true; }
public String getZip() { return zip; }
public void setZip(String zip) { this.zip = zip; criteriaList[ZIP] = true; }
public String getCountry() { return country; }
public void setCountry(String country) { this.country = country; criteriaList[COUNTRY] = true; }
public String[] getUserRole() { return userRole; }
public void setUserRole(String[] userRole) { this.userRole = userRole; criteriaList[USER_ROLE] = true; }
public int getLanguage() { return language; }
public void setLanguage(int language) { this.language = language; criteriaList[LANGUAGE] = true; }
public String getTelephone() { return telephone; }
public void setTelephone(String telephone) { this.telephone = telephone; criteriaList[TELEPHONE] = true; }
public String getSecurityQuestion() { return securityQuestion; }
public void setSecurityQuestion(String securityQuestion) { this.securityQuestion = securityQuestion; criteriaList[SECURITY_QUESTION] = true; }
public String getSecurityAnswer() { return securityAnswer; }
public void setSecurityAnswer(String securityAnswer) { this.securityAnswer = securityAnswer; criteriaList[SECURITY_ANSWER] = true; }
public String getVariant() { return variant; }
public void setVariant(String variant) { this.variant = variant; criteriaList[VARIANT] = true; }
public static void main(String[] args)
{
UserSearchCriteria userSearchCriteria1 = new UserSearchCriteria();
}
} // end UserSearchCriteria
package com.afterbot.receiptsplus.user;
import org.w3c.dom.Document;
import java.util.Locale;
/**
* Value Object holding all pertinent data for a User.
* No javadocs for individual methods as their names should be self explanatory.
* @author Michael Lee
*/
public class User
{
private String userID;
private String userType;
private String lName;
private String mName;
private String fName;
private String password;
private boolean accountDisabled = true;
private String loyaltyCardNum;
private String email;
private String address1;
private String address2;
private String city;
private String state;
private String zip;
private String country;
private String[] userRoles;
private int language;
private String variant;
private String telephone;
private String securityQuestion;
private String securityAnswer;
private Document document;
private String namespace;
public User(){}
public String getUserID() { return userID; }
public void setUserID(String userID) { this.userID = userID; }
public String getUserType() { return userType; }
public void setUserType(String userType) { this.userType = userType; }
public String getLastName() { return lName; }
public void setLastName(String lastName) { this.lName = lastName; }
public String getMiddleName() { return mName; }
public void setMiddleName(String mName) { this.mName = mName; }
public String getFirstName() { return fName; }
public void setFirstName(String fName) { this.fName = fName; }
public String getPassword() { return password; }
public void setPassword(String password) { this.password = password; }
public boolean getAccountDisabled() { return accountDisabled; }
public void setAccountDisabled(boolean accountDisabled) { this.accountDisabled = accountDisabled; }
public String getLoyaltyCardNumber() { return loyaltyCardNum; }
public void setLoyaltyCardNumber(String loyaltyCardNum) { this.loyaltyCardNum = loyaltyCardNum; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
public String getAddress1() { return address1; }
public void setAddress1(String address1) { this.address1 = address1; }
public String getAddress2() { return address2; }
public void setAddress2(String address2) { this.address2 = address2; }
public String getCity() { return city; }
public void setCity(String city) { this.city = city; }
public String getState() { return state; }
public void setState(String state) { this.state = state; }
public String getZip() { return zip; }
public void setZip(String zip) { this.zip = zip; }
public String getCountry() { return country; }
public void setCountry(String country) { this.country = country; }
public String[] getUserRoles() { return userRoles; }
public void setUserRoles(String[] userRoles) { this.userRoles = userRoles; }
public int getLanguage() { return language; }
public void setLanguage(int language) { this.language = language; }
public String getTelephone() { return telephone; }
public void setTelephone(String telephone) { this.telephone = telephone;}
public String getSecurityQuestion() { return securityQuestion; }
public void setSecurityQuestion(String securityQuestion) { this.securityQuestion = securityQuestion; }
public String getSecurityAnswer() { return securityAnswer; }
public void setSecurityAnswer(String securityAnswer) { this.securityAnswer = securityAnswer; }
public String getVariant() { return variant; }
public void setVariant(String variant) { this.variant = variant; }
public String getNamespace() { return namespace; }
public void setNamespace(String namespace) { this.namespace = namespace; }
public Document toXML()
{ return null;
} // end toXML()
} // end class User VO
package com.afterbot.receiptsplus.user;
import com.afterbot.naming.ABContext;
import com.afterbot.util.Message;
import com.afterbot.util.ABUtil;
import com.afterbot.receiptsplus.user.User;
import com.afterbot.receiptsplus.user.UserBLHome;
import com.afterbot.receiptsplus.user.UserBL;
import com.afterbot.receiptsplus.Constant;
import java.io.IOException;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletException;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
/**
* Performs the controller logic for all user edit/search/load/create.
* @author Michael Lee
*/
public class UserAction extends Action
{
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
ActionErrors errors = new ActionErrors();
String action = mapping.getParameter();
try
{
if(action.equals(Constant.GLOBAL.CREATE_ACTION))
{
User user = ((UserForm)form).toVO();
((UserBLHome)ABContext.getHomeObject(Constant.USER.USER_BL)).create().createUser(user);
}
else if(action.equals(Constant.GLOBAL.EDIT_ACTION))
{
User user = ((UserForm)form).toVO();
((UserBLHome)ABContext.getHomeObject(Constant.USER.USER_BL)).create().updateUser(user);
}
else if(action.equals(Constant.GLOBAL.LOAD_ACTION))
{
User user = ((UserForm)form).toVO();
((UserBLHome)ABContext.getHomeObject(Constant.USER.USER_BL)).create().getUser(user.getUserID());
}
else if(action.equals(Constant.GLOBAL.SEARCH_ACTION))
{
UserSearchCriteria usc = ((UserForm)form).getSearchCriteria();
Users users =((UserBLHome)ABContext.getHomeObject(Constant.USER.USER_BL)).create().getUsers(usc);
if(users != null)
{
System.out.println("111");
request.setAttribute(Constant.USER.USERS, users);
}
else
request.setAttribute(Constant.USER.USERS, null);
}
return mapping.findForward(Constant.GLOBAL.SUCCESS_MAPPING);
} // end try Create/Edit/Load User
catch(CreateUserException ex)
{
switch(ex.getErrorCode())
{
case(CreateUserException.USER_EXISTS):
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(Constant.USER.ERROR_VISIBLE_USER_EXISTS));
saveErrors(request, errors);
return mapping.findForward(mapping.getInput());
case(CreateUserException.NO_USER_ROLE):
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(Constant.USER.ERROR_VISIBLE_NO_USER_ROLE));
saveErrors(request, errors);
return mapping.findForward(mapping.getInput());
case(CreateUserException.NO_LAUNGUAGE):
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(Constant.USER.ERROR_VISIBLE_NO_LANGUAGE));
saveErrors(request, errors);
return mapping.findForward(mapping.getInput());
case(CreateUserException.DUPLICATE_LOYALTY_CARD):
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(Constant.USER.ERROR_VISIBLE_DUPLICATE_LOYALTY_CARD));
saveErrors(request, errors);
return mapping.findForward(mapping.getInput());
default:
Logger.getLogger(UserAction.class).error(ex.getMessage(), ex);
return mapping.findForward(Constant.GLOBAL.SYSTEM_ERROR_MAPPING);
}
} // end CreateUserException
catch(Exception ex)
{
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(Constant.GLOBAL.ERROR_VISIBLE_SYSTEM_ERROR));
saveErrors(request, errors);
Logger.getLogger(UserAction.class).error(ex.getMessage(), ex);
request.setAttribute(Constant.GLOBAL.STACK_TRACE, ABUtil.getStackTrace(ex));
return mapping.findForward(Constant.GLOBAL.SYSTEM_ERROR_MAPPING);
}
} // end perform()
} // end class CreateUserAction
package com.afterbot.receiptsplus.user;
import com.afterbot.receiptsplus.Constant;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
/**
* Contains all the user information for create, edit user.
* @author Michael Lee
* @version 1.0
*/
public class UserForm extends ActionForm
{
private String userID;
private String userType;
private String lname;
private String mname;
private String fname;
private String password;
private String confirmPassword;
private Boolean accountDisabled;
private String loyaltyCardNum;
private String email;
private String address1;
private String address2;
private String city;
private String state;
private String zip;
private String country;
private String userRole;
private Integer language;
private String telephone;
private String securityQuestion;
private String securityAnswer;
private String variant;
private Integer startRow;
private Short listSize;
public String getUserID() { return userID; }
public void setUserID(String userID) { this.userID = userID; }
public String getUserType() { return userType; }
public void setUserType(String userType) { this.userType = userType; }
public String getLname() { return lname; }
public void setLname(String lname) { this.lname = lname; }
public String getMname() { return mname; }
public void setMname(String mname) { this.mname = mname; }
public String getFname() { return fname; }
public void setFname(String fname) { this.fname = fname; }
public String getPassword() { return password; }
public void setPassword(String password) { this.password = password; }
public String getConfirmPassword() { return confirmPassword; }
public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; }
public Boolean getAccountDisabled() { return accountDisabled; }
public void setAccountDisabled(Boolean accountDisabled) { this.accountDisabled = accountDisabled; }
public String getLoyaltyCardNum() { return loyaltyCardNum; }
public void setLoyaltyCardNum(String loyaltyCardNum) { this.loyaltyCardNum = loyaltyCardNum; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
public String getAddress1() { return address1; }
public void setAddress1(String address1) { this.address1 = address1; }
public String getAddress2() { return address2; }
public void setAddress2(String address2) { this.address2 = address2; }
public String getCity() { return city; }
public void setCity(String city) { this.city = city; }
public String getState() { return state; }
public void setState(String state) { this.state = state; }
public String getZip() { return zip; }
public void setZip(String zip) { this.zip = zip; }
public String getCountry() { return country; }
public void setCountry(String country) { this.country = country; }
public String getUserRole() { return userRole; }
public void setUserRole(String userRole) { this.userRole = userRole; }
public Integer getLanguage() { return language; }
public void setLanguage(Integer language) { this.language = language; }
public String getTelephone() { return telephone; }
public void setTelepohone(String telephone) { this.telephone = telephone; }
public String getSecurityQuestion() { return securityQuestion; }
public void setSecurityQuestion(String securityQuestion) { this.securityQuestion = securityQuestion; }
public String getSecurityAnswer() { return securityAnswer; }
public void setSecurityAnswer(String securityAnswer) { this.securityAnswer = securityAnswer; }
public String getVariant() { return variant; }
public void setVariant(String variant) { this.variant = variant; }
public Short getListSize() { return listSize; }
public void setListSize(Short listSize) { this.listSize = listSize; }
public Integer getStartRow() { return startRow; }
public void setStartRow(Integer startRow) { this.startRow = startRow; }
/**
* Validates all User form data.
* @param mapping Where and to info for web
* @param request Web request
* @return List of errors on validate
*/
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
String action = mapping.getParameter();
if(action.equals(Constant.GLOBAL.CREATE_ACTION) || action.equals(Constant.GLOBAL.EDIT_ACTION))
{
if((userID == null) || (userID.length() < 1))
errors.add(Constant.USER.USER_ID, new ActionError(Constant.USER.ERROR_VISIBLE_NO_USERNAME));
if((userRole == null) || (userRole.length() < 1))
errors.add(Constant.USER.USER_ROLES, new ActionError(Constant.USER.ERROR_VISIBLE_NO_USER_ROLE_ENTERED));
if ((password == null) || (password.length() < 1))
{
errors.add(Constant.USER.PASSWORD, new ActionError(Constant.USER.ERROR_VISIBLE_NO_PASSWORD));
}
else
{
if (!confirmPassword.equals(password))
errors.add(Constant.USER.CONFIRM_PASSWORD, new ActionError(Constant.USER.ERROR_VISIBLE_PASSWORD_CONFIRM));
}
}
else if(action.equals(Constant.GLOBAL.LOAD_ACTION))
{
if((userID == null) || (userID.length() < 1))
errors.add(Constant.USER.USER_ID, new ActionError(Constant.USER.ERROR_VISIBLE_NO_USERNAME));
}
else if(action.equals(Constant.GLOBAL.SEARCH_ACTION))
{
}
else
{
mapping.setForward(Constant.GLOBAL.SYSTEM_ERROR_MAPPING);
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(Constant.GLOBAL.ERROR_VISIBLE_SYSTEM_ERROR));
}
return errors;
} // end validate()
public User toVO()
{
User user = new User();
user.setUserID(userID);
user.setPassword(password);
user.setFirstName(fname);
user.setMiddleName(mname);
user.setLastName(lname);
user.setAddress1(address1);
user.setAddress2(address2);
user.setCity(city);
user.setState(state);
user.setZip(zip);
user.setCountry(country);
user.setLanguage(language.intValue());
user.setAccountDisabled(accountDisabled.booleanValue());
user.setEmail(email);
user.setLoyaltyCardNumber(loyaltyCardNum);
user.setSecurityQuestion(securityQuestion);
user.setSecurityAnswer(securityAnswer);
user.setUserType(userType);
user.setTelephone(telephone);
user.setVariant(variant);
String[] userRoles ={userRole};
user.setUserRoles(userRoles);
return user;
} // end toVO
public UserSearchCriteria getSearchCriteria()
{
UserSearchCriteria usc = new UserSearchCriteria();
if((userID != null) && (userID.length() > 1))
usc.setUserID(userID);
if((password != null) && (password.length() > 1))
usc.setPassword(password);
if((fname != null) && (fname.length() > 1))
usc.setFirstName(fname);
if((mname != null) && (mname.length() > 1))
usc.setMiddleName(mname);
if((lname != null) && (lname.length() > 1))
usc.setLastName(lname);
if((userType != null) && (userType.length() > 1))
usc.setUserType(userType);
if(accountDisabled != null)
usc.setAccountDisabled(accountDisabled.booleanValue());
if((loyaltyCardNum != null) && (loyaltyCardNum.length() > 1))
usc.setLoyaltyCardNumber(loyaltyCardNum);
if(language != null)
usc.setLanguage(language.intValue());
if((variant != null) && (variant.length() > 1))
usc.setVariant(variant);
if((email != null) && (email.length() > 1))
usc.setEmail(email);
if((address1 != null) && (address1.length() > 1))
usc.setAddress1(address1);
if((address2 != null) && (address2.length() > 1))
usc.setAddress2(address2);
if((city != null) && (city.length() > 1))
usc.setCity(city);
if((state != null) && (state.length() > 1))
usc.setState(state);
if((zip != null) && (zip.length() > 1))
usc.setZip(zip);
if((country != null) && (country.length() > 1))
usc.setCountry(country);
if((telephone != null) && (telephone.length() > 1))
usc.setTelephone(telephone);
if((securityQuestion != null) && (securityQuestion.length() > 1))
usc.setSecurityQuestion(securityQuestion);
if((securityAnswer != null) && (securityAnswer.length() > 1))
usc.setSecurityAnswer(securityAnswer);
// usc.setStartRow(startRow.intValue());
usc.setStartRow(1);
usc.setListSize(listSize.shortValue());
return usc;
} // end toSearch()
} // end class UserForm
package com.afterbot.receiptsplus.user;
import java.util.ArrayList;
import org.w3c.dom.Document;
/**
* Holds either an XML of users or array of User[] VOs.
* @author Michael Lee
* @version 1.0
*/
public class Users
{
private ArrayList users = new ArrayList();
public Users()
{
}
public void add(User user)
{
users.add(user);
}
public ArrayList getUsers() { return users; }
public Document toXML()
{ return null;
}
public static void main(String[] args)
{
Users users1 = new Users();
}
}
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<!-- ========== Form Bean Definitions =================================== -->
<form-beans>
<form-bean name="userForm"
type="com.afterbot.receiptsplus.user.UserForm"/>
<form-bean name="receiptSearchForm"
type="com.afterbot.receiptsplus.receipt.ReceiptSearchForm"/>
</form-beans>
<!-- ========== Global Forward Definitions ============================== -->
<global-forwards>
<forward name="systemError" path="/system_error.jsp"/>
</global-forwards>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
<action path="/createUser"
type="com.afterbot.receiptsplus.user.UserAction"
name="userForm"
scope="request"
input="/create_user.jsp"
parameter="create"
validate="true">
<forward name="success" path="/main.jsp"/>
</action>
<action path="/loadUser"
type="com.afterbot.receiptsplus.user.UserAction"
name="userForm"
parameter="load"
scope="request"
validate="true">
<forward name="success" path="/view_user.jsp"/>
</action>
<action path="/loadEditUser"
type="com.afterbot.receiptsplus.user.UserAction"
name="userForm"
parameter="load"
scope="request"
validate="true">
<forward name="success" path="/edit_user.jsp"/>
</action>
<action path="/editUser"
type="com.afterbot.receiptsplus.user.UserAction"
name="userForm"
input="/edit_user.jsp"
parameter="edit"
scope="request"
validate="true">
<forward name="success" path="/main.jsp"/>
</action>
<action path="/simpleUserSearch"
type="com.afterbot.receiptsplus.user.UserAction"
name="userForm"
input="/simple_user_search.jsp"
parameter="search"
scope="request"
validate="true">
<forward name="success" path="/simple_user_search.jsp"/>
</action>
<action path="/advancedUserSearch"
type="com.afterbot.receiptsplus.user.UserAction"
name="userForm"
input="/advanced_user_search.jsp"
parameter="search"
scope="request"
validate="true">
<forward name="success" path="/advanced_user_search.jsp"/>
</action>
<action path="/retailerReceiptBasicSearch"
type="com.afterbot.receiptsplus.receipt.ReceiptSearchAction"
name="receiptSearchForm"
scope="request"
input="/retail_receipt_basic_search.jsp"
validate="true">
<forward name="success" path="/retail_receipt_basic_search.jsp"/>
</action>
</action-mappings>
</struts-config>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

