I have the following code in my JSP
function doContractAction(actionUrl) {
var strActionUrl = actionUrl;
if(strActionUrl !=null) {
document.forms[0].action = actionUrl;
document.forms[0].submit();
}
return false;
}
<div id="content">
<div id="report">
<s:form name="openControl" id="myActionForm" theme="simple" action="ShowAlertReports" method="post">
<div id="accordion">
<s:iterator id="alertCat" value="alerts" status="status" >
<h2 style="font-size:1.1em; padding-top:0px;padding-left:1px;padding-bottom:-5px; font-weight:bold;">
<p align="left"><s:property value="%{key}"/></p>
</h2>
<br>
<div>
<table id="${status.index}" class="grid one-em-below constant-left-width" cellspacing="0" d="ad-hoc-reports">
<thead class="nosort">
<tr>
<th scope="col" class="sortAsc" onclick="applySort(this);"><a style="cursor:pointer; color: #0066FF; font-weight:bold;">Alert Name </a></th>
<th scope="col" onclick="applySort(this);"><a style="cursor:pointer; color: #0066FF; font-weight:bold;">Customer Name</a></th>
<th scope="col" onclick="applySort(this);"><a style="cursor:pointer; color: #0066FF; font-weight:bold;">Date Opened</a></th>
<th scope="col">Action</th>
</tr>
</thead >
<tbody style="font-size:12px;">
<s:iterator id="alertsubcat" value="%{value}">
<tr>
<td>
<s:property value="name"/>
</td>
<td>
<s:property value="customerName"/>
</td>
<td style="font-size:11px;">
<s:if test="%{display=='OK'}">
<input type="button" value='<s:property value="%{display}" />'
onclick='return closeInfoAlert("<s:property value="%{alertsNotificationId}" />");' />
</s:if>
<s:else>
<input type="button" value='<s:property value="%{display}" />'
onclick='return doContractAction("<s:property value="%{url}" />");' />
</s:else>
</td>
</tr>
</s:iterator>
</tbody>
</table>
<br>
</div>
</s:iterator>
</div>
<s:hidden name="description" id="description" value=""/>
</s:form>
<br>
</div>
</div>
Now <p align="left"><s:property value="%{key}"/></p>
can have values
- Alert1, Alert2 Alert3 and so on
My requirement is from code
<s:else>
<input type="button" value='<s:property value="%{display}" />'
onclick='return doContractAction("<s:property value="%{url}" />");' />
</s:else>
I need to pass the value="%{key} which will be checked in the function doContractAction and I can check the value in key and if it equals Alert1 or Alert 2 . I open a pop-up window
How do I achieve this ?