473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to search a data in mysqlDB from the input text and display the result in jsp

Help me..
im doing project on autobizz where i need to track the order and display the dept name where it is currently present..

while executing these codes, i found an error saying : After end of ResultSet..
pls help me out.. its urgent..

java prg::
Expand|Select|Wrap|Line Numbers
  1. public class Orderstatus {
  2.     List <Orderstatus> list;
  3.     private int order_no; 
  4.     private String deptName;
  5.     ResultSet rset;
  6.     public int getOrder_No() {
  7.         return order_no;
  8.     }
  9.     public void setOrder_No(int order_no) {
  10.         this.order_no = order_no;
  11.     }
  12.     public String getDeptName(){
  13.         return deptName;
  14.     }
  15.     public void setDeptName(String deptName){
  16.         this.deptName = deptName;
  17.     }
  18.     public String reset(){
  19.         order_no=0;
  20.         return "reset";
  21.     }
  22.     public String mkDeptName() {
  23.         String dn=null;
  24.          try{
  25.              String sql = "select deptName from dept d,tracking t where d.deptID=t.deptID and t.orderNO="+order_no+"";
  26.         System.out.println(" dept : "+sql);
  27.         rset= DBHelper.executeQuery(sql);
  28.         if(rset.next()){
  29.             dn=rset.getString("deptName");}
  30.         //dn=String.valueOf(DBHelper.executeQuery(sql));
  31.         System.out.println("after execution...");
  32.         System.out.println("**  "+rset.getString(1));
  33.         //this.deptName = dn;
  34.         this.deptName=dn;
  35.          }
  36.  
  37.          catch(Exception e){
  38.              System.out.println(e);
  39.          }
  40.         return "success";
  41.     }
  42.  
  43. my JSP::
  44. <h:form>
  45.         <h:panelGrid columns="2">
  46.             <h:outputLabel value="Order No"></h:outputLabel>
  47.             <h:inputText  value="#{orderstatus.order_No}"> <f:validateLength minimum="1" maximum="4"></f:validateLength>
  48.             </h:inputText>
  49.         </h:panelGrid>
  50.         <h:commandButton  id="search" value="Status" action="#{orderstatus.mkDeptName}"></h:commandButton>
  51.         <h:commandButton  id="reset" value="Reset" action="#{orderstatus.reset}"></h:commandButton>
  52.  
  53.     <h:panelGroup >
  54.     <h3> Your Order Status </h3>
  55.     <h:outputLabel value="Status "></h:outputLabel>
  56.     <h:outputLabel id="dept" value="#{orderstatus.deptName}"></h:outputLabel>
  57.  
  58.     </h:panelGroup>
  59. </h:form>

and error::

dept : select deptName from dept d,tracking t where d.deptID=t.deptID and t.orderNO=3321
inside executeQuery :select deptName from dept d,tracking t where d.deptID=t.deptID and t.orderNO=3321
inside executeQuery :
after execution...
java.sql.SQLException: After end of result set
Apr 29 '11 #1
0 1269

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Walter | last post by:
Hi, The user has to type his name into input a input field (type = text). This name must be passed to another ASP file. I did this but nothing happened: <form id=ins method="post"...
4
by: multimatum2 | last post by:
Hello, I need to enable/disable input text forms... But... I need to have the same style (color...) in both modes.. Could you help me ? Thanx a lot A small sample... ...
1
by: Miguel Dias Moura | last post by:
Hello, What I know: To send a Value in the URL and filter the results in order to display only the database records which FIELD_A = Value. What I need to do: I have a page with an Input...
2
by: sympatico | last post by:
hi, pls help me slove this problem. i am a newbie in using asp.net and SQL server 2000 and my problem for now is to pass data to a textfile and i have fail to do so. the way i did it was i used...
3
by: Ali | last post by:
I have 3 html input tex in my asp.net form. Two of them are calling javascript client side to calculate the differnce of two dates and put the result into the third input text. i haven't include...
2
by: magix | last post by:
Hi, I'm using Access Database with ASP. There is one particular thing that I have issue with. My purpose is for user to update their own profile. Their existing profile information will be...
3
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
3
by: jonniethecodeprince | last post by:
Hi all, I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file. There are 50 Records in this file....
2
by: 848lu | last post by:
hi, im trying to search data through an array and then display the macthes found please help #!/usr/bin/php <HTML> <BODY> <? #reads a text file outputs it to screen
3
by: hazahafiz | last post by:
how to solve??? i want to search data for more than 1 criteria in one interface.for example,i want to search location,price and type.then, i want use drop down list for select each criteria and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.