Re: struts-tag property in javascript

Dave Newton <[email protected]> Fri, 6 Jun 2025 09:57:41 -0400
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <CADJJoV44g5Wup=Co9S==z0UA19TaW-1_f2mSxv_YqMYv6YrBdQ@mail.gmail.com>
On Fri, Jun 6, 2025 at 09:14 Ute Kaiser <[email protected]> wrote:

> Hi,
> migrating from Struts1 I encounter in a jsp the error "Equal symbol
> expected" at the "onclick" row.
> I think my old quotes do not work any more with Struts2.
>
> Struts1:
> <logic:iterate id="b" name="blabla" scope="request">
>   <input type="button" value="Delete"
>
> onclick="javascript:if(confirmDelete()){document.getElementById('deleteid').value='<bean:write
> name="b" property="id" />';}"/>
>
> Struts2:
> <s:iterator value="blabla">
>   <s:submit type="input" value="Delete"
>
> onclick="javascript:if(confirmDelete()){document.getElementById('deleteid').value='<s:property
> value="id"/>';}"/>
>
> I tried 'id', \"id\", \'id\' &quot;id&quot; but nothing worked out


This would be double-evaluation, JSP doesn’t work like this—tags can’t used
as property values. But you should be able use standard JSP EL iirc.

That said, I’d take the opportunity to clean up JSPs and JS since you’re
rewriting everything anyway and split up the JS and markup if you’re not
also migrating the front end away from JSP.

Dave