Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assign a defined Id to all the tags in JSF

 
sree javab
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a newbie to JSF and have been trying the below,

I have 10 rows in a JSF page, and 10 rows are of the same tag type, say <tr:image>. I wanted to assign an Id to each image tag in a specified format say,

<tr:image id="image_1" source="/img/icon/delete.png" />
<tr:image id="image_2" source="/img/icon/delete.png" />
<tr:image id="image_3" source="/img/icon/delete.png" />
.
.
.
<tr:image id="image_10" source="/img/icon/delete.png" />

Can some one please help me in this case.
Thanks in advance.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then just do that so?

If you actually have a problem with doing that, then please elaborate about it in detail.
 
sree javab
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<tr:image id="image_1" source="/img/icon/delete.png" />
<tr:image id="image_2" source="/img/icon/delete.png" />
<tr:image id="image_3" source="/img/icon/delete.png" />
.
.
.
<tr:image id="image_10" source="/img/icon/delete.png" />


Firstly I do not know how many rows of <tr:image /> will be there...and I wanted to append image_1,_2,_3...._10....my question is how do I generate that increasing number in JSF, and assign that to 'id' attribute?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, you have only one tr:image component inside some UIData component (a table or so)? Why did you mention that you have more tr:image components? Did you check the HTML output, do you see more <tr:image> elements? No, you just see more <img> elements.

No, that's not possible. Just assign it a fixed ID to it. JSF will prepend the row ID to it automatically.

Why this question? Are you just facing a problem for which you think that fixing the ID is the solution? In the future it will be more helpful if you just elaborate about the actual problem instead of asking how to achieve something of which you think that it is the right solution (which may not be a right solution at all, as you see now).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic