Let we have Facelet 1.xhtml. This facelet contains following line
xmlns:h="http://xmlns.jcp.org/jsf/html"
What "http://xmlns.jcp.org/jsf/html" does mean? If we dont internet accesing application will work anyway.
Its a XML namespace. In your case, you are defining a XML namespace prefix h with a URI of http://xmlns.jcp.org/jsf/html. The URI is just a way of uniquely naming the namespace, the parser wont load it, so to answer you question. No. You do not need internet :)
http://en.wikipedia.org/wiki/XML_namespace
Related
I am using Tapestry 5.2.6, and I am trying to get rid of shape attributes on tags.
Tapestry generates tag like this :
<a shape="rect"...>
I can't find anything online so if you have any idea how to ?
Thank you.
This problem was reported in Tapestry's JIRA and resolved in Tapestry 5.3.5. The offender was the SAX parser used, which automatically appends default values defined for HTML attributes in the DTD used. A check was then introduced in org.apache.tapestry5.internal.services.XMLTokenStream class to "filter out attributes that are not present in the XML input stream, but were instead provided by DTD defaulting".
See the corresponding ticket for more details: https://issues.apache.org/jira/browse/TAP5-1976.
Unfortunately, in your case, there is no clean solution to fix that (assuming you have to work with Tapestry 5.2.6). The only way would be to make your own patch or fork of Tapestry 5.2.6 to report the correction...
I have a XSL/XML parser to produce jsp/html code.
Using MVC model I need to accees spring library in order to perform i18n translation.
Thus, given the xml
<a>
...
<country>EN</country>
...
</a>
and using <spring:message code="table_country_code.EN"/> tag, choose based on the browser language, the transalation into England, Inglaterra, etc...
However, the XSL do not support <spring:message> tag.
The idea is to have a XSLT with something like this
<spring:message code="table_country_code.><xsl:value-of select="country"/>"/>`
to have the final code <spring:message code="table_country_code.EN"/> and be recognized in the final JSP/HTML based on i18n translation.
I also tried to create the spring tag in Java when I make a parse to create the XML but I sill have the same error.
The prefix "spring" for element "spring:message" is not bound.
[EDIT]
I saw some questions here, like using bean:spring but still have the same problem.
any pointers?
XSLT has to be namespace well formed XML, so you need to declare the namespace and you can not use < in attribute values.
Spring 3 - Accessing messages.properties in jsp
suggests the namespace should be
http://www.springframework.org/tags
so presumably you want an XSLT code of
<spring:message
xmlns:spring="http://www.springframework.org/tags"
code="table_country_code.{country}"
/>
where {} is an attribute value template that evaluates the XPath country
I'm using the DOM library for JAVA and some entries XHTML encounter this problem:
[Fatal Error] tree.xml:238:185: Attribute "itemprop" was already specified for element "span".
This is the XHTML part with problems:
<span class='fn' itemprop='author' itemscope='itemscope' itemtype='http://schema.org/Person' itemprop='name'>Rodrigo</span>
Exists some option to allow duplicate attributes in DOM?
Thanks!
My understanding is that the Microdata specification only allows one itemprop per HTML element, meaning that the DOM library you're using is properly marking it as invalid markup. If you want to specify multiple values, they need to be space-separated, like this:
<span class='fn' itemprop='author name' itemscope='itemscope' itemtype='http://schema.org/Person'>Rodrigo</span>
Incidentally, the class attribute works the same way.
I know the performance difference between the following two
Include directive (<%# include file="test.jsp" %>): This includes the contents of the file during the compilation phase—i.e., when the page is converted to a servlet.
Include action (<jsp:include page="test.jsp" flush="true" />): This includes the contents of the file in the run-time—i.e., when a request is made for the page by the user.
But what about JSTL tag <c:import url="child.jsp" />
is the content included during the compilation phase or run-time?
Thanks!
It is included at runtime. And you can put an absolute URL there (you can include html from 3rd party sites)
If you're talking about the <jsp:include /> tag it include a jsp a runtime. In this way you can use it recursively.
About the c:include...is a tag so (I think) it's a runtime phase...
By default with c:import, the content of an imported resource is included inline into the JSP page at runtime. Although, it is also possible to access the resource a String object or a Reader object.
The URL could be absolute (any outside web app) or relative (to the context)
HTH
I'm trying to write a trivial JSP that returns the contents of a static xml file. I need to run this in tomcat. Eventually, this will be more dynamic, but at first, I just want to return an xml file. Can anyone point me to a demo for such a trivial beast, I'm trying to learn what are the minimum chunks I need to create the web app and install in tomcat.
Mucho appreciato,
pawpaw17
Following this document is always a good start.
But you may have issues.
First, it's basically trivial to do something like:
http://example.com/app/mydynamicxml.jsp
that returns an XML blob. Just paste the XML in to that file.
But it won't have an XML content type. You can fix that by adding directives to the JSP:
<%#page contentType="application/xml" %>
However, that brings on MORE problems.
Specifically, an XML file CAN NOT start with white space. It MUST start with <?.
That directive will very likely insert a blank line in to you XML file.
So, what you really want is:
<%#page contentType="application/xml" %><?xml version...
Finally, there IS a JSPX version of JSP, which uses an XML syntax, and avoids all of those white space issues. There's also a directive to Tomcat that can eliminate the white space issue. But, out the gate, this is the fastest, "obvious" tact to take.
The main thing would be to specify the content type as <%# page contentType="text/xml" %>
<%-- Set the content type
--%><%# page contentType="text/xml" %><%--
--%><?xml version="1.0" encoding="UTF-8"?>
<root><entry key="key1" value="value1" /><entry key="key2" /></root>
Check out the article on Sun site
Tried adding a trimDirectiveWhitespaces="true" page directive, but that wasn't supported on my server.
The solution was simply to remove any newlines after any page directives.