Passing Unknown Field in URL
Hi,
How to check the table field which i have given in the Browser URL.
I have a jsp page i want to call another page by passing database condition. Suppose if i give unknown field . i want to get user friendly messgae like "Filed Not Found "
Please give me any solution to this problem.
Here i give the Sample url
-
jspfileName=AHf267d943bc224522fd28a0eca8e1ec25.jsp&ocx=t&condition=eo=100
i tested with unknow field like "eo" instead of "eno"
Now i want to check if the given condtion field is correct or not. and show the user friendly message.
Please help me..
Thanks,
Merlin Rosina
# 1
hi,
so u have no problem in jsp side. Fine.
now receive the value from query string in servlet program,
on that program check the value with database and define th result based on your condition.
for example, in your table
no| Name
105| Java
106| JSP
aa.jsp?no=107
in your servlet,
String no = request.getParameter("no");
int number = Integer.parseInt(no);
PreparedStatement ps ;
ResulSet rs;
String query = "select * from tablename where no = ?";
ps = java.SQl.Connection.DriverManager.getConnection(" "," "," ");
ps.setInt(1,number);
rs = ps.executeQuery(query);
if(rs.first()) {
System.out.println(rs.getString("Name");
}
else {
System.out.println("Field Not Found ");
}
Bala
art84a at 2007-7-12 18:22:23 >
