This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have a HTML table that displays employeeID, FirstName and LastName only. I made the employeeID field in each row as document link to a URL so that when the employeeID field was click, it will forward the browser to a next JSP that will completely display the Person Information (e.g. Age, Birthday etc..)
Is there a way that I could retrieve what row was click in an HTML table so that I could use the details of the row and use it as an attribute in my JSP.
The param="myTable" refers to the table name. It could have been easier if I let the user enter the employeeID in a text box and use the param attribute="textboxname".
I dont know if i'm doing things right. Please help. I am trying to learn JSP thru web tutorials. Thanks
Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
Yes, you can very well do it. You can append the employeeId to the request scope before submitting in the first page and retrieve the same in the next jsp where you forwarded.
Make use of this retrieved employeeId to fetch the other details of the employee and display it.
Thanks for replying. A fragment of my code looks like the one below. I hard code my name inside it but I usually got the data from my Employees Table and store it in an arraylist then scan the list to display it to my table row.
I'm having a problem submitting to my url "/showUserData.do" on how I could get a reference on the click row and save the click employee id.
I just would like to ask on how I could store the attribute employeeID in the request scope before submitting to my next JSP so that I could use it.
Please pardon me, if my question might be too simple.
[BSouther: Added UBB CODE tags] [ July 11, 2007: Message edited by: Ben Souther ]
You don't want to try to be reading the information from the HTML table after the fact. That would require a tremendous amount of fragile JavaScript. Rather, when you are constructing the page in your JSP, add a parameter to the the link of your <a> tag that identifies the row when the link is clicked.
I'm having a problem submitting to my url "/showUserData.do" on how I could get a reference on the click row and save the click employee id.
I just would like to ask on how I could store the attribute employeeID in the request scope before submitting to my next JSP so that I could use it. ...
Hi Mark
Along with what Bear said, how do you get "Mark Reyes" into the table? I think you said you hard code, but I may have misunderstood you. Could you post that code?
Thanks, Brad
[ July 10, 2007: Message edited by: Brad Smiths ]
[ July 10, 2007: Message edited by: Brad Smiths ] [ July 10, 2007: Message edited by: Brad Smiths ]
Jason Kwok
Ranch Hand
Joined: Mar 31, 2005
Posts: 126
posted
0
Hi Mark,
Referring to what Bear had said, you would do something like this:
This will send a parameter called employeeID along with the request, which can then be retrieved by your Servlet to find your employee account information.
Mark Reyes
Ranch Hand
Joined: Jul 09, 2007
Posts: 426
posted
0
Hi Sir Jason,
Thank you very much for the code that you had given. I finally got things going in my code and it now displays the complete employee information when i click the link.
In the JSP that I will be forwarding this request. I just extracted the added parameter ID.
For a while I was thinking of letting javascript handle the clicking action but as pointed out by Sir Bear it might take so much of an overhead. I'm happy to have learned this stuff.
Again, thanks to everyone that responded in my post. [ July 10, 2007: Message edited by: Bear Bibeault ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.