I have a Struts application that has a .jsp page that has a table on it that displays rows from a database table. In each row displayed there is a button entitled "Delete". When the "Delete" button is clicked I want to pass the DefectID of the particular row to my Action Class. I don't know how to do this. Can someone tell me how to accomplish this?
The code is shown below.
Yes, should be simple . . . but when you are first learning everything can be a bit . . . shall we say . . . "painful" . . . LOL
At any rate, seems to me the simplest way would be to append the defectId to the URL . . . something like this:
Naming an individual defect "myCollection" is a bit misleading--if I saw a variable called "myCollection" I'd assume it was... a collection. And I already knew it was "mine". How about naming the collection "defects" and having each defect be named "defect"?
Using scriptlets is considered a relatively poor practice, and has been for some time. Particularly since EL is available via a JSP 2.0 container, and the Struts EL-enabled tags for containers that don't support JSP 2.0 (woe be unto you if you're using a container that old). And there's a form of the <html:link> tag that will create a link with a single parameter.