facebook

CommandLink defined in a html table not rendered in it!

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #237349 Reply

    Robin zou
    Member

    Hi,this is a piece of the jsf code that not rendered properly:

    <TABLE align="center" border="1" width="100%">
        <TR>
            <TD>
               <H2 align="center">Movie Center</H2>
            </TD>
        </TR>
        <TR>
            <TD align="left">
            <h:commandLink value="#{bundle.searchLink}"
                rendered="true" action="#{MovieCenter.search}" id="searchLink">
            </h:commandLink>
            </TD>
        </TR>
    </TABLE>
    <HR>

    And this is the actual html code of the rendered page:

    <TABLE align="center" border="1" width="100%">
        <TR>
            <TD>
               <H2 align="center">Movie Center</H2>
            </TD>
        </TR>
        <TR>
            <TD align="left">
            
            
            </TD>
        </TR>
    </TABLE>
    <HR>

    I want to use table to put the components in the right place,maybe i should use dataTable JSF tag to show it properly, but why the method above doesn’t work?
    Best Regards:)

    Robin

    #237382 Reply

    Riyad Kalla
    Member

    Robin,
    Command link doesn’t render text, you need to wrap it around the text you want to render in this fashion:

    
     <h:commandLink id="NAmerica" action="bookstore" 
      actionListener="#{localeBean.chooseLocaleFromLink}"> 
      <h:outputText value="#{bundle.English}" />
    </h:commandLink> 
    
    
    #237471 Reply

    Robin zou
    Member

    Thanks,but that doesn’t help.
    The two pieces of code:

    <h:commandLink 
            rendered="true" action="#{MovieCenter.search}" id="searchLink">
                      <h:outputText value="#{bundle.searchLink}"></h:outputText>
             </h:commandLink>

    And
    <h:commandLink value=”#{bundle.searchLink}”
    rendered=”true” action=”#{MovieCenter.search}”
    id=”searchLink”>
    </h:commandLink>

    Actually brings the same effect.
    The problem is that, i want to lay out my components in a specified way. in simple html pages, i could use table to hold the links and pics, and specify the alignment(call this “html effect“)now i write the header file like this to put the header test and command link in a table, but it was not rendered in the right way:

    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <TABLE align="center" border="1" width="100%">
        <TR>
            <TD>
               <H2 align="center">Movie Center</H2>
            </TD>
        </TR>
        <TR>
            <TD align="left">
            <h:commandLink 
                rendered="true" action="#{MovieCenter.search}" id="searchLink">
            <h:outputText value="#{bundle.searchLink}"></h:outputText>
            </h:commandLink>
            </TD>
        </TR>
    </TABLE>
    <HR>

    but the command link is rendered out of the table,just right below the horizental line. so in JSF, maybe i need to get the “html effect” in another way,as the code above finally generates the html code doesn’t work as specified in my original message.
    but how?hope i have made it clear:)
    Best Regards 😛
    Robin

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: CommandLink defined in a html table not rendered in it!

You must be logged in to post in the forum log in