Hi everyone, I have a question. I m using iterator to loop my jsp

such as code below in my jsp

<%Iterator itr;%>
              <% List data=(List)request.getAttribute("data");%>

I use servlet as my engine to proceed my sql statement.

below is my sql statement

select * from a natural left join b natural left join c natural left join d where dept='Marketing'

and then i use

List dataList = new ArrayList();

and add data from database into my datalist.

weird problem is everytime I post, it gives me blank page but before this I get data with first button.second button failed..may i know y?

Recommended Answers

All 2 Replies

Is there really a need for iterator? You can loop through list as

List<PersonalData> personalDataList = new ArrayList<PersonalData>();
//list populated by "add" or directly from DB results
for(PersonalData personalData : personalDataList){
  personalData.getName();
  personalData.getAddress();
}

As why no data visible on page? Difficult to say since you posted only few lines...

To peter_budo, I have solved my problem.thanks for ur response

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.