This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes how to individually get the data in jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to individually get the data in jsp page" Watch "how to individually get the data in jsp page" New topic
Author

how to individually get the data in jsp page

shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
hi,
I am badly stuck into this problem.Please look into it and find a solution.
I am using ms-access and jsp.
my database structure is as given below:

----------------------------------------------------------
m_emp_no|from_date|to_date|approver|status|
___________________________________________
1002 | 22/9/2008 | 23/9/2008|1003 |pending
1004 | 29/9/2008 | 30/9/2008|1003 |pending
2044 | 15/9/2008 | 16/9/2008|3076 |pending

------------------------------------------------------
now this is exactly a leave apply scenario where a page is displayed and the user has to fill in the details to apply leave.then the approver has to approve that leaves so even, he should get the details in his account.
for example here 1003 has to approve leaves for 1002 & 1004.i am able to fetch data from database for the particular approver here is the coding:

------------------------------------------------------------
but the problem is that how do i approve leaves individually because when i use the coding given below i am able to approve only the first row data.
i want to approve leaves for everyone but based on m_emp_no.
update.jsp:


please help me out .
thanks in advance.
Sagar Birari
Greenhorn

Joined: Sep 05, 2008
Posts: 11
Use Following prepared statement
ps=con.prepareStatement("update emp_leave_application set status='"+approved+"' where approver='"+username+"' and m_emp_no='"+r.getInt("m_emp_no")+"'");

Regards


Sagar Birari
Development & Technical Blog
shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
hi sagar,
when i changed the code as you suggested it is updating the database related to its first entry i.e when i select approved for 1002 and cancelled for 1004 it is updating both as approved.
i think the values which i am retrieving is a single value ,used in the above code in update.jsp.

because when i use
it gives me only one value else it should give me both the values.so there is problem with retrieving values but i am not able to find it, or else the coding is not proper in the first jsp above.
please find a solution
thanks in adavance.
shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
hi sagar,
when i changed the code as you suggested it is updating the database related to its first entry i.e when i select approved for 1002 and cancelled for 1004 it is updating both as approved.
i think the values which i am retrieving is a single value ,used in the above code in update.jsp.

because when i use
it gives me only one value else it should give me both the values.so there is problem with retrieving values but i am not able to find it, or else the coding is not proper in the first jsp above.
please find a solution
thanks in adavance.
shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
hello,
please anyone help me out of this problem.I have to get this done as soon as possible.
thanks in advance.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

It is not good to have that much Java code in your JSP,consider using model classes.
approved for 1002 and cancelled for 1004 it is updating both as approved.

Maybe you need to modify your update query or you need two of them.
Moreover I dont see this as a JSP problem, maybe one of the moderators put it in its right place.


SCJP, SCWCD.
|Asking Good Questions|
shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
hi amit,
but i dont understand one thing as i have stated above that when i retrieve the values from the database in the jsp page i get all the rows but when i retrieve the values from the page using

why does it give me only one value or is it that i have not placed te list box properly .is there any other way to get all the values from the page.
please suggest me.
thanks in adavance.
shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
Is there no one to help me out .
As amit stated that there is a problem with the update statement it might be true but unless and until we get the values how can we get the exact result using proper update statement also because as i said i am getting only one value from the code when i try to get values from the jsp page.

if any problem please refer the first coding and help me out with some suggestion as to how to get all the values.
please its very urgent.
thanks in advance.
shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
hello everyone,
I am asking for help from when and no body is responding to me .
there is no one in this forum who could help me out.
atleast just guide me what has to be done.
its very urgent .there are hardly any days left out.
please guys help
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60748
    
  65

No one here is obligated to help you. Being petulant will just tick people off and your posts will just end up being ignored.

Please read this and please read this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
shiju nair
Ranch Hand

Joined: Jul 18, 2008
Posts: 45
hi bear,
sorry i was just in a hurry to get things done.i will wait till the ranchers find a solution and by the mean time ,even i am trying from my side to get the solution.
thank you
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60748
    
  65

No need to apologize. The guidelines are there to help you get better and quicker answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to individually get the data in jsp page
 
Similar Threads
Client side validation problem
jsp:include and c:import combination/nesting
Why this problem???
Make rows not appear when certain row value appears
inserting data to a table