I have a JSF(2.2.5) project using RichFaces(4.3.6) and PrimeFaces (5.0) with the following code
<h:panelGroup>
<a4j:region>
<h:form>
<a4j:poll id="poll" interval="15000" enabled="#{card.poll}"
reRender="swimlanes #parent" actionListener="#{card.reloadData}" />
</h:form>
</a4j:region>
<h:form>
<a4j:outputPanel id="swimlanes">
<h:panelGroup>
Stuff
</h:panelGroup>
</a4j:outputPanel>
</h:form>
</h:panelGroup>
Which is very similar to the example of the RichFaces page but when the poll becomes enabled I get the following error and no reRendering occurs
debug[09:41:56.298]: New request added to queue. Queue requestGroupingId changed to j_idt20:poll
debug[09:41:56.299]: Queue will wait 0ms before submit
debug[09:41:56.299]: richfaces.queue: will submit request NOW
info [09:41:56.302]: Received 'begin' event from <span id=j_idt20:poll ...>
info [09:41:57.310]: Received 'beforedomupdate' event from <span id=j_idt20:poll ...>
debug[09:41:57.312]: Server returned responseText: <partial-response id="j_id1"><changes><update id="j_idt20:poll"><![CDATA[<span style="display:none;" id="j_idt20:poll"><script type="text/javascript">new RichFaces.ui.Poll("j_idt20:poll",{"enabled":true,"interval":15000,"ontimer":function(event){RichFaces.ajax("j_idt20:poll",event,{"incId":"1"} )}} )</script></span>]]></update><update id="javax.faces.ViewState"><![CDATA[zl8Yr/2cJTwlpFZfrKzxi16KSE/7HTOE5e3ptnUnBJgIouLrdwKWDtUDlUWXx3gmmcCA9jCPG6jpktimoa1GPe4Icqn0EC/f4uetGoNQqAoieOT+2vVVDmQPQclPxvnaZU/3T+2fUyMU2YU5YF0C6/WrStC+UGJzhts1AIP0v6tZ2PHC5XqZhb1hpg6943W4/61rQBNNMRDYerzyipmtFkNLLQm5VtyfVqijlaQhzeP1QJeOqTDHtFAnBN78Ie6E3uGgufi8wX9jVeIXkkaI29OERWotflx2OKaJSakb/lWXMMjjU4NTejwT6IOLx2Mw5mstciSUCRMPzAbA19OK7uFh+Zun2CPRG27T3RH9je9C7iVwxjlZNXKuUhW/QlyPWoyZkhCpfp5Xxc+eruD/iAUZSJPPKQaM/OzEukNegOSeSaQJ1dLCPynuKBhrRDVyAvdR1UN2jT3G4VtK3P8YCv9p8OpwiDQAl3hUqPPrWxgR/4oIsj7Znfjp5uYZ1FDKVEHJSIYpc2tZpYFqEXr9tGjN0lqKcgrFhf3uOJAPw3PM1xhD0iBwucVYQLdT3EgCzrGLfiirzWktFwBJ5Wlo+sJLKBl02rXhV65CCqWgi9FlpzhrCMkyav0nUpF1bkXJXI0Di3jKESQnF2lWbsNN5886Aem81pu5C8tXGzK4mulnM70oTcqrBuLKBjV6sXbctKATOYNytKIQC5JOH/kt0SqU/AlAg29mVjUkBtOyW/MNKXQ3xkRf4eLDxD0KmAGfNtWRzGYSd/YBbIPERZlrRJuhQh02NugTqvsXdMhKEZmbOSU9HYOX7vbj8UzDeZiy+Kp86ZAUswZ7jbOlZOVlOPn4AJPBD51htiUtTi4zh8zbhKSOpHfvuVYqseHBKtgDi0pvPn/rNC36dbtD4sLLxFPLLinr3OGpTj4IxJRhXQvV8Sj4jUuGK3y6s2eISOU6bgsmcz8ZqLO8OnZVakVITsyqQ9Zs7OhhCks/5a2VMaKpKDKMCS9bwt3aHlK+vPogE6IngBRXCB9ow8fC6A8eLSWQanQGS3U0cqiRt8LL25vs9bDuUTaXdHpJZjOU9KqzsafAeaBdxfAidxigtvvgaMissfobFc+j3yQBcAuMEX9s1NQT3R7xuMLe7Ox62qatAAm1eJgbjezI6W6ZYO6xjL7BEHzUswaBy51hw0Ff5HRfulZrnHlzogIqcLTg+uRsRqHlXIZ3cEOXBOvG6EJChyP7eAYvwuQAEBWUjtHbJ85s5xuZUsCDMwawVwN7i7J7ToLdVfuNiAfDkhzmx8M50lkXY0+5NBT/sIROuZ2nJd3QuPpQ2+nC0KoqA4+SjDKIHpC7hVeZVYXV1NmA1uTXVE5BTMnJid+CPSv93t5rbHAOowr6BTqJGv0uKHlFTaGt7kxlWdGZgT8rqP4/f5OtrgaW7oWjbRClEyUlOMxQt0HW2LcmILLS5Vc8xNUGqjCNxC7P4hbnR3OuIMMnsMyoXZCxj++ftsrXpNtqOAE6APZv6ph8E5I2KSmNe3BJiVqjYoybbLbrfbaLcAr5uR3y53BZDyHOukm/KWzk/EfNTed7wlLvOzZ6RFKWIqycF24sXNj/9OHHAsT3U8+lWnSy3O+dC+Yk49oL8CG6pLzL3weP68ztFnbI/FqgpyVocDPRs/gvySPWNqidGJqkqArnKglDa7DeX/uL/Lf+hcvNvge8fv87/FEll6amlKvIc84YEr2JWtUsgpmr4rB1L7/HvihIyCcmZT3VoBpqzuixsGWt48mZFAcMJVPzbWbVmPu8eUitCfq94rQGU5jq7DeDT131wUHnl/T3Ylpx5pd2hd0zDClN53MnaeyAoH9u+rYaU2ilkWWn0uq9Elt7VCU1MdIHu+RNb14JwnRQNCuPrXXW7Oaz8UlTO1RIODuDLLP6oVJP9YGa3qP6U9Kws9du4iJ9LYEt5DNeZvzJSRTTYrY=]]></update><extension id="org.richfaces.extension"><render>j_idt20:poll</render></extension></changes></partial-response>
warn [09:41:57.318]: richfaces.queue: ajax submit error: During update: javax.faces.ViewState not found
debug[09:41:57.319]: richfaces.queue: Nothing to submit
error[09:41:57.320]: Received 'error#malformedXML' event from <span id=j_idt20:poll ...>
error[09:41:57.321]: [status=200] During update: javax.faces.ViewState not found
info [09:41:57.321]: Received 'complete' event from <span id=j_idt20:poll ...>
This is the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Agile Development Tools</display-name>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
Any idea how to fix this please?
It's a BUG in RichFaces 4.3.7 and earlier versions!
This Bug doesn't exist in RF Version 4.5 and 5.0
Related
When trying to logout my application I'm having the following error message :
com.sun.faces.context.FacesFileNotFoundException: /index.xhtml Not Found in ExternalContext as a Resource
To logout I'm going though the following steps inside PhaseListener.beforePhase(PhaseEvent phaseEvent) :
// Redirect to index.html
NavigationHandler nh = fctx.getApplication().getNavigationHandler();
String action_outcome = "/index.html";
nh.handleNavigation(fctx, null, action_outcome);
My web.xml is as follow :
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID"
version="3.0">
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>trinidad</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
I do not have index.xhtml in my app, but I do have and want to keep it index.html file.
Why is my outcome_action given to NavigationHandler rename to index.xhtml ?
How could I avoid it ?
The NavigationHandler expects a JSF page, not a non-JSF page. Moreover, you're there actually not sending a real redirect at all, on the contrary to what the code comment says there. You're just performing a forward here.
Performing a real redirect would be the solution to your problem. It's to be done as below:
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.redirect(ec.getRequestContextPath() + "/index.html");
See also:
What is the difference between redirect and navigation/forward and when to use what?
How to navigate in JSF? How to make URL reflect current page (and not previous one)
Unrelated to the concrete problem, doing authorization job in a phase listener stinks. Have you considered a servlet filter?
See also:
Limitations of using a PhaseListener instead of a Servlet Filter for authorization
Failing to redirect from JSF phaselistener
How to invalidate session in JSF 2.0?
With my files named to .xhtml and no redefinition of javax.faces.DEFAULT_SUFFIX in my web.xml, everything works properly.
But I would like to use the .html extension as I write html5 and not xhtml.
Here is my web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.html</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
</web-app>
When I visit contextname/ I would expect to fall on the same page than contextname/index.jsf as it is the first of my welcome file list but instead index.html file is used and I see the template code, as I would expect by visiting contextname/index.html.
When I try to visit contextname/index.jsf there is a very long load, around 10 seconds and the page ends up blank.
Once again, without the parameter and with my file renamed to index.xhtml everything works fine.
I'm in the middle of learning Java EE with Trinidad but ran into some problem. The Trinidad 2.x examples use JSPX while their old demo site use pure JSF (XHTML). When I try to write the a test page using Facelets in XHTML, I kept getting java.lang.stackoverflowerror. I'm not sure if it's a configuration issue or a syntax error.
I'm using Glassfish V3, MySQL 5.6, JSF 2.1 (Apache MyFace) , Apache Trinidad 2.0. And I follow most of this guide: http://jianmingli.com/wp/?p=3813
Stack Trace I omitted the rest of the log because it's too long
java.lang.StackOverflowError
at java.net.URLStreamHandler.equals(URLStreamHandler.java:331)
at java.net.URL.equals(URL.java:862)
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:995)
at com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:95)
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>jsf2.myfaces2.trinidad2.one</display-name>
<!-- ================= JSF Settings ================= -->
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mappings -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<!-- resource loader servlet -->
<servlet>
<servlet-name>resources</servlet-name>
<servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
</servlet>
<!-- Important: You must include this adf mapping even though you are not
using ADF features. Without this mapping, JSF navigation will fail! -->
<servlet-mapping>
<servlet-name>resources</servlet-name>
<url-pattern>/adf/*</url-pattern>
</servlet-mapping>
<!-- setting the project stage to be DEVELOPMENT -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Use client-side state saving. In Trinidad, it is an optimized, token-based
mechanism that is almost always a better choice than the standard JSF server-side
state saving. -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
<!--param-value> server</param-value -->
</context-param>
<!-- ================= Trinidad Settings ================= -->
<context-param>
<param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE</param-name>
<param-value>session</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value></param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
<!-- TrinidadFaceletViewHander must be the alternate view handler if SessionChangeManager
is used -->
<param-value>org.apache.myfaces.trinidadinternal.facelets.TrinidadFaceletViewHandler</param-value>
</context-param>
<context-param>
<!--Unfortunately, Facelets provides no hook for plugging the PageResolver
into the logic handling "facelets.VIEW_MAPPINGS". You should leave "facelets.VIEW_MAPPINGS"
unset and use "org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS" instead. -->
<param-name>org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
<filter>
<filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>trinidad</filter-name>
<servlet-name>faces</servlet-name>
</filter-mapping>
</web-app>
index.xhtml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad">
<ui:composition template="" >
<tr:table value="#{userTable.userList}" var="row">
<tr:column>
<f:facet name="header">
<tr:outputText value="User Name" />
</f:facet>
<tr:outputText value="#{row.username}" />
</tr:column>
<tr:column>
<f:facet name="header">
<tr:outputText value="Password" />
</f:facet>
<tr:outputText value="#{row.password}" />
</tr:column>
</tr:table>
</ui:composition>
</html>
index.jspx This works when I configure the "javax.faces.FACELETS_VIEW_MAPPINGS" to *.jspx and omit the Trinidad Facelets specific configuration in web.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad">
<f:view>
<tr:document>
<tr:table value="#{userTable.userList}" var="row">
<tr:column>
<f:facet name="header">
<tr:outputText value="User Name" />
</f:facet>
<tr:outputText value="#{row.username}" />
</tr:column>
<tr:column>
<f:facet name="header">
<tr:outputText value="Password" />
</f:facet>
<tr:outputText value="#{row.password}" />
</tr:column>
</tr:table>
</tr:document>
</f:view>
</jsp:root>
The problem is fixed and I believe the ui:composition template="" was the cause of the StackOverFlowError. Once I removed the template="" bit, it worked. In addition, I came across the following in Apache Trinidad's mail archive regarding configuring web.xml for Trinidad 2.0 and Facelet:
You do not need to have an entry for ALTERNATE_VIEW_HANDLER with Trinidad 2.0.
You are getting the error because Trinidad is not yet compatible with
partial state saving in JSF 2.0.
Since partial state saving is enabled by default when Facelets are used,
you need to explicitly disable it.
Add the following context parameter in web.xml:
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
Link to Apache Trinidad mail post
Trinidad appears to cause a StackOverflowError when you use a relative path to a template in Faceletes. In your case, removing the extraneous template="" attribute from ui:component fixed the issue. In my case, I was actually using templates in my view, so I could not remove the attribute. Instead, I was able to work around the issue by using the absolute path to the template view.
For example, with the following view structure:
/views/template.xhtml
/view/index.xhtml
In index.xhtml, providing a relative path to template.xhtml causes a StackOverflowError:
<f:view
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:include src="template.xhtml" />
</f:view>
Changing to the absolute path of /views/template.xhtml fixes the StackOverflowError:
<f:view
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:include src="/views/template.xhtml" />
</f:view>
This question already has an answer here:
JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output
(1 answer)
Closed 6 years ago.
I am testing the application "jsf-blank" from coreservlets site in order to understand how jsf works but my browser doesn't show the content of the xhtml page.
I use Tomcat 6 and Eclipse Indigo.
Have you any idea why the page is blank in my browser ?
Thank you for your help.
Thank you but it doesn't work with jsp directive and this is the content of my web.xml :
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
Last update :
I tried your solutions but I have the same problem, jsf tags aren't rendered by browser (I am a newbie in JSF).
My test is very simple :
web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
index.xhtml :
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title><h:outputText value="First JSF Application" /></title>
</h:head>
<h:body>
<h:outputText value="Test" />
</h:body>
</html>
Context name : jsf-blank
I test with url : http://localhost:8080/jsf-blank/index.xhtml
Result : blank page
Last update :
Thank you, my problem is solved, I think the origin of problem was rich-faces 3.3 jars in my tomcat's folder shared/lib.
I removed these jars and now it's working, do you know why it's a problem ?
That can happen when you have sent a request whose URL does not match the URL pattern of the FacesServlet which in turn causes that the JSF works won't run at all. According to the URL pattern of your servlet mapping, you have to request your XHTML page with .jsf extension. Imagine that you've an index.xhtml, then you'd need to invoke it by http://localhost:8080/contextname/index.jsf.
I however recommend to just replace the *.jsf URL pattern by *.xhtml so that you never need to worry about and fiddle with suffixes. Change your web.xml as follows:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
And open the page by http://localhost:8080/contextname/index.xhtml.
Basically, MyFaces' JSF 2 implementation is returning blank pages whenever there's any error on either a configuration file or whatever. Worse yet, the errors aren't being sent to the log, either. Use Mojarra (Oracle's JSF 2 implementation) instead, and you'll start getting clear error messages.
RichFaces has it's own configs in web.xml (RichFaces Filter etc.), so if you don't want to use it, you should remove the library because you're not applying any suitable configuration for it, in order to trigger it properly.
I reviewed the example of tiles with struts2.0 and found that in tiles.xml jsp pages are called like:
<definition name="welcome" extends="baseLayout">
<put-attribute name="title" value="Welcome"/>
<put-attribute name="body" value="/welcome.jsp"/>
BUT my question is if I want to call the action class instead of .jsp pages than how to call it like
<definition name="friends" extends="baseLayout">
<put-attribute name="title" value="Friends"/>
<put-attribute name="body" value="/checkActionLink.action"/>
when I am trying to write to execute the above code than its showing the error that checkActionLink.action is not found....thanks in advance for the help.....
Following is the web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Struts2Example15</display-name>
<servlet>
<servlet-name>tiles</servlet-name>
<servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
<init-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
After so much research I found out that adding the following tag:
<dispatcher>FORWARD</dispatcher> in the web.xml the issue gets resolved.
Now the question arises why?
As per my understanding when we add any action as the value of value attribute of the <put-attribute/> tag the request is forwarded to the mentioned action so the action is executed successfully.
Previously <dispatcher>FORWARD</dispatcher> tag was missing so this issue was caused.
I would really appreciate if any correction is there in my understanding.
Thanks. Happy Coding :).
I don't think you can. You'll need to create a jsp and use the struts2 action tag in it. That can call an action and render part of it's page. If you make a jsp only using the action tag, you'll probably get the effect you want. Have never tried this, but you can probably insert the name of the action and namespace from tiles into the action tag before the jsp is invoked.
I would be very interested to hear how this works out for you.