Question

I am working on employee leave application where the managers gets to see the there sub-ordinate pending leave request, they can choose to either accept or reject the request.

I am trying to achieve this using display tag, I managed to get the details from DB and display it on jsp.

<disp:table name="pendingLeaveRequest" >
        <disp:column  />  /*Sample display column*/
        <disp:column  />
        <disp:column title="Approve">
            <input type="button" class="btn" value="Approve"
                onclick="approveLeave(this,**Like to pass the row ID**)" />
        </disp:column>
        <disp:column title="Reject"> 
        <input type="button" class="btn" value="Reject"
                onclick="rejectLeave(this, **Like to pass the row ID**)" />
        </disp:column>

My problem is getting the exact row details. I went thro' some articles on display tag in stacckoverflow, but I couldn't find a relevant article to my issue. The display tag http://displaytag.sourceforge.net/1.2/displaytag/tlddoc/index.html, reference article is not clear on using uid details to get row details.

My question is, 1) How to get the row Id and pass it? 2) Using row Id how to get the row details? I am a novice when it comes to using display tag. Any help will be highly appreciated.

Was it helpful?

Solution

<display:table name="pendingLeaveRequest" id="row">
...
<display:column>
   <input type="button" class="btn" value="Approve"
            onclick="approveLeave(this,${row.id})" />
</display:column>

where id as a property of your object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top