This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Problem in rendering html tags in myfaces tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem in rendering html tags in myfaces tiles" Watch "Problem in rendering html tags in myfaces tiles" New topic
Author

Problem in rendering html tags in myfaces tiles

Solmaz Anvar
Greenhorn

Joined: Jul 14, 2005
Posts: 26
I use MyFaces tiles in my project.
when i use a jsp page with jsf components as a tile.
and render whole page html tag in page render separately
for example my template page is something like this:

template.jsp
--------------------------------------
<%@ 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">
<head>
<meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1" />
<title>
<tiles:getAsString name="title" />
</title>
</head>
<f:view>
<body dir="rtl">
<table class="main">
<tr>
<td colspan="2" class="header">
<f:subview id="header">
<tiles:insert attribute="header" flush="false"/>
</f:subview>
</td>
</tr>
<tr>
<td rowspan="3" class="sidemenu">
<f:subview id="sideMenu">
<tiles:insert attribute="sideMenu" flush="false"/>
</f:subview>
</td>
</tr>
<tr>
<td class="body">
<f:subview id="form">
<h:form>
<table class="inputMain">
<tr><td class="inputFormfields">
<tiles:insert attribute="inputFormFields" flush="false" />
</td></tr>
<tr><td class="inputButtoms">
<tiles:insert attribute="inputButtons" flush="false" />
</td></tr>
</table>
</h:form>
</f:subview>
</td>
</tr>
<tr>
<td colspan=2 class="footer">
<f:subview id="footer">
<tiles:insert attribute="footer" flush="false"/>
</f:subview>
</td>
</tr>
</table>
</body>
</f:view>
</html>
-------------------------------------------------------


inputFormFields.jsp
--------------------
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>

<h utputLabel for="fn" value="FirstName : "/>
<h:inputText id="fn"/><br>

<h utputLabel for="ln" value="LastName : "/>
<h:inputText id="ln"/><br>
------------------------------------------------


inputButtons.jsp
-------------------
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>

<h:commandButton accesskey="0" id="BtnSave" value="Save"/> 
<h:commandButton accesskey="1" id="BtnCancel" value="Cancel"/> 
<h:commandButton accesskey="2" id="BtnEdit" value="Edit"/> 
<h:commandButton accesskey="3" id="BtnUpdate" value="Update"/> 
<h:commandButton accesskey="4" id="BtnDelete" value="Delete"/> 

--------------------------------------------------------------------


tiles.xml
---------------
<definition name="inputLayout" path="/template/inputTemplate.jsp">
<put name="header" value="/common/header.jsp" />
<put name="footer" value="/common/footer.jsp" />
<put name="sideMenu" value="/common/sideMenu.jsp" />
<put name="inputButtons" value="/common/inputButtons.jsp" />
</definition>

<definition name="/page1.tiles" extends="inputLayout" >
<put name="inputFormFields" value="/page1.jsp" />
<put name="title" value="input" />
</definition>

-----------------------------------------------------------
when http://localhost:8080/wtr/page1.jsf rendered
html tags like(<br> in inputFormFields.jsp and inputFormFields.jsp rendered after jsf components

result is something like this

<form action="....>

<input typ="text" ...>
<input typ="text" ...>
<input typ="text" ...>
<input typ="text" ...>

<br>
<br>
<br>

<input typ="submit" ...>
<input typ="submit" ...>
<input typ="submit" ...>
<input typ="submit" ...>

 
 
 
 
 

</form>

-------------------------------------
i don't have any control on my Form Fields position and designing Form template

Please guide me what can i do.

Regards soli


Solmaz Anvar
Solmaz Anvar
Greenhorn

Joined: Jul 14, 2005
Posts: 26
Hi again.
I think i can't use any html tags in my tiles pages.
instead of these tags i must use jsf tag lib that rendered as html tags like table,..

somthing like
<h anelGrid> or </h anelGroup>

any suggestions?

Regards soli
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in rendering html tags in myfaces tiles
 
Similar Threads
Page is displayed blank for Login Application
Struts tiles help
Jsf tiles problem
Navigation Problem
Tiles winding me up.