File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Problem in using Apache myfaces & tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem in using Apache myfaces & tiles" Watch "Problem in using Apache myfaces & tiles" New topic
Author

Problem in using Apache myfaces & tiles

Solmaz Anvar
Greenhorn

Joined: Jul 14, 2005
Posts: 26
I'm new in Apache myfaces but i worked with sun jsf RI before successfully.
for use myfaces tiles i change my application setting as follow

in WEB-INF/lib i put this jars

commons-beanutils-1.6.1.jar
commons-codec-1.2.jar
commons-collections-3.0.jar
commons-digester-1.5.jar
commons-el.jar
commons-fileupload-1.0.jar
commons-logging.jar
commons-validator.jar
jakarta-oro.jar
jaxen-full.jar
jsp-2.0.jar
myfaces-extensions.jar
myfaces-impl.jar
myfaces-jsf-api.jar
myfaces-xdoclet.jar
saxpath.jar
standard.jar
jstl.jar
struts.jar

i put struts-tiles.tld in WEB-INF directory

i change configuration files as below


web.xml
----------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>tmf</display-name>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
<description>Comma separated list of URIs of (additional) faces config files.
(e.g. /WEB-INF/my-config.xml)
See JSF 1.0 PRD2, 10.3.2</description>
</context-param>
<context-param>
<param-name>tiles-definitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://struts.apache.org/tags-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
</web-app>
------------------------------------------------------------------


faces-config.xml
------------------------
<faces-config xmlns="http://java.sun.com/JSF/Configuration">
<application>
<view-handler>org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl</view-handler>
</application>
</faces-config>



tiles.xml
------------------------
<tiles-definitions>
<definition name="layout" path="template.jsp" >
<put name="header" value="header.jsp" />
<put name="menu" value="navigation.jsp" />
</definition>

<definition name="/page1.tiles" extends="layout" >
<put name="body" value="/page1.jsp" />
</definition>
</tiles-definitions>

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


i have index.jsp that redirect to page1.jsf but when i try this url
http://localhost:8080/faceproject/index.jsp
i see this error

error
---------------------------------------------------
Unable to open location: Document not found on server


i use jbuilder2005 and tomcat5.0
i follow apache sample code to use myfaces with tiles.

please tell me what's wrong i can't accesss to any page with tiles support or not.

Regard
Solmaz Anvar



Solmaz Anvar
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6



http://localhost:8080/faceproject/index.jsp

How does your webapp know what to do with .jsp files when you've mapped everything to .jsf? What if you used http://localhost:8080/faceproject/index.jsf ?


GenRocket - Experts at Building Test Data
Solmaz Anvar
Greenhorn

Joined: Jul 14, 2005
Posts: 26
thanks gregg
i tried with index.jsf before but i have same error
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Looking again, it looks like there is nothing in your tiles definition file that says anything about index.jsp. I'd have a look at this and pay particular attention to the very last part titled A few observations of note here.

Let me know...
Solmaz Anvar
Greenhorn

Joined: Jul 14, 2005
Posts: 26
Hi Gregg
Thanks again for your refrence. It work fine.

i added this tag to web.xml

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>

but seems it is not necessary.Apache myfaces-tiles-example.war work fine without this tag.I don't know why.

cheers solmaz anvar
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in using Apache myfaces & tiles
 
Similar Threads
blank index.jsp on Tomcat 5.5.9
problem in Tiles2 intrigation with jsf when we keep jsp in folder location
panelNavigation2 and tree2 not working inside tiles application
problem in using richfaces
at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.getServletMapping