Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to control JSF to stop prefix value with UI Component Identifer

 
Saravanan Vijayappan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

This is a snippet from my JSF code

<hutputText id="ItemIdLabel" value="#{content.itemId}"></hutputText>
<h:inputText id="itemId" value="#{dataEntryBean.itemId}" disabled="true"></h:inputText>

When we look at Html source code of the above JSF UI components in browser, they appears as below

<span id="j_id_jsp_1291078540_2:ItemIdLabel">Item ID :</span></td>
<input id="j_id_jsp_1291078540_2:itemId" type="text" name="j_id_jsp_1291078540_2:itemId" value="0" disabled="disabled" />

My problem is, I have given UI components ID for those UI components such as id="ItemIdLabel", id="itemId" in my JSf file..But they come as id="j_id_jsp_1291078540_2:ItemIdLabel" and id="j_id_jsp_1291078540_2:itemId" in view source

I want to stop JSF to prefixing this j_id_jsp_1291078540_2 with user declared component ID because this prefix value seems to be generated at runtime and I am not able to locate these UI components in java script DOM tree while searching by programmer declared UI component ID

Could anyone help me to solve my issue ?

Thanks
Sarav.
 
Raminder Singh
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check by providing each <form> and <subview> tag as unique id name. Idea is to provide each component an id value.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's good practice to use an explicit id attribute on any JSF tag that might throw any sort of error - for exactly the reason you said!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic