Dear my friends,

I really need your help to work out JSP function in my website.

In navigation section, I want jsp code which can show all information relevant to a navigation button customer click on:

Eg: I have navigation called laptop. After clicking on laptop navigation, customer will see all information containing word “laptop” in my database.

Below is my code, the highlighted line is wrong , please , help me to fix it:

<%@ page contentType="text/html; charset=iso-8859-1" language="java"  import="java.util.*,java.sql.*" errorPage="" %>
<%@ include file ="connection.jsp" %>
<%
  PreparedStatement statement  = con.prepareStatement("select * from product where proName = '%"+ “laptop+"%' ");
  ResultSet resultSet = statement.executeQuery(); 
%>
<html>
<head>
<title>Laptop  </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<BODY BGCOLOR=#FFFFFF>

<TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
	  <TD width="750" align="left" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="750" height="129">
          <param name="movie" value="Flash/hugo61.swf">
          <param name="quality" value="high">
          <embed src="Flash/hugo61.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="750" height="129"></embed>
      </object></TD>
		<TD width="100%" background="images/tal_1.jpg" style="background-repeat:repeat-x; background-position:bottom ">&nbsp;</TD>
	</TR>
	<TR>
		<TD width="6750" align="left" valign="top"><table width="750" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="157" align="left" valign="top" background="images/line_1.jpg" style="background-repeat:no-repeat; background-position:bottom right "><table width="157" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" valign="top"><div style="padding-left:17px; padding-top:7px; padding-bottom:0px"><img src="images/boo.jpg" width="35" height="32"><img src="images/cat.jpg" style="margin-bottom:9px;margin-left:10px "><span class="style10">Products</span></div></td>
              </tr>
              <tr>
                <td align="left" valign="top"><div style="padding-left:16px; padding-top:26px; padding-bottom:0px">
                  <table width="127" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td height="18" align="left" valign="middle" background="images/rep_1.jpg" style="background-repeat:repeat-x; background-position:bottom "><div style="padding-left:6px; padding-top:0px; padding-bottom:0px"><img src="images/point_1.jpg" width="8" height="7"> <a href="computer.html" class="style1" style="text-decoration:none ">Computer</a></div></td>
                    </tr>
                    
                    <tr>
                      <td height="18" align="left" valign="middle" background="images/rep_1.jpg" style="background-repeat:repeat-x; background-position:bottom "><div style="padding-left:6px; padding-top:0px; padding-bottom:0px"><img src="images/point_1.jpg" width="8" height="7"> <a href="monitor.jsp" class="style1" style="text-decoration:none ">Monitor</a></div></td>
                    </tr>
                    
                    <tr>
                      <td height="18" align="left" valign="middle" background="images/rep_1.jpg" style="background-repeat:repeat-x; background-position:bottom "><div style="padding-left:6px; padding-top:0px; padding-bottom:0px"><img src="images/point_1.jpg" width="8" height="7"> <a href="acc.jsp" class="style1" style="text-decoration:none ">Accessories</a></div></td>
                    </tr>
                    <tr>
                      <td height="18" align="left" valign="middle" background="images/rep_1.jpg" style="background-repeat:repeat-x; background-position:bottom "><div style="padding-left:6px; padding-top:0px; padding-bottom:0px"><img src="images/point_1.jpg" width="8" height="7"> <a href="networking.jsp" class="style1" style="text-decoration:none ">Networking</a></div></td>
                    </tr>
                    <tr>
                      <td height="18" align="left" valign="middle" background="images/rep_1.jpg" style="background-repeat:repeat-x; background-position:bottom "><div style="padding-left:6px; padding-top:0px; padding-bottom:0px"><img src="images/point_1.jpg" width="8" height="7"> <a href="speaker.jsp" class="style1" style="text-decoration:none ">Home cinema Speaker</a></div></td>
                    </tr>                   
                    <tr>
                      <td height="18" align="left" valign="middle" background="images/rep_1.jpg" style="background-repeat:repeat-x; background-position:bottom "><div style="padding-left:6px; padding-top:0px; padding-bottom:0px"><img src="images/point_1.jpg" width="8" height="7"> <a href="printer.jsp" class="style1" style="text-decoration:none ">Scanner & printers</a></div></td>
                    </tr>
                  </table>
                </div></td>
              </tr>
              <tr>
                <td align="left" valign="top"><div style="padding-left:14px; padding-top:11px; padding-bottom:0px">
                  <table width="138" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td height="1" align="left" valign="top" bgcolor="#8DA0BA"><img src="images/spacer.gif" width="1" height="1"></td>
                    </tr>
                    
                    <tr>
                      <td height="18" align="left" valign="top"><div style="padding-left:8px; padding-top:0px; padding-bottom:0px"><img src="images/point_1.jpg" width="8" height="7"> <a href="admin.html" class="style1" style="text-decoration:none "><strong>Admin Entrance</strong></a></div></td>
                    </tr>
                    <tr>
                    <td align="left" valign="top" background="images/bacK_2.gif" style="background-repeat:no-repeat; background-position:bottom right "><div style="padding-left:14px; padding-top:5px; padding-bottom:0px"><span class="style2">SEARCH</span><img src="images/lup.gif"><br>
                      <form action="search.jsp" name="search" method="get">
                         <input type="text" name="search" value="by keyword">
                         <input type="submit" value="Go"><br>
                 </form></td>
             </tr>
                  </table>
                </div></td>
              </tr>
            </table></td>
  <!--end navigation of left body-->
 <!--navigation for central body--->
            <td width="385" align="left" valign="top" background="images/pix_1.gif" style="background-repeat: repeat-y; background-position:left ">
          <center> (<a href="index.html"> Home </a>)( <a href="service.html">Service</a>)(<a href="partner.html">Brand Name</a>)</center>  
            
            <table width="385" border="0" cellpadding="0" cellspacing="0" background="images/rep_2.jpg" style="background-repeat:repeat-x; background-position:top ">
              <tr>
            <br><table border="1">
      <tr>
	       <td>ID</td>
		   <td>Product Name</td>
                    <td>Price</td>
                    <td>Image</td>
		   
	    </tr>
  <% while (resultSet.next()) {  %>
		<tr>
	       <td><%= resultSet.getInt("proID")%></td>
		   <td><%= resultSet.getString("proName")%></td>
                    <td>$<%= resultSet.getInt("price")%></td>
                    <td><img src="img/<%= resultSet.getString("image")%>"></td>
		   
	     </tr>
	<%}%></table>
               </tr>
                   
     <% con.close();%>                
                    
                                       
                
                
             
            </table></td>
            <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" valign="top"><div style="padding-left:0px; padding-top:2px; padding-bottom:0px">
 <!--right body -->
 <!--login-->
 <form action="login.jsp" method="get">
                  <table width="202" height="129" border="1" cellpadding="0" cellspacing="0" bordercolor="#A5A5A5" style="border:1px ">
                    <tr>
                      <td align="left" valign="top" bgcolor="#E8E8E8"><div style="padding-left:8px; padding-top:3px; padding-bottom:0px"><img src="images/key.gif" width="42" height="45">Customer Gate<img src="images/cus.jpg" style="margin-left:3;margin-bottom:24 "><br>
                      
                              <input type="text" name="username" style="width:128px; height:16px; font-family:tahoma; font-size:10px " value="user name">
                              <br>
                              <input name="password" type="password" value="password" style="width:128px; height:16px; font-family:tahoma; font-size:10px ">
                              <input type="submit" name="submit" value="GO">
                              <br>
                              <a href="security.jsp" class="style3">forgot password?</a> <span class="style3">|</span> <a href="register.html" class="style3">register</a></div></td>
                           
                    </tr>
                  </table>
                  </form>
                </div></td>
              </tr>
 <!--end login-->
 
              
              
              <tr>
                <td align="left" valign="top"><div style="padding-left:0px; padding-top:2px; padding-bottom:0px">
                  <table width="202" height="129" border="1" cellpadding="0" cellspacing="0" bordercolor="#A5A5A5" style="border:1px ">
                    <tr>
                      <td align="left" valign="top" bgcolor="#E8E8E8"><div style="padding-left:8px; padding-top:3px; padding-bottom:0px"><img src="images/boo_2.gif" width="30" height="31">TOP SELLING<img src="images/shop.jpg" style="margin-bottom:7px;margin-left:10px ">
                        <div style="padding-left:5px; padding-top:5px; padding-bottom:0px">
                        
