In my user page I am displaying all my user details (getting List of details from database), end of each row we have edit button to edit user details. We have to disable Edit button for current logged-in user, for this I have to check current logged-in user name with in users list, if equals disable edit button.
We have AuthenticationUtil class (this class contains logged-in user details). I am trying to send user name from jsp to java class to check user name is same or not the username in AuthenticationUtil class.
displaying user name
to check logged-in user details
here I am gettign error
Can anyone give me any clue, how to send user name to java class.
Before looking into the compilation error and everything allow me to have my view on this. As per my understanding you are using a loop to display the user details, and for each row you are hitting the database to validate. Now consider the following two scenarios
1. You have 1000 records, and the logged in user detail is at record number 1000. So the loop iterates for 1000 times, hits the db 1000 times.
2. You have 1000 records, and logged in user detail is at record 4, but you still have to iterate till the last record, hits the db 1000 times.
Do you think that you actually need to hit the db those many number of times. Why not rethink a bit? When the user logs in save that in session level variable, and compare with the session level variable. By this you will be able to eliminate number of db hits.