简体   繁体   English

如何将锚定系统与 <h:commandLink /> ?

[英]How to use the anchor system with a <h:commandLink />?

Env : IE7 & FireFox3.5, jsf1.2, richfaces3.3.X, seam2.2.0, jboss5.1 环境:IE7和FireFox3.5,jsf1.2,richfaces3.3.X,seam2.2.0,jboss5.1

I have a very long xhtml form, and somewhere in the middle, the user have to fill a dataTable, then click a button (i use here a commandLink) that will post the dataTable, compute things, and validate the data. 我有一个非常长的xhtml表单,在中间的某个地方,用户必须填充一个dataTable,然后单击一个按钮(我在这里使用commandLink),该按钮将发布dataTable,进行计算并验证数据。

Then, the user wants to continue filling his form. 然后,用户希望继续填写他的表格。

Problem : when i submit, the page reload at the top, and i have not a clue on how i could use the anchor system with the commandLink. 问题:当我提交时,页面会在顶部重新加载,并且我不知道如何在CommandLink中使用锚系统。

I can do that with an outputlink, but then i wouldn't be POSTing my data.. 我可以使用outputlink做到这一点,但是那样我就不会发布数据了。

I tried putting my link#anchor in the pageflow (faces-config.xml or pages.xml), i tried the "rel" attribute of the commandLink, but i must have misunderstood what it does. 我尝试将link#anchor放在页面流(faces-config.xml或pages.xml)中,尝试了commandLink的“ rel”属性,但我必须误解了它的作用。

Someone told me about the "autoscroll" feature in myfaces, but i'm not really for adding another taglib just for one feature 有人告诉我myfaces中的“自动滚动”功能,但我并不是真的要为一个功能添加另一个taglib

I hope i was clear enough, and sorry for my poor english 我希望我足够清楚,对我的英语不好也感到抱歉

Thanks :) 谢谢 :)

Use Javascript. 使用Javascript。

window.onload = function() {
    window.location.hash = '#{bean.anchorName}';
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM