I only wanted to print the value in the string variable fname but somehow am not able to use the jsp tags effectively.
<%@page language="java" import="java.util.*" %> <% Cookie[] c= request.getCookies(); if(c==null) { response.sendRedirect("index.jsp"); } else { for (int i=0; i<c.length; i++) { if(c[i].getName().equals("Cuname")) { try{ Connection con=null; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:SQL","sa","mith1234"); String select="select * from sign_up where u_name=\'"+c[i].getValue()+"\'"; PreparedStatement ps= con.prepareStatement(select); ResultSet rs= ps.executeQuery(); if (rs.next()== true) { String fname= rs.getString(1); out.println(fname); } } catch(Exception e) { out.println(e); } } } } %>
Now here i want to print the fname i.e. string
HTML Code:<tr><th> you name: <%fname%> </th></tr>
Some problem with the tag i am using i suppose.... Help me