<!-- JAVA SCRIPT FOR TOP SELLING -->                    
                        
			<script language="JavaScript1.2">

var variableslide=new Array()

//variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]

variableslide[0]=['img/DellInsprisonLaptop1.jpg', 'laptop.jsp', 'Dell Insprison T1400 Laptop --- $800']
variableslide[1]=['img/hpallinone.jpg', 'printer.jsp', 'HP Photosmart All in One --- $80']
variableslide[2]=['img/HPTouchsmartIQ790PC.jpg', 'pc.jsp', 'HP Touchsmart IQ790 PC --- $2000']

//configure the below 3 variables to set the dimension/background color of the slideshow

var slidewidth='130px' //set to width of LARGEST image in your slideshow
var slideheight='140px' //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#F3F3F3'

//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000

////Do not edit pass this line////////////////

var ie=document.all
var dom=document.getElementById

for (i=0;i<variableslide.length;i++){
var cacheimage=new Image()
cacheimage.src=variableslide[i][0]
}

var currentslide=0

function rotateimages(){
contentcontainer='<center>'
if (variableslide[currentslide][1]!="")
contentcontainer+='<a href="'+variableslide[currentslide][1]+'">'
contentcontainer+='<img src="'+variableslide[currentslide][0]+'" border="0" vspace="3">'
if (variableslide[currentslide][1]!="")
contentcontainer+='</a>'
contentcontainer+='</center>'
if (variableslide[currentslide][2]!="")
contentcontainer+=variableslide[currentslide][2]

if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotateimages()",slidedelay)
}

