java - jstl/jsp - iterating over a vector of beans -
I have a vector of veins that keeps information, I want to display in my jasp page. I am currently using standard Java expression to display just this, I want to use JSTL to isolate worries. Is it possible, and how? I've been googling, but I can not find anything.
I think what you are looking for & lt; C: foreach> tag.
For example, printing myInt property on examples of MyClass (defined below):
& lt; C: Exotic objects = "$ {vector name}" var = "pos" & gt; & Lt ;! - For each position of the array, print the value of myInt, the method must be present in the getMyInt () pos object. - & gt; & Lt; C: out value = "$ {pos.myInt}" /> & Lt ;! - For each created frequency, print the value of myInt, the method must be present in the respective relayed instant () position object. - & gt; & Lt; C: Out value = "$ {pos.relatedInstance.myInt}" /> & Lt; / C: foreach & gt; After the name of the vector name vector, for example,
after you say that you have a class myClass.
Public class MyClass {Personal MyClass related Instructions; // Some members and methods public int getMyInt () (// return something) Public MyClass getrealatedInstance () {This refund. } List & lt; MyClass & gt; My_vector = getFilledList (); Request.setAttribute ("name of vector", my_vector)
Comments
Post a Comment