After moving from 14.04 to 16.04 a project is no longer working. <fr:xforms-inspector /> conflicts with the <script></script> in the *.xsl-file. See code below.
( Ubuntu 16.04 / tomcat8 / Orbeon Forms 2016.3.201612302139 / firefox )
Questions
Why is the <fr:xforms-inspector /> suddenly conflicting with this tag?
Why not in 14.04. Is this a bug, which needed to be reported, or is this my error, that this is no longer working?
Is there a way to solve it?
Has it something to do with: https://doc.orbeon.com/xforms/actions/scripting.html that this way is a deprecated?
blubb.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
>
<head>
<title>Blubb</title>
<xf:model>
<xf:instance id="instance_stylesheet" src="blubb.xsl" />
</xf:model>
</head>
<body>
<fr:xforms-inspector />
</body></html>
blubb.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" omit-xml-declaration="yes" encoding="UTF-8"/>
<xsl:template>
<html>
<!-- inserting the script tag, results in the error.
It does not matter, whats in it. -->
<script>
</script>
<head></head>
<body></body>
</html>
</xsl:template>
</xsl:stylesheet>
Below the webpage created by orbeon from the files. The inspector has no code view and those \n belong to it too. Every other behavior is also effected randomly.
This issue is fixed since Orbeon Forms 2017.1, so if you're hitting this problem and using an earlier version, I'd recommend you upgrade to 2017.1.
Related
How can I make JSF send http header
Content-Type: application/xhtml+xml;charset=UTF-8 instead of current
Content-Type: text/html;charset=UTF-8?
Adding following snippet in web.xml had no effect.
<mime-mapping>
<extension>xhtml</extension>
<mime-type>application/xhtml+xml</mime-type>
</mime-mapping>
My sample file webapp/sample.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:view>
<h:outputLabel value="Hello, world"/>
</f:view>
</html>
Environment:
JSF 2.2, WildFly 8.2
You can set it in <f:view> as below:
<f:view contentType="application/xhtml+xml">
However, this is the wrong value for HTML. JSF/XHTML generates HTML output which should really have text/html content type. Explanation can be found in the answer to When to use f:view and f:subview, particularly in the "See also" links in that answer.
in my umbraco setting, i dont have any image logo to upload my image that was saved in my Media folder, only insert umbraco page field and insert umbraco macro logo was there.I tried many links but it was unsuccessful.im using umbraco V3.0.5
If I understand you correctly, you're modifying a template (you have access to insert field and insert macro) and you want to add an image that is saved in your media section.
Are you really using Umbraco 3 - that is a few years old now and the syntax is very different and you will probably need to use xslt; for example inserting a macro will look different on your template for v3 and v4 (v5 has been deprecated and v6 is not live yet).
(http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax)
Umbraco Version 3:
<?UMBRACO_MACRO macroAlias="RenderProperties" pageValue="[#bodyText]" />
Umbraco Version 4:
<umbraco:macro alias="RenderProperties" pagevalue="[#bodyText]" runat="server"/>
In the older versions of umbraco putting an image onto a page from media required writing some xslt and referring to it in a macro - this example (that I've dredged up) would display the image that was picked for a page with an alias of 'imageAliasName'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:umbraco.contour="urn:umbraco.contour" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour PS.XSLTsearch ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="mediaId" select="number($currentPage/imageAliasName)" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img>
<xsl:attribute name="src">
<xsl:text>/ImageGen.ashx?image=</xsl:text>
<xsl:value-of select="$mediaNode/umbracoFile"/>
<xsl:text>&width=200</xsl:text>
<xsl:text>&height=200</xsl:text>
</xsl:attribute>
</img>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
in V3 i insert that image in to one of my content file from there i can view the id for my image..using that id image to write my code in my setting..when i write my image logo was viewed successful.
I have a Primefaces+JSF web site whose home page is
localhost:81/Mywebapp/login.jsf
I want to redirect the user to that home page if he goes to: localhost:81/Mywebapp/ so he doesnt need to write the complete URL.
How can I do that? I suppose it is some configuration in JBoss
Any help? thanks
Actually it should be in your web.xmlfile, try to put to it's end this entry
<welcome-file-list>
<welcome-file>/login.jsf</welcome-file>
</welcome-file-list>
EDIT
I also solved this once by making a new index.jsp like this
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!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>
<jsp:forward page="/login.jsf" />
</body>
</html>
Or put there a html file with this meta
<meta http-equiv="Refresh" content= "0; URL=login.jsf"/>
and set one of them as your welcome file. One of these solutions should do the job for you:-)
Sorry for the second answer, the formatting in the comments doesn't really cut it:
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
...
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
...
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>subdir/*</url-pattern>
</servlet-mapping>
Peter's answer should work just fine, but if you're really concerned about the extensions (it doesn't really matter) then just add the places you want mapped under the servlet. This maps *.xhtml, *.jsf and anything under 'subdir/'.
If you had a hard file:
- index.xhtml
Myapp/index.xhtml and
Myapp/index.jsf
would map to the same file. xhtml is since your default suffix is xhtml
I hope this helps, honestly, with Primefaces 2 I'd definitely be using xhtml as that's the spec. With 3 it doesn't matter as much, but I still stay with xhtml as it isn't something I'd normally have on my server.
Best of luck (Petr's forwarding trick isn't a bad idea--it can really help in tough situations)
You can always do this with URL rewriting engines like PrettyFaces. You have to activate it in your web.xml and then define rewriting rules like this:
<url-mapping id="login">
<pattern value="/login" />
<view-id value="/legacy/user/login.xhtml" />
</url-mapping>
Because you mentioned explicitly login.jsf I think it's a good idea to think about including a security framework which is doing this (and many other things) for you. Seam security provides typesafe annotations for this:
#ViewConfig
public interface SeamPages
{
static enum Pages0
{
#ViewPattern("/jsf/admin/important.xhtml")
#UrlMapping(pattern="/admin/important")
#LoginView("/jsf/access/loginRequired.xhtml")
#AccessDeniedView("/jsf/access/accessDenied.xhtml")
#RestrictAtPhase(PhaseIdType.RESTORE_VIEW)
#LoggedIn
ENUM0;
}
}
This will solve three common requirements:
The URL /yourApp/admin/important will be redirected to the JSF page /jsf/admin/important.xhtml.
If the user is not #LoggedIn he will be redirect to /jsf/access/loginRequired.xhtml
IF the user does not have the rights to access the page he will be redirected to /jsf/access/accessDenied.xhtml
I have some problems with the default URL that jsf shows:
The url is displayed like this:
www.URL.com/PROYECT_NAME/
And I want something like this
www.URL.com/PROYECT_NAME/home
I sent up the welcome file like this.
<welcome-file-list>
<welcome-file >faces/views/home.xhtml</welcome-file>
</welcome-file-list>
So what I really want is that when jsf shows the welcome file show and url like this www.URL.com/PROYECT_NAME/home or the complete route faces/views/home.xhtml.
I know is a dumb question but Im stock in it
It is possible to achieve that using a filter-based servlet extension like PrettyFaces.
It is simple to use, has good documentation and examples, but to illustrate your case you could do something like this:
Download prettyfaces.jar and add to your classpath. Usually /WEB-INF/lib folder.
Add a pretty-config.xml file containing the URL mappings to the /WEB-INF folder.
Example of pretty-config.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.3 http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd">
<url-mapping id="home">
<pattern value="/home" />
<view-id value="/home.xhtml" />
</url-mapping>
</pretty-config>
To redirect to this mapping from a controller you should use a string like pretty: + url-mapping-id.
Example of controller bean:
#ManagedBean
#ViewScoped
public class HomeBean
{
public String goHome()
{
return "pretty:home";
}
}
That's it. Whenever you fire a request, if PrettyFaces filter finds the url mapping pattern /home it will display the view id home.xhtml but keep the URL as /home. Pretty.
Also, as a suggestion, for your welcome-file-list you could add only index.html.
Example of web.xml welcome-file-list tag:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
And add an index.html file like this to your application root folder.
Example of index.html file:
<!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">
<head>
<title>My Application</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;url=/myapplication/home" />
</head>
<body>
<h3>Loading...</h3>
</body>
</html>
By doing this, whenever someone requests your application it will get a fast loading page and will be redirected to /home.
I hope it helps.
I'm trying to create a custom composite component taglib in my office but i get a strange issue with EL. It seems expressions as #{cc.attrs.[var] } are already resolve as empty.
I try to create my taglib in a jar. In my jar i have my files ordered as following:
|_ /
.....|_ META-INF
..........|_ compo.taglib.xml
..........|_ resources
...............|_ components
....................|_ hello.xhtml
compo.taglib.xml contains:
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://www.example.com/jsf/compo</namespace>
<composite-library-name>compo</composite-library-name>
<tag>
<tag-name>hello</tag-name>
<source>./components/hello.xhtml</source>
</tag>
</facelet-taglib>
hello.xhtml contains:
<?xml version="1.0" encoding="UTF-8"?>
<!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:composite="http://java.sun.com/jsf/composite">
<composite:interface name="hello" displayName="hello">
<composite:attribute name="name" required="true" type="String"/>
</composite:interface>
<composite:implementation >
hello #{cc.attrs.name}!
</composite:implementation>
</html>
My web project contains in WEB-INF lib my taglib as a jar, jsf-impl.jar and jsf-api.jar (from Mojarra) my page is simply that:
<?xml version="1.0" encoding="UTF-8"?>
<!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:comp="http://www.example.com/jsf/compo" >
<body>
<comp:hello name="John"></comp:hello>
</body>
</html>
At rendering i see "hello !" but not "hello John!". Attributes values seems be lost somewhere. I try this sample on tomcat 6.0.29 and Websphere 7.
I made something wrong?
Have you tested your control in web application rather than from taglib (jar file)?
I can only guess but I think your attribute is not showing because you named it name. In some cases "name" attribute is beeing used by JSF (for example in f:attribute or f:param or even ui:param uses attribute name). Try to replace attribute name with oder word.
You need to look here and check if attribute name is available.
Yes this case appears also with other attributes.
I tried with the component in web application and issue doesn't appear.
I also tried with the component in a jar with default namespace: issue doesn't appear. I think there is bug when using composite component in a jar with custom namespace.