if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')

function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotateimages()
}

if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider

</script>

<!-- END TOP SELLING -->
                         
                      </div></td>
                    </tr>
                  </table>
                </div></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td colspan="3" align="left" valign="top"><table width="750" border="0" cellspacing="0" cellpadding="0">
              <tr align="left" valign="top">
                <td width="542"><div style="padding-left:9px; padding-top:3px; padding-bottom:2px">
                  <table width="531" border="0" cellpadding="0" cellspacing="0" background="../images/line_tot.gif">
                    <tr>
                      <td align="left" valign="top" background="images/pix_1.gif" style="background-repeat:repeat-x; background-position:top "><table width="531" border="0" cellspacing="0" cellpadding="0">
                        <tr align="left" valign="top">
                          <td width="14"><img src="images/top_2.gif" width="14" height="14"></td>
                          <td><div style="padding-left:15px; padding-top:2px; padding-bottom:0px">                      <span class="style4"><img src="images/point_2.gif" width="15" height="16" vspace="2" align="texttop"><a href="index.html" >Home </a> </span>
                            <img src="images/point_2.gif" width="15" height="16" vspace="2" align="texttop"><a href="service.html">Servive </a></span>
                            <img src="images/point_2.gif" width="15" height="16" vspace="2" align="texttop"><a href="Contact.html"> Contact </a></span>
                            </span><div style="padding-left:5px; padding-top:3px; padding-bottom:0px"> <a href="service.html" class="style3" style="text-decoration:none "><strong>24/7 live chat support</strong></a><img src="images/point_3.gif" width="15" height="16" vspace="2" align="texttop">
                           </div>
                          </div></td>
                          <td><div style="padding-left:8px; padding-top:9px; padding-bottom:9px">
                            <table width="172" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                               <td align="left" valign="top"> <center> Type of payment </center></td>
                              </tr>
                              <tr>
                                <td colspan="3" align="left" valign="top"><table width="172" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td><img src="images/pay_pal.gif" width="69" height="25" border="0"></td>
                                      <td><img src="images/visa.gif" width="35" height="25" border="0"></td>
                                      <td><img src="images/master.gif" width="35" height="25" border="0"></td>
                                      <td><img src="images/some.gif" width="33" height="25" border="0"></td>
                                    </tr>
                                </table></td>
                              </tr>
                            </table>
                            </div></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td align="left" valign="top" bgcolor="#A5A5A5"><img src="images/spacer.gif" width="1" height="1"></td>
                    </tr>
                  </table>
                </div></td>
                <td><div style="padding-left:4px; padding-top:2px; padding-bottom:3px">
                  <table width="202" height="90" border="1" cellpadding="0" cellspacing="0" bordercolor="#A5A5A5" style="border:1px ">
                    <tr>
                      <td align="left" valign="top" bgcolor="#E8E8E8"><div style="padding-left:8px; padding-top:3px; padding-bottom:0px"><img src="images/letter.gif" width="36" height="29"> <a href="contact.html" > CONTACT </a>
                
							  </div></td>
                    </tr>
                  </table>
                </div></td>
              </tr>
            </table></td>
          </tr>

        </table></td>
	

	<TR>
		<TD width="750" height="100%" align="left" valign="top" background="images/bottom_1.gif" style="background-repeat:no-repeat; background-position:top; color: #1c4176; font-size: 11px; font-family: tahoma;"><div align="center" style="padding-top:10px ">Desgined by Hung Vu Pham.</span> </td>    
	</TR>
    
    <tr>
    	<TD width="750" height="100%" align="left" valign="top" style="background-repeat:no-repeat; background-position:top; color: #1c4176; font-size: 11px; font-family: tahoma;"><div align="center" style="padding-top:10px ">hungvupham.99k.org © 2008</span></td>
        </tr>
</TABLE>

</BODY>
</html>

thanks a lot

no, we're not going to help you with such rubbish.
Scriptlets are NOT to be used.
Database access from JSPs is NOT to be used.
Code tags MUST be used.

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.