[
https://issues.apache.org/jira/browse/WW-3920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13499645#comment-13499645
]
Greg Huber commented on WW-3920:
--------------------------------
If you check the unit tests, you can see that its not checking the
ScriptingEventsHandler attributes:
ScriptingEventsHandler
{code:java}
a.addIfExists("onclick", params.get("onclick"));
a.addIfExists("ondblclick", params.get("ondblclick"));
a.addIfExists("onmousedown", params.get("onmousedown"));
a.addIfExists("onmouseup", params.get("onmouseup"));
a.addIfExists("onmouseover", params.get("onmouseover"));
a.addIfExists("onmousemove", params.get("onmousemove"));
a.addIfExists("onmouseout", params.get("onmouseout"));
a.addIfExists("onfocus", params.get("onfocus"));
a.addIfExists("onblur", params.get("onblur"));
a.addIfExists("onkeypress", params.get("onkeypress"));
a.addIfExists("onkeydown", params.get("onkeydown"));
a.addIfExists("onkeyup", params.get("onkeyup"));
a.addIfExists("onselect", params.get("onselect"));
a.addIfExists("onchange", params.get("onchange"));
{code}
AnchorTest, not testing for above attributes.
{code:java}
tag.setName("name_");
tag.setDisabled("true");
tag.setTabindex("1");
tag.setId("id_");
tag.setCssClass("class");
tag.setCssStyle("style");
tag.setTitle("title");
tag.setHref("http://sometest.com?ab=10");
{code}
> AnchorHandler does not render onclick() correctly
> -------------------------------------------------
>
> Key: WW-3920
> URL: https://issues.apache.org/jira/browse/WW-3920
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Java Templates
> Affects Versions: 2.3.4.1
> Reporter: Greg Huber
> Priority: Minor
> Attachments: patch.txt
>
>
> The sripting methods are ignored on the <a/> tag.
> It never calls the start on ScriptingEventsHandler so does not add the
> attributes.
> Have checked it with image href links, which is what I think was the reason
> it was done this way.
> {code:java}
> public class AnchorHandler extends AbstractTagHandler implements TagGenerator
> {
> public void generate() throws IOException {
> //all rendering must happend at the end of the tag, so we can support
> nested params
> // Added start
> Map<String, Object> params = context.getParameters();
> Attributes attrs = new Attributes();
> attrs.addIfExists("name", params.get("name"))
> .addIfExists("id", params.get("id"))
> .addIfExists("class", params.get("cssClass"))
> .addIfExists("style", params.get("cssStyle"))
> .addIfExists("href", params.get("href"), false)
> .addIfExists("title", params.get("title"))
> .addIfExists("tabindex", params.get("tabindex"));
> start("a", attrs);
> // added end
> }
> public static class CloseHandler extends AbstractTagHandler implements
> TagGenerator {
> public void generate() throws IOException {
> Map<String, Object> params = context.getParameters();
> // Removed
> /*Attributes attrs = new Attributes();
> attrs.addIfExists("name", params.get("name"))
> .addIfExists("id", params.get("id"))
> .addIfExists("class", params.get("cssClass"))
> .addIfExists("style", params.get("cssStyle"))
> .addIfExists("href", params.get("href"), false)
> .addIfExists("title", params.get("title"))
> .addIfExists("tabindex", params.get("tabindex"));
> start("a", attrs);*/
> // removed
> String body = (String) params.get("body");
> if (StringUtils.isNotEmpty(body))
> characters(body, false);
> end("a");
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira