How to calculate length of an Arraylist in JSP? -


i passing arraylist in form jsp, need length of array list can add element last position of list.

after getting response flown tried fn:length function jstl library still doesn't seem working.

this trying :

<input name = "access[${fn:length(access)+1}]" type=radio value="s" ${form.access[fn:length(access)+1] == 's'?'checked':''}>summary only<br><br> <input name = "access[${fn:length(access)+1}]" type=radio value="d" ${form.access[fn:length(access)+1] == 'd'?'checked':''}>detail only<br><br> <input name = "access[${fn:length(access)+1}]" type=radio value="b" ${form.access[fn:length(access)+1] == 'b'?'checked':''}>both<br><br> <input name = "access[${fn:length(access)+1}]" type=radio value="n" ${form.access[fn:length(access)+1] == 'n'?'checked':''}>none<br><br> 

access arraylist defined :

arraylist<string> access = new arraylist<string>() 

i passing arraylist through form jsp , want add new element using jsp

you can arraylist this: let assume here arraylist of string called mylist,

list mylist= new arraylist<>();

you can size if arraylist this:

mylist.size();

but arrylist differents arrays. when initialized, length not specified, purpose of arraylist, since can use them without knowing number of element require.

but can add element inside arraylist without knowing lenght

mylist.add("newstring");


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -