File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF and Safari Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "JSF and Safari" Watch "JSF and Safari" New topic
Author

JSF and Safari

Carlos Conti
Ranch Hand

Joined: Apr 21, 2010
Posts: 89
Hi there,

I am working on an application which output works perfectly as expected in IE,Chrome and Moz. However when trying in Safari, it doesn't.

The problem rendered in screen is:

"error on line 3 at column 2: XML declaration allowed only at the start of the document."

In order to investigate the problem I watched the outputted source code of the page which starts like:



So I guess Safari is complaining because I have several <?xml /> declarations at the start of the document. But that comes as a result of using facelets and having that declaration at the start of each facelet file. If I remove it, I get another bunch of problems regarding facelet paths (I presume the whole thing is processed differently).

Is there anyway to solve this? i.e. render the xml declaration only once for Safari not to complain?

Any other solution?

Any help is greatly appreciated.

Best regards,

Carlos.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

Actually, I'm surprised that only [b]Safari[/b complained.

If you're getting the XML introductory PI rendered at all on your output pages, then the most likely reason is that you're not actually going through the Facelets processor and you need to check your configuration for Facelets and the FacesServlet in web.xml.

A less-likely cause would be from using the wrong Facelets component inclusion tag, but my money is on mis-configured Facelets in web.xml


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
Carlos Conti
Ranch Hand

Joined: Apr 21, 2010
Posts: 89
Many thanks for your quick answer Tim.

But in case of a misconfiguration of the Facelets servlet, shouln't the whole application be failing in the other navigators? If that was the case I shouln't be getting anypiece anywhere to work.

Now I am not sitting in front of my dev computer and am not able to post the exact piece from web.xml where facelets is settled. However it is very strange to get problems there when IE, Chrome and Mozilla work smoothly.

I presume this must lie in anyother setting. And from the type of error, I presume no matter what I would do, facelets wouldn't work in Safari.

I am using IceFaces 2.1(beta) and JSF 2.0 (is there a 2.1??... I think there's not).

To complete the answer, the facelets tags I use are the most common:

<ui:composition />
<ui:define />
<ui:decorate />
<ui:include />
<ui:insert />

I think that's all.

Thanks and regards,

Carlos.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

The problem with bad copies of JSF resources is that if a URL doesn't match, it will be passed to the default servlet and copied out verbatim. Which usually has other problems as well. In addition to simply not having the right URL patterns, people can also experience problems when they confuse the URL path for the resource path. That is, coding "foo.xhtml" where they should have coded "foo.jsf" (assuming commonly-used web.xml settings).

When using inclusive constructs like the "jsp:include" tag or Facelets inclusive resources, it's important to RTFM, since some use the URL and some use the resource path.

Also, Facelets has something like 5 different ways (give or take) to "copy" stuff, so in addition to all of the above, it's also important to make sure you use the appropriate one, since some copy only selected items from WITHIN the included resources, but others copy the ENTIRE resource. Theoretically, that would NOT include the XML header, but you can never be sure.
Carlos Conti
Ranch Hand

Joined: Apr 21, 2010
Posts: 89
Hi tim,

I happen to suddenly rwmember that the very same approach worked with icefaces 1.8, and since now i am trying the new version with the release 2.1(beta) it is very likely that something has been missed regarding the xml predefinition, against which only safari complaints.

I believe the explanation you have provided in your last message is a bit further my skills nowadays. What do you mean with "RTFM"? I am using a beta version but the build should be fairly ok since as i said it works everywhere with the exception of safari. Resources if any are well defined then they are shown in the other navigators. Don't understand realy well what you mean.

Perhaps i should address the issue directly in the icefaces forum, since i believe that regarding sfari something is not well done in the beta build.

Thanks again.

Carlos.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

Oh, I love these little after-the-fact revelations. IceFaces, eh?

In that case, yes, definitely check with them. When you use an AJAX-enabled upload JSF component, all bets are off. It's entirely possible that on Safari, the JavaScript code that's doing the upload doesn't work quite right. So that's not a Tomcat problem, a J2EE problem, an HTML problem, or even (technically) an OS/browser problem. It's a JavaScript problem, and JavaScript, in my humble opinion, was invented to cause problems. With a little help from Microsoft, of course.

I thought the term "RTFM" had achieved international status, or I wouldn't have used it. We do try and make allowances for people whose native language is other than English. Literally, it's an acronym for "Read The Manual" and was originally coined by "flamers" as an abuse for people who hadn't bothered to read the basic instructions on how to use whatever they were asking about. However, I never read the fool manual myself, if I can avoid it - got too many freaking manuals already. So I use the term more as a denigration of the manual itself.
 
 
subject: JSF and Safari
 
Threads others viewed
First Cup: Java EE Tutorial
Is this a facelets?
!DOCTYPE and function refreshIt() not working together
JSF tags at translated at runtime
!DOCTYPE and function refreshIt() not working together
IntelliJ Java IDE