0

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

<tr><th> you name: <%fname%> </th></tr>

Some problem with the tag i am using i suppose.... Help me

Edited by mith_cool: n/a

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by masijade
0

Thanks for your kind help friend.... but if you can just provide me the link of the particular topic am looking for....

0

no I didnt get what you are trying to say??? if u can just tell me what is wrong with the tags am using and probably fix it..... thanks

0

What tags? You are not using any tags. You are using alot of scriptlets, of which you should not be using any. And, when someone is going in the completely wrong direction all you can do is turn them around, so go read that tutorial.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.