views:

75

answers:

2

Does it exist a way to create a <a name="bookmark"> in jsf?

I would like to create a list with general bookmarks so that i can point them with links, i would like to create these links with values I take dynamically. h:outputLink doesn't have a name attribute.

A: 

Use Javascript or Output Filtering or a Custom Component

I think I would just use Javascript and patch up the anchors onload.

However, you could do output filtering. You could wrap the sub components inside your own and parse and modify the output. That does seem like a lot more work than just tweaking the document with JS.

If you are willing to create a custom component using facelets, a true but heavyweight solution, just go over here: How to add a new attribute to an existing JSF component.

DigitalRoss
+1  A: 

Using outputLink like this:

 <h:outputLink id="bookmark" />

generates the html:

<a id="bookmark" href="" name="bookmark"/>

So you could use the ID as your pointer?

ChrisAD