myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Gardener" <james.gardene...@gmail.com>
Subject tiles problem
Date Mon, 05 Mar 2007 04:11:14 GMT
Hi all,

I am implementing a project using tiles with myfaces.  I can successfully
run the sample myfaces-1.0.7-tiles-example, but I am having a lot of
problems when turing this sample into a more complex implementation.

Here is my layout:


<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>

<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>

<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

   <meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1" />

   <link rel="stylesheet" type="text/css" href="css/basic.css" />

</head>

<body>

  <f:view>

      <div id="level0">

         <div id="level1">

            <div id="topBar">

               <f:subview id="header">

                    <tiles:insert attribute="header" flush="false"/>

               </f:subview>

         </div>

      <div id="level2">

             <f:subview id="content">

                 <tiles:insert attribute="body" flush="false"/>

             </f:subview>

      </div>

    </div>

   </div>

</f:view>

</body>

</html>

Here is my tiles-def.xml


<tiles-definitions>

          <definition name="main.layout" path=
"/jsp/template/basicLayout.jsp">

               <put name="header" value="/jsp/common/adminHeader.jsp" />

          </definition>

          <definition name="/login.tiles" extends="main.layout">

               <put name="body" value="/jsp/admin/login.jsp" />

          </definition>

<tiles-definitions>

Here is the adminHeader.jsp:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<h:graphicImage id="logo" url="/image/logo.jpg" /

Here is the page login.jsp


<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>

<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>

<h:form id="loginForm">

<table align="center">

<tr>

<td style="padding:20">

<table>

<tr>

<td align="right">

<h:outputText value="UserId"/>

</td>

<td align="left">

<h:inputText value="#{userAdminBean.userId}" id="userId" required="true"/>

<h:message styleClass="errorMessage" for="userId"/>

</td>

</tr>

<tr>

<td align="right">

<h:outputText value="Password"/>

</td>

<td align="left">

<h:inputSecret value="#{userAdminBean.password}" id="password" required=
"true"/>

<h:message styleClass="errorMessage" for="password"/>

</td>

</tr>

<tr>

<td colspan="2" align="center">

<h:commandButton value="Login" action="#{userAdminBean.loginAction}"/>

</td>

</tr>

<tr >

<td colspan="2" align="center">

<h:messages errorClass="errorMessage" globalOnly="true"/>

</td>

</tr>

</table>

</td>

</tr>

</table>

</h:form>

When I type http://localhost:8080/myApp/login.jsf, everything is deplayed,
but the layout is messed out.  userid + userid textfield + password +
passwordfield + login button are all displayed in only single row.  If I
don't use tiles, all the above fields are displayed row by row, which is
correct.

Can anyone please tell me if I did anything wrong.  I am desperately need
your help.

Thanks,
James

Mime
View raw message