JSF & Tiles integration
Hi Freinds,
I m new to JSF and I m looking for some tutorial/article/guide or war file which uses the JSF implementation with tiles.
Need urgently.
Thanking in advance.
regards,
Novin
Hello,
i'm trying to use MyFaces+Tiles.
I done this steps:
1) put struts.jar in WEB-INF/lib
2) add follow lines in web.xml
<context-param>
<param-name>tiles-definitions</param-name>
<param-value>/WEB-INF/tiles-defs.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.tiles</param-value>
</context-param>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>3) add follow in application tag of faces-config.xml
<view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>4) make file tiles-defs.xml and put it in WEB-INF dir, some its lines are
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
<definition name="layout.base" path="/index.jsp" >
<put name="header" value="/header.jsp" />
<put name="body" value="" />
<put name="footer" value="/footer.jsp" />
</definition>
<definition name="/index.tiles" extends="layout.base" >
<put name="body" value="/body_index.jsp" />
</definition>
...5) index.jsp is this (partial)
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title><f:verbatim>index</f:verbatim></title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body >
<div id="topPanel">
<f:subview id="header">
<tiles:insert attribute="header" flush="false"/>
</f:subview>
</div>
<div id="bodyPanel">
<f:subview id="body">
<tiles:insert attribute="body" flush="false"/>
</f:subview>
</div>
<div id="footerPanel">
<f:subview id="footer">
<tiles:insert attribute="footer" flush="false"/>
</f:subview>
</div>6) header.jsp follow
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<h:form>
<ul>
<li><h:commandLink action="login">Contattaci</h:commandLink></li>
<li><h:commandLink action="login">Chi siamo</h:commandLink></li>
<li class="active"><h:commandLink action="index">Home</h:commandLink></li>
</ul>
...other pages are similar
7) i used a html page for redirect it follow
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Refresh" content="0; URL=faces/index.tiles" />
<title>Index</title>
</head>
<body>
</body>
</html>The problem is: the page displayed (after invoke index.html) is empty, no errors on server.
Why?
How i can solve?
Regards.
Similar Messages
-
Need JSF & tiles integration using any implementation
Hi Freinds,
I m new to JSF and I m looking for some tutorial or war file which uses the JSF implementation with tiles.
Myfaces will be best.
Need urgently.
Thanking in advance.
regards,
NovinHi Freinds,
I m new to JSF and I m looking for some tutorial or war file which uses the JSF implementation with tiles.
Myfaces will be best.
Need urgently.
Thanking in advance.
regards,
Novin -
Problem with jsf-tiles integration
Hi , I'm trying to integrate jsf and tiles but I have some problems..
I add
<context-param>
<param-name>tiles-definitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
to web.xml and
<view-handler>
org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl
</view-handler>
in jsf-config.xml
template file looks like:
<f:view>
<body>
<table width="100%" border="1">
<tr>
<td colspan="2">
<f:facet name="header">
<f:subview id="header">
<tiles:insert attribute="header" flush="false" />
</f:subview>
</f:facet>
</td>
</tr>
when I display the page I get all jsf code at beginning and the body without any jsf output bottom...
I don't understand how I mistake
Thanks for any help
LucaTry to use <h:panelGrid> instead of the <table> tag.
-
JSF, tiles, xml and xsl
Good days people, I am employed at an app that wants to integrate JSF, tiles, xml and xsl.
Basically the app receives information of the user's interfaz, builds an url with the above mentioned information and invokes to a service web that a xml returns with the information. The idea is to generate the exit in format html or wml with an insole(staff) xsl and to send the result in this format to every jsp that is going to form a part of the page that it will generate tiles. at first I understand that it is feasible, i�d like to know if someone already has done it and since it has done it.
Just now what I have is a managed bean that receives the parameters of the altar frontal and invokes a method of a service, like this:
public String encuentra(){
//deja los atributos privados rellenos.
String mensaje ;
crearYRellenarBusquedaVO();
try {
setResultado(this.getServicio().obtenerResultadosWML(this.getBusquedaVO()));
mensaje="succesNoJS";
}catch(java.lang.IllegalArgumentException e){
mensaje="error";
}catch(es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException e1){
mensaje="error";
}catch(Exception e2){
mensaje="error";
return mensaje;
public String obtenerResultadosWML(es.yell.frontlite.service.impl.BusquedaVO busquedaVO){
if (busquedaVO == null){
throw new IllegalArgumentException(
"obtenerResultadosJSdesactivado(es.yell.frontlite.service.impl.BusquedaVO busquedaVO) - 'busquedaVO' no puede ser nulo.");
try{
return this.manejarObtenerResultadosWML(busquedaVO);
}catch(es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException e1){
throw new es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException(
"Error ejecutando el servicio String obtenerResultadosJSdesactivado(es.yell.frontlite.service.impl.BusquedaVO busquedaVO). " + e1.getCause(),e1);
}catch(Exception e){
throw new es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException(
"Error ejecutando el servicio String obtenerResultadosJSdesactivado(es.yell.frontlite.service.impl.BusquedaVO busquedaVO). " + e.getCause(),e);
//it returns html code!
protected String manejarObtenerResultadosWML(es.yell.frontlite.service.impl.BusquedaVO busquedaVO)
throws java.lang.Exception{
try{
// xmlOrigen has full xml response from server
String xmlOrigen = manejarObtenerResultadosJSActivado(busquedaVO);
Source xmlSource = new StreamSource(new StringBufferInputStream(xmlOrigen));
Source xsltSource = new StreamSource(SrvBusquedaNoxtrumServiceImpl.class.getResourceAsStream(Constantes.XSL_FILE));
StringWriter cadenaSalida = new StringWriter();
Result bufferResultado = new StreamResult(cadenaSalida);
TransformerFactory factoriaTrans = TransformerFactory.newInstance();
Transformer transformador = factoriaTrans.newTransformer(xsltSource);
transformador.transform(xmlSource, bufferResultado);
System.out.println(cadenaSalida.toString());
return cadenaSalida.toString();
}catch(Exception e2){
throw new es.yell.frontlite.exceptions.SrvBusquedaNoxtrumServiceException (e2.getMessage());
With this exit in html, since(as,like) how could i forward it towards a jsp especially?
faces-config.xml
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>succesNoJS</from-outcome>
<to-view-id>/jsDesactivado.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>error</from-outcome>
<to-view-id>/error.jsp</to-view-id>
</navigation-case>
</navigation-rule>
index.jsp
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<f:view>
<f:loadBundle basename="MessageResources" var="msg"/>
<head>
<title>
${msg.titulo}
</title>
</head>
<body>
<h:form id="formulario">
Que:
<h:inputText id="campoQue" value="#{yellProxy.campoQue}" />
Donde
<h:inputText id="campoDonde" value="#{ yellProxy.campoDonde}" />
<h:commandButton id="boton" value="Encuentra" action="#{yellProxy.encuentra}"/>
</h:form>
</f:view>
</body>
</html>
jsDesactivado.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri=" http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>JSP Page</h1>
jsDesactivado!!
<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello ${param.name}!
</c:if>
--%>
<jsp:getProperty name="yellProxy" property="resultado"/>
</body>
</html>
If you could pass me a simple example of use of an app that uses JSF, tiles, xml and xsl, i�be grateful
regards a lot!We too (at Viking Freight) would also be very interested to see if anybody
has produced such a useful series of classes...
Frank Lees, Developer
-----Original Message-----
From: Amin, Kamran [mailto:kamran.aminframeworkinc.com]
Sent: Wednesday, January 19, 2000 12:11 PM
To: 'Forte User'
Subject: (forte-users) XML and XSL in Forte
Has anybody integrated an XSL parser with Forte. I know Forte provides us
with an XML parser but that does not help with parsing XSL. There a lot of
parsers written in JAVA but that will not integrate well with Forte. We
need something that will be easy to integrate with Forte. This parser will
take our XML and XSL to give us a result set. If anybody can comment on the
subject or share some information I would appreciate it.
thanks in advance.
ka
For the archives, go to: http://lists.sageit.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.sageit.com -
This is just a post for other newbies (like me !) out there who might have struggled with integrating JSF & Tiles. It turns out my problem was not integration related at all & nor was it related to JSF (probably) or Tiles. I just did not know how to load a stylesheet correctly. The way I did it the first time was:
<head>
<link rel="stylesheet" href="./config/styles.css" type="text/css"/>
</head>
This worked fine the first time the page was displayed. Now if there was a validation error JSF would re-display the same page with all styles missing. The page would have the correct Tiles layout nonetheless.
After much searching up all the wrong alleys (such as integration between the two etc.), I finally arrived at the correct way to load the .css file:
<head>
<link rel="stylesheet" href="<%=request.getContextPath()%>/config/styles.css" type="text/css" />
</head>
Now the path is derived from the contextPath of the application each time and the pages do not lose their styles.
...just in case someone else hits this and ends up looking here.
Ciao, BhishmaThanks Bhishma your solution was very usefull, I wish to know if you have some blog or something where I could write to you, for to be in touch and share experiences from our countries, sorry for my bad english
-
IceFaces + Tiles Integration
Hi,
I had tried to integrate tiles (struts libraries) with icefaces libraries in Jdeveloper 10.3.1.0 but in runtime I obtain the error : "SEVERE: Digester.getParser:". I had readed about incompatibility libraries struts a xerce in this jdeveloper version, does it's true?
Too, I had tried with Jdeveloper 11g, but in this cases the error is : "Falta la clase: org.apache.struts.util.PropertyMessageResourcesFactory", which is in struts.jar that is in the claspath.
Does anybody obtained this integration in Jdev with success?
Thanks.Anjeludo,
Here's a link about using tiles with JSF: http://www.jsftutorials.net/tiles/jsf-tiles.html
And another one about IceFaces in JDeveloper: http://technology.amis.nl/blog/?p=1508
Hope this helps.
John -
Tiles integration with Jdeveloper11g
Hi
I am working on jdev11g and planning to integarte Tiles with it.
I follow the steps given in Help document but unable to get success.
To add a Tiles definitions file to a web application project:
For a JSF application, Add Tiles Servlet definition to web.xml.
when I add it it is unable to get TilesServlet class.
Can u giude me or give some usefull liks from where i can get Step to Step info @ Tiles integration with jde11g
Thanks for all Help.Jaydeep,
Did you create a library (Tools -> Manage Libraries) containing the Tiles jar files and add that library to your project?
John -
Reg. JSF Spring Integration issue.
Hi All,
I am using JSF for the front end and using the Spring Core, DAO and AOP for the BO and DAO layers. When i try to inject the Objects using the DI to the JSF, i am getting the following error and the objects are not getting set from the Spring.
Error Log:*
javax.servlet.ServletException: Unable to create managed bean dataUploadControllerBean. The following problems were found:
- Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
- Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
- Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)
i have defined the respective entries correctly to integrate the JSF & Spring. But still the JSF&Spreing is not integrated successfully. Please find the configs defined and help to resolve the issue. i am stuck in this for 2 days...
Web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/applicationContext.xml</param-value>
</context-param>
Faces-Config.xml
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> <!-- have used this ELResolver to injects objects from Spring-->
</application>
<managed-bean>
<managed-bean-name>dataUploadControllerBean</managed-bean-name>
<managed-bean-class>com.sgspace.model.dataupload.DataUploadControllerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>dataUploadBean</property-name>
<value>#{dataUploadBean}</value> _<!-- Already present in the faces-config.xml-->_ </managed-property>
<managed-property>
<property-name>dataUploadVO</property-name>
<property-class>#{dataUploadVO}</property-class> _<!-- Injected from Spring DI. This is currently not working.-->_
<value></value>
</managed-property>
<managed-property>
<property-name>dataUploadBO</property-name>
<property-class>#{dataUploadBO}</property-class>_<!-- Injected from Spring DI. This is currently not working.-->_ <value></value>
</managed-property>
</managed-bean>
applicationContext.xml:_
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="dataUploadDAO"
class="com.sgspace.dao.dataupload.DataUploadDAOImpl">
<property name="dataSource" ref="dataSource"></property>
</bean>
<bean id="dataUploadBO"
class="com.sgspace.bo.dataupload.DataUploadBOImpl">
<property name="dataUploadDAO" ref="dataUploadDAO"></property>
</bean>
<bean id="dataUploadVO" class="com.sgspace.vo.dataupload.DataUploadVO"></bean>
</beans>
Warm Regards,
Praveen SThe TestBean have a property for DeviceManager along with setter/getter methods as shown below. Sorry for not including in earlier posting
TestBean.java (Backing Bean)
private DeviceTypeManager deviceManager;
public DeviceTypeManager getDeviceManager() {
return deviceManager;
public void setDeviceManager(DeviceTypeManager deviceManager) {
this.deviceManager = deviceManager;
Here are the two scenarios
Scenario 1 : without <managed-property> the code works fine
Scenario 2 : with <managed-property> the code results in following error
javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration
The Scenario 1 works absolutely fine as the expression '#{test.selectedDevice}' gets its value from setter/getter method in the backing bean(TestBean.java) . This is expected behaviour & wondering why it doesn't work similarly in Scenario 2 instead it complains
Cannot get value for expression '#{test.selectedDevice}'
I am willing to upload the war file. Any pointers/suggestions in resolving the error will be highly appreciated
Regards
Bansi -
Hi there,
i want to integrate spring with my existing application. is there any good tutorials in net to give good view on that. i google it but not fully satisfied.
please help me if you have any idea..
Regards,
A.The TestBean have a property for DeviceManager along with setter/getter methods as shown below. Sorry for not including in earlier posting
TestBean.java (Backing Bean)
private DeviceTypeManager deviceManager;
public DeviceTypeManager getDeviceManager() {
return deviceManager;
public void setDeviceManager(DeviceTypeManager deviceManager) {
this.deviceManager = deviceManager;
Here are the two scenarios
Scenario 1 : without <managed-property> the code works fine
Scenario 2 : with <managed-property> the code results in following error
javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration
The Scenario 1 works absolutely fine as the expression '#{test.selectedDevice}' gets its value from setter/getter method in the backing bean(TestBean.java) . This is expected behaviour & wondering why it doesn't work similarly in Scenario 2 instead it complains
Cannot get value for expression '#{test.selectedDevice}'
I am willing to upload the war file. Any pointers/suggestions in resolving the error will be highly appreciated
Regards
Bansi -
JSF/Spring integration - managed-property problem
I am using JSF 1.1_01 (MyFaces 1.1), Spring 1.2, Ajax4Jsf.
The JSF application has h:selectOneMenu .
On change event of h:selectOneMenu sets "selectedValue" into backing bean as shown below:
page.jsp
<h:selectOneMenu value="#{test.selectedDevice}" >
<f:selectItem itemValue="0" itemLabel="--New--"/>
<f:selectItem itemValue="1" itemLabel="WorkStation"/>
<f:selectItem itemValue="2" itemLabel="Router"/>
<f:selectItem itemValue="3" itemLabel="Switch"/>
<ajax:support action="#{test.loadDevice}" event="onchange" reRender="t2,t3,t4,t5"/>
</h:selectOneMenu>
TestBean.java (Backing Bean)
public String getSelectedDevice() {
logger.info(" *** In getSelectedDevice *** ");
if (selectedDevice == null) {
selectedDevice = "0"; // This will be the default selected item.
return selectedDevice;
public void setSelectedDevice(String selectedDevice) {
logger.info(" *** In setSelectedDevice *** ");
this.selectedDevice = selectedDevice;
Here are the configuration file snippets for integrating JSF Spring
web.xml
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
faces-config.xml
<application>
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
</application>
<managed-bean>
<managed-bean-name>test</managed-bean-name>
<managed-bean-class>test.TestBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>deviceManager</property-name>
<property-class> test.DeviceTypeManager </property-class>
<value>#{deviceManager}</value>
</managed-property>
</managed-bean>
The above code results in the following error
javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
The error occurs only if i include <managed-property> inside the <managed-bean> in faces-config.xml.
The moment i remove <managed-property> from face-config.xml the error disappears & page gets rendered properly.
The purpose in having <managed-property> inside managed-bean is to call Spring's Manager class (i.e. deviceManager) from JSF application
Any pointers/suggestions in resolving the error will be highly appreciated
Regards
BansiThe TestBean have a property for DeviceManager along with setter/getter methods as shown below. Sorry for not including in earlier posting
TestBean.java (Backing Bean)
private DeviceTypeManager deviceManager;
public DeviceTypeManager getDeviceManager() {
return deviceManager;
public void setDeviceManager(DeviceTypeManager deviceManager) {
this.deviceManager = deviceManager;
Here are the two scenarios
Scenario 1 : without <managed-property> the code works fine
Scenario 2 : with <managed-property> the code results in following error
javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration
The Scenario 1 works absolutely fine as the expression '#{test.selectedDevice}' gets its value from setter/getter method in the backing bean(TestBean.java) . This is expected behaviour & wondering why it doesn't work similarly in Scenario 2 instead it complains
Cannot get value for expression '#{test.selectedDevice}'
I am willing to upload the war file. Any pointers/suggestions in resolving the error will be highly appreciated
Regards
Bansi -
JSF + Tiles : Assertion Failed
Hi,
I'm running JDev 10.1.3 Developer Preview . I have jsf+tiles application.
Here is run the time error messages:
[ServletException in:/appHeader.jsp] Assertion Failed'
{ServletException in:/appContent.jsp] Assertion Failed'
[ServletException in:/appMenu.jsp] Assertion Failed'Do the JSF tile pages have a <f:view> </f:view> JSF component?
Does the wrapper JSF also include an f:view?
Replace f:view with h:panelGrid in the tiles. -
Unable to display Popup page while using JSF Tiles
Hi All,
I am using JSF Tiles. In the body page i am trying to open a pop up page through java script. bt i got the 500 internal server error. The popup open properly when there is no html or core jsf tags. can anyone help me abt this problem.
Thanks.For future JSP/Servlet related questions please use the JSP/JSTL forum or the Servlet forum. There are more experts.
As to your problem: did you read a basic JSP/Servlet book/tutorial? Did you read the [Tomcat documentation|http://tomcat.apache.org/tomcat-6.0-doc/index.html]? Your problem more sounds like you missed something trivial. -
hello All
Has anyone come across the issue with JSF ajax integration in JSF 2. When I try to use jsf 2 F:ajax TAG i GET THE following error
JSF1064: Unable to find or serve resource, jsf.js.xhtml
Thanks for your help
NekUnfortunately you are not giving us enough information. How are you using the tag?
-
JSF/Tiles/Spring Integration Problem
Hi,
I have a JSF based web application, which uses Struts Tiles framework through the view-handler "org.apache.myfaces.tomahawk.application.jsp.JspTi lesViewHandlerImpl". Now I am trying to integrate this with the Spring framework by making use of the variable-resolver "org.springframework.web.jsf.DelegatingVariableRes olver". With this, when I try to access a page, (whose backing bean gets injected with Spring beans) I get the following exception:
javax.faces.el.EvaluationException: Expression Error: Named Object: 'userSession' not found.
at com.sun.faces.config.ManagedBeanFactory.getScopeFo rSingleExpression(ManagedBeanFactory.java:998)
at com.sun.faces.config.ManagedBeanFactory.hasValidLi fespan(ManagedBeanFactory.java:931)
at com.sun.faces.config.ManagedBeanFactory.evaluateVa lueBindingGet(ManagedBeanFactory.java:892)
at com.sun.faces.config.ManagedBeanFactory.setPropert iesIntoBean(ManagedBeanFactory.java:553)
at com.sun.faces.config.ManagedBeanFactory.newInstanc e(ManagedBeanFactory.java:234)
at com.sun.faces.application.ApplicationAssociate.cre ateAndMaybeStoreManagedBeans(ApplicationAssociate. java:253)
at com.sun.faces.el.VariableResolverImpl.resolveVaria ble(VariableResolverImpl.java:79)
at org.springframework.web.jsf.DelegatingVariableReso lver.resolveVariable(DelegatingVariableResolver.ja va:108)
at com.sun.faces.el.impl.NamedValue.evaluate(NamedVal ue.java:125)
at com.sun.faces.el.impl.ComplexValue.evaluate(Comple xValue.java:146)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.eval uate(ExpressionEvaluatorImpl.java:244)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBi ndingImpl.java:173)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBi ndingImpl.java:154)
at javax.faces.component.UIOutput.getValue(UIOutput.j ava:147)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputR enderer.getValue(HtmlBasicInputRenderer.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.getCurrentValue(HtmlBasicRenderer.java:191)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeEnd(HtmlBasicRenderer.java:169)
at javax.faces.component.UIComponentBase.encodeEnd(UI ComponentBase.java:712)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeRecursive(HtmlBasicRenderer.java:443)
at com.sun.faces.renderkit.html_basic.GridRenderer.en codeChildren(GridRenderer.java:233)
at javax.faces.component.UIComponentBase.encodeChildr en(UIComponentBase.java:693)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeRecursive(HtmlBasicRenderer.java:435)
at com.sun.faces.renderkit.html_basic.GridRenderer.en codeChildren(GridRenderer.java:233)
at javax.faces.component.UIComponentBase.encodeChildr en(UIComponentBase.java:693)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeRecursive(HtmlBasicRenderer.java:435)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeRecursive(HtmlBasicRenderer.java:440)
at com.sun.faces.renderkit.html_basic.GridRenderer.en codeChildren(GridRenderer.java:233)
at javax.faces.component.UIComponentBase.encodeChildr en(UIComponentBase.java:693)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeRecursive(HtmlBasicRenderer.java:435)
at com.sun.faces.renderkit.html_basic.GridRenderer.en codeChildren(GridRenderer.java:233)
at javax.faces.component.UIComponentBase.encodeChildr en(UIComponentBase.java:693)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeRecursive(HtmlBasicRenderer.java:435)
at com.sun.faces.renderkit.html_basic.GridRenderer.en codeChildren(GridRenderer.java:233)
at javax.faces.component.UIComponentBase.encodeChildr en(UIComponentBase.java:693)
at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeRecursive(HtmlBasicRenderer.java:435)
at com.sun.faces.renderkit.html_basic.GridRenderer.en codeChildren(GridRenderer.java:233)
at javax.faces.component.UIComponentBase.encodeChildr en(UIComponentBase.java:693)
at javax.faces.webapp.UIComponentTag.encodeChildren(U IComponentTag.java:600)
at javax.faces.webapp.UIComponentTag.doEndTag(UICompo nentTag.java:537)
at com.sun.faces.taglib.html_basic.PanelGridTag.doEnd Tag(PanelGridTag.java:460)
at org.apache.jsp.WEB_002dINF.layout.jsf_002dlayout_j sp._jspx_meth_h_panelGrid_0(jsf_002dlayout_jsp.jav a:269)
at org.apache.jsp.WEB_002dINF.layout.jsf_002dlayout_j sp._jspx_meth_h_form_0(jsf_002dlayout_jsp.java:222 )
at org.apache.jsp.WEB_002dINF.layout.jsf_002dlayout_j sp._jspx_meth_f_view_0(jsf_002dlayout_jsp.java:188 )
at org.apache.jsp.WEB_002dINF.layout.jsf_002dlayout_j sp._jspService(jsf_002dlayout_jsp.java:99)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
I could get the application work with JSF and Spring, without Tiles.
Appreciate any help in this regard.
ThanksI'm assuming that since you are using JSF and Tiles, you are not using Spring's web framework. In that case, the integration of Spring with JSF is relatively trivial and you can neglect it for now. You might want to try the link below, if you are feeling lucky:
http://www.google.com/search?q=myfaces+tiles -
JSF 1.2 and Tiles integration
I have a web application using JSF 1.1 and Tiles that I am trying to upgrade to run using JSF 1.2.
It is working as far as working out that it should use the tile, but then it all seems to fall over when trying to render.
Does anyone know if it is possible to use Tiles with JSF 1.2?
StevenHi,
I took the Shales TileViewHandler and replaced the renderView method with the one below. This is a copy of the method from the Sun RI except that it passes the tile (ComponentDefinition) along to the subsequent methods.
Then when it gets down to executePageToBuildView the requestURI is obtained from the tile (tile.getPath()) rather than from the UIViewRoot (viewToExecute.getViewId()).
public void renderView(FacesContext facesContext, UIViewRoot viewToRender)
throws IOException, FacesException {
String viewId = viewToRender.getViewId();
String tileName = getTileName(viewId);
ComponentDefinition tile = getTile(tileName);
if (log.isDebugEnabled()) {
String message = null;
try {
message = bundle.getString("tiles.renderingView");
} catch (MissingResourceException e) {
message = "Rendering view {0}, looking for tile {1}";
synchronized(format) {
format.applyPattern(message);
message = format.format(new Object[] { viewId, tileName });
log.debug(message);
if (tile != null) {
if (log.isDebugEnabled()) {
String message = null;
try {
message = bundle.getString("tiles.dispatchingToTile");
} catch (MissingResourceException e) {
message = "Dispatching to tile {0}";
synchronized(format) {
format.applyPattern(message);
message = format.format(new Object[] { tileName });
log.debug(message);
dispatchToTile(facesContext, viewToRender, tile);
else {
if (log.isDebugEnabled()) {
String message = null;
try {
message = bundle.getString("tiles.dispatchingToViewHandler");
} catch (MissingResourceException e) {
message = "Dispatching {0} to the default view handler";
synchronized(format) {
format.applyPattern(message);
message = format.format(new Object[] { viewId });
log.debug(message);
defaultViewHandler.renderView(facesContext, viewToRender);
private void dispatchToTile(FacesContext facesContext, UIViewRoot viewToRender, ComponentDefinition tile) throws java.io.IOException
ExternalContext externalContext = facesContext.getExternalContext();
Object request = externalContext.getRequest();
Object context = externalContext.getContext();
TilesContext tilesContext = TilesContextFactory.getInstance(context, request);
ComponentContext tileContext = ComponentContext.getContext(tilesContext);
if (tileContext == null) {
tileContext = new ComponentContext(tile.getAttributes());
ComponentContext.setContext(tileContext, tilesContext);
else
tileContext.addMissing(tile.getAttributes());
renderTile(facesContext, viewToRender, tile);
// dispatch to the tile's layout
//externalContext.dispatch(tile.getPath());
private void renderTile(FacesContext context, UIViewRoot viewToRender, ComponentDefinition tile) throws IOException, FacesException
// suppress rendering if "rendered" property on the component is
// false
if (!viewToRender.isRendered()) {
return;
ExternalContext extContext = context.getExternalContext();
ServletRequest request = (ServletRequest) extContext.getRequest();
ServletResponse response = (ServletResponse) extContext.getResponse();
try {
if (executePageToBuildView(context, viewToRender, tile)) {
response.flushBuffer();
//ApplicationAssociate.getInstance(extContext).responseRendered();
return;
} catch (IOException e) {
throw new FacesException(e);
// set up the ResponseWriter
RenderKitFactory renderFactory = (RenderKitFactory)
FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
RenderKit renderKit =
renderFactory.getRenderKit(context, viewToRender.getRenderKitId());
ResponseWriter oldWriter = context.getResponseWriter();
initBuffSize(context);
WriteBehindStringWriter strWriter =
new WriteBehindStringWriter(context, bufSize);
ResponseWriter newWriter;
if (null != oldWriter) {
newWriter = oldWriter.cloneWithWriter(strWriter);
} else {
newWriter = renderKit.createResponseWriter(strWriter, null,
request.getCharacterEncoding());
context.setResponseWriter(newWriter);
newWriter.startDocument();
doRenderView(context, viewToRender);
newWriter.endDocument();
// replace markers in the body content and write it to response.
ResponseWriter responseWriter;
if (null != oldWriter) {
responseWriter = oldWriter.cloneWithWriter(response.getWriter());
} else {
responseWriter = newWriter.cloneWithWriter(response.getWriter());
context.setResponseWriter(responseWriter);
strWriter.flushToWriter(responseWriter);
if (null != oldWriter) {
context.setResponseWriter(oldWriter);
// write any AFTER_VIEW_CONTENT to the response
writeAfterViewContent(extContext, response);
private boolean executePageToBuildView(FacesContext context, UIViewRoot viewToExecute, ComponentDefinition tile)
throws IOException {
if (null == context) {
String message = MessageUtils.getExceptionMessageString
(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context");
throw new NullPointerException(message);
if (null == viewToExecute) {
String message = MessageUtils.getExceptionMessageString
(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "viewToExecute");
throw new NullPointerException(message);
String mapping = Util.getFacesMapping(context);
String requestURI =
updateRequestURI(viewToExecute.getViewId(), mapping);
String requestURI =
updateRequestURI(tile.getPath(), mapping);
if (mapping.equals(requestURI)) {
// The request was to the FacesServlet only - no path info
// on some containers this causes a recursion in the
// RequestDispatcher and the request appears to hang.
// If this is detected, return status 404
HttpServletResponse response = (HttpServletResponse)
context.getExternalContext().getResponse();
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return true;
ExternalContext extContext = context.getExternalContext();
// update the JSTL locale attribute in request scope so that JSTL
// picks up the locale from viewRoot. This attribute must be updated
// before the JSTL setBundle tag is called because that is when the
// new LocalizationContext object is created based on the locale.
// PENDING: this only works for servlet based requests
if (extContext.getRequest()
instanceof ServletRequest) {
Config.set((ServletRequest)
extContext.getRequest(),
Config.FMT_LOCALE, context.getViewRoot().getLocale());
// save the original response
Object originalResponse = extContext.getResponse();
// replace the response with our wrapper
ViewHandlerResponseWrapper wrapped =
new ViewHandlerResponseWrapper(
(HttpServletResponse)extContext.getResponse());
extContext.setResponse(wrapped);
// build the view by executing the page
extContext.dispatch(requestURI);
// replace the original response
extContext.setResponse(originalResponse);
// Follow the JSTL 1.2 spec, section 7.4,
// on handling status codes on a forward
if (wrapped.getStatus() < 200 || wrapped.getStatus() > 299) {
// flush the contents of the wrapper to the response
// this is necessary as the user may be using a custom
// error page - this content should be propagated
wrapped.flushContentToWrappedResponse();
return true;
// Put the AFTER_VIEW_CONTENT into request scope
// temporarily
if (wrapped.isBytes()) {
extContext.getRequestMap().put(AFTER_VIEW_CONTENT,
wrapped.getBytes());
} else if (wrapped.isChars()) {
extContext.getRequestMap().put(AFTER_VIEW_CONTENT,
wrapped.getChars());
return false;
}You will also find you need to copy a few other methods from the Sun RI.
There were a couple of calls to ApplicationAssociate.responseRendered() which I just commented out as well (because they are not visible). They stop people changing the StateManager or ViewHandler after responses have been rendered. Probably not a problem since I will have replaced the ViewHandler anyway.
Steven
Maybe you are looking for
-
Macbook Pro keyboard and track pad freezes after a day or two of using bluetooth Magic Mouse
The first time this happened I thought my 3 y/old 17" Macbook Pro had died. The mouse cursor had frozen to the top left of the screen and the keyboard was also frozen and no matter what I did it didnt unfreeze. Even restarting. I searched extensively
-
Downloading photos from Itunes to Ipod Touch
Itunes says I have 311 pics to download to Ipod touch but only 177 pics will download. Why? I cleared all pics, then redownloaded, did the same thing. 279 pics in one folder. Is this too many? But if I selected all, it was trying to download 100
-
i am trying to import my libary onto a new computor, the file, my library that is, is in my music and in the itunes folder but it doesnt open up when l open itunes would appreciate some help with the import cheers
-
Macbook very slow when estimate time for indexing
Hello, Spotlight is often trying to index my macbook. I always see the message "estimate indexing time". I never see Spotlight actual indexing. When Spotlight is doing this, my macbook runs extremely slow. Spotlight is doing this once a day for at le
-
Hi! I have a question of variables in Analyzer. I have 2 Characteristics (Start date and End Date) and I created a restricted Key Figure that has a 0NET_VALUE and the restriction of 2 User exit variables that brings the data of 2 month forward for th