Greetings,
i like to change elements in arrayList into string.
This is how i declare an ArrayList in a Java file
ArrayList listing = new ArrayList();
below is just a simple example of how i insert the string into the arraylist
String concat = "';
concat = concat + "apple";
//Transfer the concat string into arraylist
listing.add(concat);
return listing;
{code}
On my Jsp page, it will receive the ArrayList from the java file. Lets say the Arrayist is pass into my JSP arraylist
This is my JSP arraylist
{code}ArrayList optLists = new ArrayList();{code}
Inside the arraylist element, it holds data eg: *308577;;RS | [CAT 2] Level: Arena, Section: A02* with a pipe between RS and CAT 2.
Now i looping the arraylist
{code}int a = 0;
for ( a=0; a < optLists.size(); a++)
{
String tempString = "";
String splitTemp = "";
String tempString = (String)optLists.get(a);
splitTemp = tempString.split("|");
System.out.println("Split String Results: "+ splitTemp);
{code}}
Heres the error:
*SeatAvailable_jsp.java:560: incompatible types*
*[javac] found : java.lang.String[]*
*[javac] required: java.lang.String*
*[javac] splitTemp = tempString.split("|");*
*[javac]*
What can i do to solve the problem?
Edited by: leeChaolan on May 2, 2008 4:45 AM
Edited by: leeChaolan on May 2, 2008 4:48 AM