Hhmm, I just found out that it works correctly if I use <%@include>. 

-----Original Message-----
From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com] 
Sent: Thursday, May 17, 2012 7:50 AM
To: MyFaces Discussion
Subject: RE: jsf - odd <jsp:include> behavior 

Still puzzle by why jsp:include is not generate the html correct.  I've 
simplified my include page to be like below.  Can someone put this in a jspx 
file and add a <jsp:include page="whateverJspxFileYouHavesave"> in a working 
page for me?  The result that I'm getting looks like below.  As you can see, 
the jsf outputText is being placed outside of the outer and inner tables, which 
does not make sense at all:

JSF outputText =>I Should Be in inner table
-----------------------------------------------------
| Outer Table                                       |
|-------------------------------------------------- |
||   Inner Table                                  | |
||                                                | |
||                                                | |
||------------------------------------------------- |
|----------------------------------------------------


<jsp:root version="2.0"
     xmlns:jsp="http://java.sun.com/JSP/Page";
     xmlns:c="http://java.sun.com/jsp/jstl/core";
     xmlns:f="http://java.sun.com/jsf/core";
     xmlns:h="http://java.sun.com/jsf/html";
     xmlns:t="http://myfaces.apache.org/tomahawk";
     xmlns:a4j="http://richfaces.org/a4j";>

<f:subview>

<h:form>
<table width="350px" border="2" cellspacing="2" cellpadding="2">
  <tr>
    <td>
      <b>Outer Table</b>
        <table width="100%" border="2" cellspacing="2" cellpadding="2">
          <tr>
            <td>
              <b>Inner Table</b><br/><br/>
              <h:outputText value="JSF outputText => I Should Be in inner 
table"/>
            </td>
          </tr>
        </table>
    </td>
  </tr>
</table>

</h:form>
</f:subview>
</jsp:root>

-----Original Message-----
From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com]
Sent: Wednesday, May 16, 2012 10:29 AM
To: MyFaces Discussion
Subject: jsf - odd <jsp:include> behavior

Hello,
I'm currently using myfaces 1.1.9 for my web app and I am seeing a strange jsf 
behavior when using <jsp:include>.  Below is what the include page looks like.  
Inside this include page, it has a h:commandLink inside of a regular HTML 
table.  For some reasons, the JSF is generating the resulting HTML with the 
commandlink outside of this regular HTML table.  If I put this exact code 
directly into the master page (the one with <jsp:include>), it works fine.

<jsp:root version="2.0"
    xmlns:jsp="http://java.sun.com/JSP/Page";
     xmlns:c="http://java.sun.com/jsp/jstl/core";
     xmlns:f="http://java.sun.com/jsf/core";
     xmlns:h="http://java.sun.com/jsf/html";
     xmlns:t="http://myfaces.apache.org/tomahawk";
     xmlns:a4j="http://richfaces.org/a4j";>

<f:subview>

<h:form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="right" valign="top" background="redesign/images/newtop.png" >
      <table width="100%" border="0" cellspacing="1" cellpadding="1">
        <tr>
          <td width="20%">
            <img src="redesign/images/USAMoblity_White_HIRES.png" alt="USA 
Mobility.com" width="200" height="45" hspace="15" vspace="3" />
          </td>
          <td width="80%" align="right" valign="top">
            <right>
              <h:commandLink  immediate="true" style="align:right; CURSOR: 
pointer"  action="#{commonTaskBean.logoutFromMyAccountAndMSAM}">
                <h:outputText styleClass="subnavma" 
style="text-transform:none;" value="LOG OUT"/>
              </h:commandLink>
            </right>
          </td>
        </tr>
        <tr> </tr>
        <tr> </tr>
      </table>
    </td>
  </tr>
</table>

</h:form>
</f:subview>
</jsp:root>

Reply via email to