variable declared in jsp gives previous values on click in a different jsp, where as the java value is correct

232
January 13, 2017, at 02:18 AM
<s:set name="deletedProductId" value="%{serviceOrder.serviceOrderProducts[#attr.varStatus.index].productLineNumber}"/>
<s:set name="deletedProductId" value='%{serviceOrder.id + ":" + #attr.deletedProductId}'/>

the above line of code is the way the deleted productId is declared in jsp

<a href="serviceOrder!deleteServiceOrderProduct.action?id=<s:property value='%{entity.id}'/>&&deletedProductId=<s:property value='%{#attr.deletedProductId}'/>" onClick="return confirmDeleteProduct()">
    <img src="${imageUrlBuilder.getImageUrl('icon_record-delete.gif')}" alt="<s:text name="serviceOrder.serviceOrderProducts.delete.info"/>" title="<s:text name="serviceOrder.serviceOrderProducts.delete.info"/>"/>
</a>

This is the way in which the confirm deleteproduct is called.

function confirmDeleteProduct() {
    alert('${deletedProductId}');
    alert('${productDeletableOnServiceOrder}');
    <s:if test="%{!productDeletableOnServiceOrder}">
        alert('${serviceOrderHasJob}');
        return false;
    </s:if>
    return confirm('${confirmDeleteProduct}');
}

once the page loads and we are clicking on the delete icon. the alert popup gives null value for deletedProductId(). Is there a way I cannot get the null value and get the current value that I am clicking on?

Any help will be appreciated. Thank you.

READ ALSO
How to get a user uploaded image cenverted to Base64

How to get a user uploaded image cenverted to Base64

I have already made a simple log system where i get the Base64 Code from a text string:

277
Iterate on all elements next to the selector javascript

Iterate on all elements next to the selector javascript

Hi i have a select boxes with same class super-attribute-select in different elements like

368
Get the name of all selected items from select multiple=&ldquo;multiple&rdquo; options dropdown

Get the name of all selected items from select multiple=“multiple” options dropdown

I am trying to get the name of all selected items from select multiple="multiple" options dropdown

269