Create a JSP Bean instance based upon an ArrayList and set Values -
i'm starting out jsp , need read several .txt files, create html table based upon data read, give user ability edit data , effect edit original .txt file changes.
so how i'm going i'm reading .txt file(s) , creating arraylist (for each file) storing each line .txt file.
now want able create bean instance(?) each .txt file , set values based upon what's inside arraylist. bean.setname(arraylist(0));
however i'm not sure how go initializing beans there's 1 each .txt file.
i appreciate can given, let me know if should post more details or of code i've written far.
edit: shall post in code attempting with.
out.println("<tr>"); arraylist starray = new arraylist(); bufferedreader br = new bufferedreader((new inputstreamreader(ins2))); string data; while((data= br.readline()) != null) { starray.add(data); } <jsp:usebean id="some" class="bean.mrbean">; <jsp:setproperty name="some" property="usnm" value="starray.get(0)">; out.println("<td>"+starray.get(0)+"</td>"); out.println("<td>"+starray.get(1)+"</td>"); out.println("<td>edit</td>"); out.println("</tr>"); }
so it's jsp:usebean...... bits aren't working, that's excerpt of code. problem seems can't intialise bean within jsp, or @ least not within loop?
Comments
Post a Comment