I am using Exadel-Fiji 1.0, Richfaces 3.3.3, Jboss 4.3 -EAP, Seam 2.1.0, JSF-1.2_09
When I try to render a exadel fiji line chart , the page just throws up a blank screen and
the firefox error console says
AC_FL_Runcontent is not defined
I found the solution.
I had the following code in my web.xml. I had to comment it out to get it working
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>NONE</param-value>
</context-param>
This script error is because one of the fiji related js file is missing in your jsf page. Please add the following script in your xhtml/jsf page to resolve this issue:
<script type="text/javascript" src="/[your-application-context-name]/a4j/g/3_3_1.CR1com/exadel/fiji/renderkit/html/AC_OETags.js.jsf" />
Before testing this in your application, please check that you are able to view Javascript with your browser using the following URL:
http://[url]:8080/[your-application-context-name]/a4j/g/3_3_1.CR1com/exadel/fiji/renderkit/html/AC_OETags.js.jsf
or
http://[url]:8080/your-application-context-name/a4j/g/3_3_1.CR1com/exadel/fiji/renderkit/html/AC_OETags.js
If you are able to see the script content in your browser, your problem has been resolved, and there will be no need to comment the web.xml changes.
Related
I've some unique problem, but I think this is not problem, I just want to optimize the url that my website have.
so I want to change all
index.html
on every folder as example
culture
folder, so normally if we want access
index.html
in culture folder we can just type
culture/index.html
right? but i want to access by just type
culture/
Is it possible to do that? If so, how we produce? I'm using jsf 2 as programming language.
Maybe I misunderstand your problem, but this can be done by configuring welcome files in the web.xml file:
Web Application developers can define an ordered list of partial URIs
called welcome files in the Web application deployment descriptor. The
purpose of this mechanism is to allow the deployer to specify an
ordered list of partial URIs for the container to use for appending to
URIs when there is a request for a URI that corresponds to a directory
entry in the WAR not mapped to a Web component. This feature can make
your site easier to use, because the user can type a URL without
giving a specific filename.
Note: Welcome files can be JSPs, static pages, or servlets.
Just:
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
I've tested this on WildFly 11 and it works, my project structure is:
+ WebContent
- index.xhtml
+ folder_a
- index.xhtml
+ folder_b
- index.html
+ folder_c
- other_name.xhtml
- some_name.html
When I enter:
http://localhost:8080/myproject/ I get a content from WebContent/index.xhtml
http://localhost:8080/myproject/folder_a I get a content from WebContent/folder_a/index.xhtml
http://localhost:8080/myproject/folder_b I get a content from WebContent/folder_b/index.html
Does the .xhtml file contain JSF content? is it parsed? I always
thought defining a jsf/facelets file as a welcome file did not work
and you needed http redirects via 'meta-inf'
.jsf' is that an extension I am using in myweb.xml` file:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
Please read answers for the below question to learn what it is:
JSF Facelets: Sometimes I see the URL is .jsf and sometimes .xhtml. Why?
What is the difference between creating JSF pages with .jsp or .xhtml or .jsf extension
JSF 2.0 does not have support for extensionless URL by default. This is a long waited feature for the community, but finally we got this with JSF 2.3 (released early 2017). If you care able to update your application to JSF 2.3, or maybe want some more information, please check it out here.
A brief example of how you can make the default JSF approach for extensionless URLs:
In the web.xml file, include each desired mapping using a tag inside the tag:
<url-pattern>/page1</url-pattern>
<url-pattern>/page2</url-pattern>
<url-pattern>/path/page1</url-pattern>
These patterns will redirect the user to the following paths respectively:
www.domain.com/page1 -> www.domain.com/page1.xhtml
www.domain.com/page2 -> www.domain.com/page2.xhtml
www.domain.com/path/page1 -> www.domain.com/path/page1.xhtml
Note that the above examples are not providing a way to redirect to the index.xhtml page, they are just a example of how the new JSF 2.3 mapping work.
However, if you can't update your project right now, I suggest you to follow #Kukeltje advice and take a look on the PrettyFaces library.
PrettyFaces is focused on provide a simple way to create URL mappings for older JSF versions. Heres a example of how it works:
In the pretty-config.xml file, include your desired mappings using a tag:
<url-mapping id="view-page">
<pattern value="/page" />
<view-id value="/page/index.xhtml" />
</url-mapping>
<url-mapping id="view-page-edit">
<pattern value="/page/#{id}" />
<view-id value="/page/edit.xhtml" />
</url-mapping>
These patterns would work like the following examples:
www.domain.com/page -> www.domain.com/page/index.xhtml
www.domain.com/page/2 -> www.domain.com/page/edit.xhtml?id=2
Both are good alternatives, PrettyFaces looks more powerful right now, since they are support this kind of solution for more time, but the JSF 2.3 should also do the trick.
Actually to overcome the issue of primefaces with fileuploader when STATE_SAVING_METHOD=client. I thought to make use of BalusC code as we use Servlet 3.0 posted here. The problem I am facing is when I click the submit button, I received an ajax partial reponse like this
<?xml version="1.0" encoding="UTF-8" ?>
<partial-response>
<changes>
<update id="javax.faces.ViewState">
<![CDATA[somejunk]]>
</update>
</changes>
<extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension>
It never calls the decode method in FileRenderer.java. If I remove the enctype, it was calling decode method and obviously failing to cast to MultipartRequest on line:
File file = ((MultipartRequest) context.getExternalContext().getRequest()).getFile(clientId);
Libraries:
PF 2.2.1
JSF 2.0.9
Though I switched from STATE_SAVING_METHOD=server to client. I forgot to remove the org.primefaces.webapp.filter.FileUploadFilter in my web.xml. So the Primefaces FileUploadFilter was responding with a partial ajax response everytime. I removed it and it is working fine now.
#BalusC, Thanks for your wonderful code!
Hi I have followed the setup guide at:
http://myfaces.apache.org/trinidad/installation.html
When I include the following code in my faces-config.xml file I get an error when I hit a page:
<application>
<default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
</application>
Start of Error:
java.lang.IllegalStateException: No RenderingContext
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeBegin(CoreRenderer.java:390)
at org.apache.myfaces.trinidadinternal.renderkit.htmlBasic.HtmlFormRenderer.encodeBegin(HtmlFormRenderer.java:56)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
When I remove that piece of code from my faces-config.xml file I can navigate my site as normal, but when I hit a page that has some sample Trinidad code nothing is displayed...just an empty page.
Any ideas on what I'm doing wrong?
I removed the following from my web.xml and its working now, any ideas? Confused :(
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
Thanks
I've actually discovered an excellent control for Richfaces that will provide the same functionailty. I'm going to go with this instead.
http://livedemo.exadel.com/richfaces-demo/richfaces/extendedDataTable.jsf?c=extendedDataTable&tab=usage
As BalsusC suggested, mixing different ajaxical component libraries might not be such a good idea.
Additionally, I have found the documentation and examples for Trinidad to be quite poor; Particularly in comparasion to Richfaces.
Would I be correct in thinking Trinidad is slowly dying?
I started a JSF project and included primefaces. But I have problems with the style. It doesn't look that nice than in the official showcase. But I have no idea why.
That's what I did so far:
I downloaded a style and extracted it into my project.
I added <link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/flick/skin.css" /> to my facelets template
I extended my web.xml with the following:
<context-param>
<param-name>primefaces.skin</param-name>
<param-value>none</param-value>
</context-param>
Unfortunately it loks like that:
fyi: That's a prime panel and a prime button :-/
can you pls help me :-)
cheers
Update:
Whatsoever I change in context-param. it doesn't work!
Do you need more information to help me solve that problem?
Thank you for help..
That's becuase you used none skin.
Look in Prime different skins to choose the right skin.
For example, if you would like Eggplant add:
<context-param>
<param-name>primefaces.skin</param-name>
<param-value>Eggplant</param-value>
</context-param>
I switched from myfaces to mojarra and now it works -.-
This question already has an answer here:
How can I remove HTML comments in my Facelets?
(1 answer)
Closed 8 years ago.
is it possible to embed comments in my .xhtml-files that are only displayed in the source and not the rendered result?
I want to include author, date,... in the files but they should not be visible to the enduser in the generated output. If I use the standard comment-tags <!-- --> the browser displays them.
Add the following into your web.xml:
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
This way Facelets will skip the comments while parsing the view xhtml template.
Invisible comments in JSF is a drawback, specially for beginers. I agree with answer of Mr Minchev. Anyway, I provide an alternative way to comment content in JSF consisting of using ui:remove
<ui:remove> This is a comment </ui:remove>
The UI Remove tag is used to specify tags or blocks of content that should be removed from your page by the Facelets view handler at compile time. This tag has no attributes. You can use this tag to indicate that a particular tag should be removed from the rendered page.
It's useful to remove content which is required during design time, but not during run time, such as comments, some stubbed content (e.g. "lorem ipsum") which aids in filling up the page content to fit the layout in visual designers such as Dreamweaver, etc.
See: Practical implications of Facelets ui:remove tag
Note that the Facelets compilation process is much faster than the JSP compilation process because no Java bytecode is actually generated and compiled behind the scenes when you first visit your page. The UI Remove tag is used to specify tags or blocks of content that should be removed from your page by the Facelets view handler at compile time. This tag has no attributes.
Examples of both comment options
Wrong, the right way is:
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
This work for me, javax.faces.FACELETS_SKIP_COMMENTS no!