Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

struts and property=array

Thread view: 
Scott Phelps - 18 Apr 2005 21:00 GMT
I am a little confused on how to use arrays within an Form object.

If I access the form object like <html:text property="myArray[0]"/> if the
object is null the page doesn't display correctly? Am I access the property
incorrectly? Or do I need to change the getter method? Currently the getter
methods for the arrays just return the arrays themselfs

ie

public String[] getMyArray(){
return myArray;
}
Wendy S - 19 Apr 2005 04:12 GMT
> If I access the form object like <html:text property="myArray[0]"/> if the
> object is null the page doesn't display correctly? Am I access the
[quoted text clipped - 4 lines]
> return myArray;
> }

See if this helps:
  http://struts.apache.org/faqs/indexedprops.html

Since you said you have a problem when the array is null, try making sure
that doesn't happen.  Maybe
  String[] myArray = new String[0];
if you don't have that in the form bean already.

If you're still stuck, post the exact error message you're getting so we
don't have to guess.

Signature

Wendy



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.