LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Java JSP/Servlet > Displaying images four by four

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-17-2009, 04:28 AM
peggie1990 peggie1990 is offline
New Member
 
Join Date: Jul 2009
Posts: 9
Default Displaying images four by four

Hey guys do you know how to display images four by four. I try to edit in my code. But fail and ends up the images is a long row. Can you guys help me check what's the problem?

Thanks

Code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"  
    pageEncoding="ISO-8859-1"%>   
    <%@ page import="java.sql.*"%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">   
<html>   
<head>   
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">   
<title>Display Image overall</title>   
</head>   
<body>   
<h1>Products</h1>   
    
  
<p>   
          <%   
            //1. Retrieve all products from database   
               
            //1a.  Load the Driver   
            Class.forName("com.mysql.jdbc.Driver");   
            //1b.  Get a connection to the database   
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost/lilian_morton", "root", "");   
            //1c. Construct our SQL statement   
            PreparedStatement ps = con.prepareStatement("SELECT * FROM products");   
            //1d.  Execute and retrieve our result   
            ResultSet rs = ps.executeQuery();   
               
            //2. Base on the results returned, construct a table   
        %>   
        </p>   
        <fieldset height="145" width="145">   
<legend>Product</legend>   
        <table border="0">    
         <%     
            
if(rs.next()) {        
rs.beforeFirst();  // for making sure you dont miss the first record.      
while(rs.next())      
{                        // opening while loop brackets.      
     
         %>        
       
      
    
 <td>   
        <div style=""><img border="3"  
            src="images/Beanie/<%=rs.getString("ProdImage") %>" height="145" width="145" /></div>   
               
               
            <a href="ProductDesc.jsp?ProductId=<%=rs.getString("ProductId")%>"><%=rs.getString("ProdName")%></a>   
        </td>   
           
           
         <%        
                } //closing while loop bracket      
             }        
             else {        
                 //if no record is found, simply display a no record message        
         %>        
 Nothing.        
 <%        
             }        
          %>     
             
           </table>    
           </fieldset>    
  
  
</body>   
</html>
Thanks
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:34 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.