I am display开发者_StackOverflow中文版ing the images here..they are arranging in vertical way by generating
dynamically...But i want it in horizontal pattern...how can i do this? for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
// System.out.println("File " + listOfFiles[i].getName());
String finalImage="Images/"+listOfFiles[i].getName();
out.print("<img src='"+finalImage+"' width='200' height='200'/>");
//out.println(finalImage);
}
}
try putting them in their own div instead:
for (...) { out.print("<div style=\"float:left;\">"); out.print("<img ..."); out.print("</div>"); }
and when the images are finished, clear the float:
out.print("<div style=\"clear:both;\"/>");
much better to do all that with an MVC framework though, if you're using JSP, like Spring and taglibs rather than raw output
精彩评论