• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Problem in using Apache myfaces & tiles

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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 ?
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks gregg
i tried with index.jsf before but i have same error
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic