calling a function in struts tags

Discussions

Web tier: servlets, JSP, Web frameworks: calling a function in struts tags

  1. calling a function in struts tags (1 messages)

    I need to write a javascript code to ask a confirmation on deleting a field. and I need to pass a parameter to that function. can I do this using struts tags?
    I mean:

    function confirmDelete(poetID) {
    ....
    }

    can I use a tag such as:
    <html:link href="javascript:confirmDelete()" name="element" property="poetID" >....</html:link>
    ??
    it seems it's impossible.
  2. How I usually do it[ Go to top ]

    I need to write a javascript code to ask a confirmation on deleting a field. and I need to pass a parameter to that function. can I do this using struts tags?I mean:function confirmDelete(poetID) {....}can I use a tag such as:<html:link href="javascript:confirmDelete()" name="element" property="poetID" >....</html:link>??it seems it's impossible.
    Hi,

    I usually do it this way.

    function confirmDelete(poetID) {
    ....
    }

    <bean:define id="poetID" name="element" property="poetID" />
    <html:link action="/deletePoet" paramName="poetId" paramBean="poetId"
               onclick='<%= "return confirmDelete(" + poetId + ")" %>'>
    ...
    </html:link>

    I hope this help you