•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,696 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,174 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 3935 | Replies: 1 | Solved
![]() |
•
•
Join Date: Feb 2007
Posts: 17
Reputation:
Rep Power: 2
Solved Threads: 0
Can anyone help me out ?.......
I have written a code for a form. the first five fileds in the form must be filled automatically by capturing the user id from login page.
I have been able to capture the data and print it on the screen
But, Iam not able to put those values in the textbox
Iam pastin the copy of my code.................
Please help me out ................
Iam getting an exception when i write value=<%=id%> for the text box value . It says id is not declared
<%@ page language="java" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
</HEAD>
<%
String id , name , dept, desig,band;
String username=(String) session.getAttribute("theName");
if(username==null) username="";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin
192.168.150.252:1521:xdevload","xius","xius");
out.println("connection established");
String s ="select emp_id , emp_name ,emp_dept_id, emp_desig_id, band_id from employee_master where emp_id=(select user_id from user_master where user_name='"+username+"')";
Statement stmt = con.createStatement();
ResultSet rs=stmt.executeQuery(s);
out.println("data retrieved");
while(rs.next())
{
id = rs.getString(1);
name=rs.getString(2);
dept=rs.getString(3);
desig=rs.getString(4);
band=rs.getString(5);
out.println(id+" "+name+" "+dept+" "+desig+" "+band);
}
}
catch(Exception e)
{
}
%>
<!--
<BODY>
<center>
<form name="form1">
EMP ID <input type="text" name="text1">
<br>
EMP name <input type="text" name="text2">
<br>
EMP designatiom <input type="text" name="text3">
</form>
</center>
</BODY>-->
</HTML>
I have written a code for a form. the first five fileds in the form must be filled automatically by capturing the user id from login page.
I have been able to capture the data and print it on the screen
But, Iam not able to put those values in the textbox
Iam pastin the copy of my code.................
Please help me out ................
Iam getting an exception when i write value=<%=id%> for the text box value . It says id is not declared
<%@ page language="java" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
</HEAD>
<%
String id , name , dept, desig,band;
String username=(String) session.getAttribute("theName");
if(username==null) username="";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin
192.168.150.252:1521:xdevload","xius","xius");out.println("connection established");
String s ="select emp_id , emp_name ,emp_dept_id, emp_desig_id, band_id from employee_master where emp_id=(select user_id from user_master where user_name='"+username+"')";
Statement stmt = con.createStatement();
ResultSet rs=stmt.executeQuery(s);
out.println("data retrieved");
while(rs.next())
{
id = rs.getString(1);
name=rs.getString(2);
dept=rs.getString(3);
desig=rs.getString(4);
band=rs.getString(5);
out.println(id+" "+name+" "+dept+" "+desig+" "+band);
}
}
catch(Exception e)
{
}
%>
<!--
<BODY>
<center>
<form name="form1">
EMP ID <input type="text" name="text1">
<br>
EMP name <input type="text" name="text2">
<br>
EMP designatiom <input type="text" name="text3">
</form>
</center>
</BODY>-->
</HTML>
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,134
Reputation:
Rep Power: 10
Solved Threads: 257
JSP is very bad choise for setting connection to database you better do it in servlet/front controler
then in JSP just say
then in JSP just say
<textarea rows="10" cols="30"> <%=stringToDisplay%></textarea>
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
access activation api avatar backup blogger blogging blogs breach code combo dani daniweb data data protection database debugging design development dreamweaver dropdownlist gdata google government gpl hacker ibm key linux medicine microsoft module news normalization openbsd product programming reuse rss security serial server source sql survey tags vista web wysiwyg xml
- Will the jsp code will change if we connected to the oracle database ? (JSP)
- jsp code to send values to database (JSP)
- insert values to mysql database (JSP)
- Please help(Problem in insertion data to database) (JSP)
Other Threads in the JSP Forum
- Previous Thread: How Get Date of "First Day of Current Week" in JSP
- Next Thread: Jsp



Linear Mode