Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to individually get the data in jsp page

 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to apologize. The guidelines are there to help you get better and quicker answers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic