1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

assigning the variable to textfeild

Discussion in 'JSP' started by qurratulain, Jan 13, 2007.

  1. qurratulain

    qurratulain New Member

    i trying to update the recin the database .jsp page fetches the data from the databse .and place the data in to the text feild . im trying to genrate the the registration no in the text feild automatically. with code given below but it is not working well,

    i m using the code
    <%@page import="java.sql.*"%>
    	Connection con=DriverManager.getConnection("jdbc:odbc:school-db");
    	Statement stat=con.createStatement();
    	ResultSet rs=stat.executeQuery("SELECT COUNT(SID_GR) from Std-Info");
    				String regno=rs.getString(1);
    				else {
    		String regno="SOE-0001";
    <title>home page of school</title>
    <style type="text/css" media="all">
    <link rel="stylesheet" type="text/css" href="styles.css" media="all" />
    <LINK href="style.css" type=text/css rel=stylesheet>
              <TD class=infoboxcolumn width="15%" height=25>NAME:</TD>
              <TD borderColor=#dddddd width="35%" height=25><INPUT  name="ID"     value=\"<% regno %>\"></TD></tr>//error is here
             <tr> <TD >PASSWORD:</TD>
              <TD ><INPUT  type="password" name="Pass" value="pass"></TD></TR>
    <br/><br/> </html>
  2. pradeep

    pradeep Team Leader

    That's very easy..

    <INPUT  name="ID"  value="<%=regno %>">
    Happy Coding!

Share This Page