This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes How to control JSF to stop prefix value with UI Component Identifer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to control JSF to stop prefix value with UI Component Identifer" Watch "How to control JSF to stop prefix value with UI Component Identifer" New topic
Author

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

Saravanan Vijayappan
Ranch Hand

Joined: Jan 02, 2007
Posts: 47
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.


Cheers,<br />Sarav
Raminder Singh
Ranch Hand

Joined: Mar 01, 2002
Posts: 72
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

Joined: Jun 25, 2001
Posts: 17161
    
  27

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!


An IDE is no substitute for an Intelligent Developer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to control JSF to stop prefix value with UI Component Identifer
 
It's not a secret anymore!