commandLink中的RichFaces 3 html标记
我们的应用程序中有一个按钮设置,看起来类似于以下内容:commandLink中的RichFaces 3 html标记,html,jsp,jsf,richfaces,Html,Jsp,Jsf,Richfaces,我们的应用程序中有一个按钮设置,看起来类似于以下内容: <div class="button" onMouseOver="this.className='buttonHover'" onMouseOut="this.className='button'"> <a href="#" onclick="callSomeAjaxSubmit();"><h2>Button Title</h2></a> </div> 呈现
<div class="button" onMouseOver="this.className='buttonHover'" onMouseOut="this.className='button'">
<a href="#" onclick="callSomeAjaxSubmit();"><h2>Button Title</h2></a>
</div>
呈现的HTML不正确,
标记结束于
onclick被正确渲染,链接应该可以工作,但是h2
标记需要进入a
标记中,以便按钮在屏幕上正确渲染
此呈现的HTML不正确
JSF不会以这种方式呈现它。是webbrowser自己以这种方式解释了获得的HTML标记。您很可能在webbrowser的web developer工具集中通过F12查看HTML DOM inspector,而不是直接通过右键单击查看源代码查看原始HTML源代码
至于为什么网络浏览者会这样解读它;有一个类似
的块嵌套在一个类似的块中。webbrowser基本上会被这一点扼住,并将块级元素推到HTMLDOM树中任何内联元素之外
只要交换它们,浏览器就会很高兴
<h2>
<a4j:commandLink value="Button Title" action="#{action.method}" id="buttonId" />
</h2>
谢谢。这就是我所需要的@BalusC
<div class="button" onMouseOver="this.className='buttonHover'" onMouseOut="this.className='button'">
<h2>Button Title</h2>
<a name="myForm:buttonId" id="myForm:buttonId" onClick="A4J.AJAX.Submit........" href="#"></a>
</div>
<h2>
<a4j:commandLink value="Button Title" action="#{action.method}" id="buttonId" />
</h2>