Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to set a JSF component ID dynamically

843842Aug 20 2006 — edited Aug 21 2006
I have just created a custm tag file:
<%@tag body-content="empty"%>
<%@attribute name="id" required="true"%>
<%@attribute name="logo" required="true"%>
<%@attribute name="name" required="false"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%
String id = (String) jspContext.getAttribute("id");
String logo = (String) jspContext.getAttribute("logo");
String name = (String) jspContext.getAttribute("name");
if (name == null) {
  name = "";
}
%>
<f:subview id="???"> <!-- PLEASE, HELP ME AT THIS LINE -->
  <table border="0" align="center" width="100%">
    <tr>
      <td align="center">
        <img alt="<%=name%>" src="<%=logo%>"/>
      </td>
    </tr>
  </table>  
</f:subview>
I want to set the ID of the subview with the value of the atribute passed from the custom tag with the same name! Is this possible?

Message was edited by:
Ivan_Davidov

Actually I would like later in the lifecycle to find the custom tag using the ID of the <subview>. I would appreciate it if you tell me any other way to do this with or without using the <subview>

Message was edited by:
Ivan_Davidov

null
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 18 2006
Added on Aug 20 2006
3 comments
332 views