Re: struts help using logic:iterate
Hien, Thank you for replying to my message. I will try this way. Since I'm new on Struts, I thought there would be some other tag other than logic:iterate tag to do the trick. Btw, I'm running weblogic 7.0 sp4. Do you know if it supports JSTL? > > If you make your Item class returns an Error object, you can avoid the > errorCodeList, something like this: > > public class Item { > > private int id=0; > private MyError error; > > /** > * @return Returns the error. > */ > public MyError getError() { > return error; > } > > /** > * @param error The error to set. > */ > public void setError(MyError error) { > this.error = error; > } > > /** > * @return Returns the id. > */ > public int getId() { > return id; > } > > /** > * @param id The id to set. > */ > public void setId(int id) { > this.id = id; > } > > /** > * @param id > */ > public Item(int id) { > super(); > this.id = id; > } > } > > > assume that you have MyError class defined as a JavaBean with two > properties errorCode (int) and errorString (String). > > in your jsp: > <% > > java.util.Collection itemList = new java.util.ArrayList(); > > hqn.Item item1 = new hqn.Item(1); > item1.setError( new hqn.MyError(1, "Error Description 1") ); > > itemList.add( item1 ); > > hqn.Item item2 = new hqn.Item(2); > item2.setError( new hqn.MyError(2, "Error Description 2") ); > > request.setAttribute("itemList", itemList ); > > %> > > Using JSTL forEach tag: > > > Item ID= > Error Code: > Error Desc: > > > Using logic:iterate tag: > > > Item Id= > > Error Code: > Error Desc: > > > I'd recommend you to use JSTL. > > --hqn > > On Jan 5, 2004, at 4:39 PM, ngonqua wrote: > > > I'm very new to struts so please be kindly. > > I have two Arraylist call itemList and errorCodeList. The itemList > > contains list of Item object. The item object has a property calls > > errorCode which returns an error code in int (1-50). I want to > > display the error description associates to that error code. How can > > I pass in the error code to the errorCodeList the get the error > > description. > > > > Item Error Description > > - > > item1description1 > > item2description2 > > item3description1 > > .. > > .. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts help using logic:iterate
If you make your Item class returns an Error object, you can avoid the errorCodeList, something like this: public class Item { private int id=0; private MyError error; /** * @return Returns the error. */ public MyError getError() { return error; } /** * @param error The error to set. */ public void setError(MyError error) { this.error = error; } /** * @return Returns the id. */ public int getId() { return id; } /** * @param id The id to set. */ public void setId(int id) { this.id = id; } /** * @param id */ public Item(int id) { super(); this.id = id; } } assume that you have MyError class defined as a JavaBean with two properties errorCode (int) and errorString (String). in your jsp: <% java.util.Collection itemList = new java.util.ArrayList(); hqn.Item item1 = new hqn.Item(1); item1.setError( new hqn.MyError(1, "Error Description 1") ); itemList.add( item1 ); hqn.Item item2 = new hqn.Item(2); item2.setError( new hqn.MyError(2, "Error Description 2") ); request.setAttribute("itemList", itemList ); %> Using JSTL forEach tag: Item ID= Error Code: Error Desc: Using logic:iterate tag: Item Id= Error Code: Error Desc: I'd recommend you to use JSTL. --hqn On Jan 5, 2004, at 4:39 PM, ngonqua wrote: I'm very new to struts so please be kindly. I have two Arraylist call itemList and errorCodeList. The itemList contains list of Item object. The item object has a property calls errorCode which returns an error code in int (1-50). I want to display the error description associates to that error code. How can I pass in the error code to the errorCodeList the get the error description. Item Error Description - item1description1 item2description2 item3description1 .. ..
struts help using logic:iterate
I'm very new to struts so please be kindly. I have two Arraylist call itemList and errorCodeList. The itemList contains list of Item object. The item object has a property calls errorCode which returns an error code in int (1-50). I want to display the error description associates to that error code. How can I pass in the error code to the errorCodeList the get the error description. Item Error Description - item1description1 item2description2 item3description1 .. ..