Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Sals Hamid

Greenhorn
+ Follow
since Jan 04, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sals Hamid

i recommended "The Unified Modelling Language User Guide" by Grady Booch,James Rumbaugh and Ivar jacobson. I think this is the good first starter book. I also start from this book.
can u tell me that syntax of insert into is right or wrong
Here is the error
javax.servlet.ServletException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
My problem is still not solved???
Here is the code:

jsp error: internal servlet error. Syntax error in insert into
I check this code and other code many time but i found no problem but there is problem.Plz help
[ Edited by Dave to add code tags and fix UBB smilies ]
[ February 10, 2002: Message edited by: David O'Meara ]
I write jdbc code in jsp file and it work fine but when i use prepared statements it creates problem.Here is the code:<%@ page language ="java" import="java.sql.*"%>
<%!

int id;
Connection conn=null;
PreparedStatement pstm=null;
ResultSet rs=null;
%>
<table border ="1">
<tr>
<td>ID</td>
<td>Name</td>
<td>Address</td>
<td>E-Mail</td>
<td>Contact</td>
</tr>
<%
try
{
String idd= request.getParameter("id");

id=Integer.parseInt(idd);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc dbc:222");
PreparedStatement pstm=conn.PrepareStatement("Select * from directory where id =?");
pstm.setInt(1,id);
rs=pstm.executeQuery();
while(rs.next())
{
%>
<tr>
<td><%=rs.getInt("id")%></td>
<td><%=rs.getString("Name")%></td>
<td><%=rs.getString("Address")%></td>
<td><%=rs.getString("E-Mail")%></td>
<td><%=rs.getString("Contact")%></td>
</tr>
<%
}
}catch(Exception e){
e.printStackTrace();
}
%>

Whats the problem?
By using sessions u can handle this problem e.g.
u create html file for login. There is 2 text boxes in it one is for user name and other for password,there names are id and p.
In jsp file in scriplets tag
<% id = request.getParameter("id");
pass=request.getParameter("p");
if((id.equals("salman"))&&(pass.equals("salman12")))
{session.putvalue("usr",id);
In this way u can solve ur problem
I am doing jdbc connectivity. I simply put the code of jdbc and place in java bean file,but when i run it from browser the data which we acces e.g if we press some link its detail not show on browser but detail is on server.
18 years ago
JSP
Using Get I think we only send 250 characters to server side at a time
18 years ago
JSP
By using if condition u can do this e.g.
if(session.getValue("usr")==null)
<jsp:forward page ="login.html"/>
18 years ago
JSP
Do u set paths for tomcat, if yes then write the following code
<%@ page language ="java" %>
<% out.println("Hello World"); %>
save it in Root in your folder.
try to open.
first check ur paths are right
18 years ago
Hi!
I just started UMl and now i am designing VideoRentalSystem. I think we both work together to gain experience.
Why we use jsp beans. What is the main purpose of using it.
18 years ago
JSP
import java.sql.*;
class MyFirstDB
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Load Drivers

Connection con=DriverManager.getConnection("jdbc dbc:xyz");//Open connection
Statement stm=con.createStatement();
//To keep records we have another interface ResultSet
ResultSet rs = stm.executeQuery("select * from product");
while(rs.next())// next is method of ResultSet
System.out.println(rs.getString("productID")+""+rs.getString("productName")+""+rs.getString("price"));
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
18 years ago
JSP
import java.sql.*;
class MyFirstDB
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Load Drivers

Connection con=DriverManager.getConnection("jdbc dbc:xyz");//Open connection
Statement stm=con.createStatement();
//To keep records we have another interface ResultSet
ResultSet rs = stm.executeQuery("select * from product");
while(rs.next())// next is method of ResultSet
System.out.println(rs.getString("productID")+""+rs.getString("productName")+""+rs.getString("price"));
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
18 years ago
JSP