Home » Eclipse Projects » JavaServer Faces » UnsupportedOperationException(Running my first JSF project: A blank jsp page in eclipse platform throwing exception :()
| |
Re: UnsupportedOperationException [message #755006 is a reply to message #755004] |
Sun, 06 November 2011 16:37 |
|
On 2011.11.06 9:00, butny wrote:
> Hi,
>
> I solved the problem by removing the jsf-impl and jsf-api jars from my
> workspace. With this another problem arises:
>
> When i run this code:
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> <title>Insert title here</title>
> </head>
> <body>
> <f:view>
> <h:outputText value="Hello" />
> </f:view>
> </body>
> </html>
>
> Nothing is displayed in the webpage. No exception is thrown at the console.
>
> When i run this code:
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> <title>Insert title here</title>
> </head>
> <body>
> <f:view>
> Hello
> <h:outputText value="Hello" />
> </f:view>
> </body>
> </html>
>
> Then only one hello is displayed.
> Right click the webpage---> view source displays this:
>
> <?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:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> <title>Insert title here</title>
> </head>
> <body>
> <f:view>
> <h:outputText value="Hello" />
> </f:view>
> </body>
> </html>
>
> This means the jsf tags are not rendered properly at runtime.
>
> Please help me out of this.
>
> Thanks,
> Butny
Have you tried following the JSF tutorial at vogella.de? Lars' tutorials
are the best.
At the risk of confusing you, I did some research on JSF and Facelets
you're welcome to. I'm a back-end guy and don't use JSF, but I've tried
mastering it. If interested, look at http://www.javahotchocolate.com/.
Look under the "Other tutorials" menu.
|
|
| |
Re: UnsupportedOperationException [message #755122 is a reply to message #755046] |
Mon, 07 November 2011 13:20 |
|
On 2011.11.07 0:57, butny wrote:
> Hi,
>
> Thanks for the reply. I removed the jstl-api and jstl-impl since i had
> the myfaces-api.jar and myfaces-impl.jar. But this link:
>
> http://www.javahotchocolate.com/tutorials/jsf-notes.html
>
> reveals that if i use all the jstl-api,jstl-impl,myfaces-api and
> myfaces-impl jars together then it should not cause any problem, hence i
> need not to remove the jstl-api and jstl-impl jars.
>
> Then how to solve the problem i am facing? Adding the jstl-api and
> jstl-impl jars will throw an UnsupportedOperationException exception.
>
> Please help me out of it.
>
> Thanks,
> Butny
The greatest challenge for me in doing JSF was to get the libraries just
right. This is why I wrote so many articles studying it. The article you
reference isn't an article, but a list of totally random notes I was
collecting early on, some of which may be completely wrong.
Better articles were the ones on RichFaces.
This website is a place where I keep my notes which I try to sanitize so
that they're useful, again, mostly for myself, but also for others if
they care.
Someone else more knowledgeable may come along and help you.
|
|
| | | |
Re: UnsupportedOperationException [message #755211 is a reply to message #755171] |
Mon, 07 November 2011 16:39 |
|
On 07-Nov-11 08:35, butny wrote:
> Hi,
>
> I believe that you can help me out sir, nobody even replied to my
thread at least which you did
>
> Please have a look at the attachments displaying the jars i am using.
i am sure there is some version problem with the jars which i am unable
to sort out.
>
> Please provide some useful suggestions, i am breaking my head since
last few days for this. When i run the page, the jsf tags are not
getting rendered, but i am not getting any exception in my console as well.
>
> Thanks,
> butny
My suggestion is to abandon MyFaces in favor of RichFaces. Use the
following articles to guide your work and pay especially close attention
to the libraries used:
http://www.javahotchocolate.com/tutorials/wtp-jsf.html (makes use of
another author's tutorial)
http://www.javahotchocolate.com/tutorials/richfaces.html
At the end of the article, there's a list of JAR downloads. What's
gotten more difficult is that Oracle's purchase of Sun has made getting
some JARs more difficult. That appendix should help with this.
There are also two tarballs at the end of the "Usefule links" appendix
you could download that are projects from my own workspaces. Setting
them up and playing with them will help you figure some things out
(you'll have to add the indicated JARs in by hand since they're not in
the projects).
This undertaking is not painless; I know first-hand. Unfortunately, I
don't have time to do quite the job Lars did with his tutorial. I did
enough to get a lot of stuff working and I know I can go back if I ever
need to and get it all working again. But, I think my information will
help you cut the months I spent off and on figuring this stuff out down
to a few hours or days.
Sorry it's not easier. Based on what you've written so far, I don't
think, however, that you've invested much time in working tutorials,
especially the one I suggested from vogella.de, or in reading my
articles closely or you wouldn't ask this question. I specifically
discuss the problem it is to find JARs that inter-cooperate and display
throughout the articles on JSF and Facelets several working sets that
accomplish this.
|
|
|
Re: UnsupportedOperationException [message #755383 is a reply to message #755171] |
Tue, 08 November 2011 10:28 |
Wolfgang Knauf Messages: 63 Registered: July 2009 |
Member |
|
|
Hi Butny,
which server do you use? I assume it is a Tomcat? For the list of
included JARs: it is always a problem to bundle JARs which are already
part of your server.
I suggest to remove e.g. "servlet-api.jar" from your "lib" directory.
Don't bundle things which can be found e.g. in "common\lib" of your
tomcat installation. They can cause conflicts.
I am not sure whether tomcat already bundles a JSF implemention, but I
assume you have to deploy a jsf implementation as part of your app.
Do you have a "faces-config.xml" in your project?
Do you include the FacesServlet in "web.xml"?
<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>*.faces</url-pattern>
</servlet-mapping>
Your jsp pages have to contain a "taglib" for the JSF libraries - e.g.
like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
And finally? How do you call your JSF? Don't make a call to
"mypage.jsp", but use the extension you decalred in web.xml, e.g.
"mypage.faces" => this will be redirected to your JSP.
Hope this helps
Wolfgang
Am 07.11.2011 16:35, schrieb butny:
> Hi,
>
> I believe that you can help me out sir, nobody even replied to my thread at least which you did :)
>
> Please have a look at the attachments displaying the jars i am using. i am sure there is some version problem with the jars which i am unable to sort out.
>
>
>
>
>
>
>
> Please provide some useful suggestions, i am breaking my head since last few days for this. When i run the page, the jsf tags are not getting rendered, but i am not getting any exception in my console as well.
>
> Thanks,
> butny
|
|
|
Re: UnsupportedOperationException [message #755461 is a reply to message #755383] |
Tue, 08 November 2011 15:21 |
butny Messages: 28 Registered: November 2011 |
Junior Member |
|
|
Hi,
I removed the servlet-api.jar, had to add the jstl-api and jstl-impl jars in a new user library named "JSTL" and it works fine for me, hence i can say that it was a jar collision. But thats only one part of the story, may be the begining of a new one. I was using two eclipse versions parallely for checking if there is some problem with my eclipse or not. Now the setup is working fine in Indigo but the same thing is not working Helios. Still in Helios, the jsf tags are not getting rendered. I am surprised about this.
The only difference i can see between the helios and indigo one is that in indigo, there is the use of @taglib as Wolfgang showed whereas in helios, this is used:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
May be i am missing something in helios which is causing me not to render the jsf tags when the page is run
Please provide your suggestions on how to run the helios "hello world" jsf project.
@Russell
Thanks for your guidance and the links you shared, i am really very interested in reading all the links you shared and will surely get back to you for solving some other problems that i face in learning this JSF.
@Wolfgang
Your ideas really worked like you said about the jar collision (i.e, servlet-api.jar). But i need to ask you a question which i cant understand in your reply.
Q. My url-pattern in web.xml is like this: /faces/*
If i change it to the one you mentioned then what are th advantagges/disadvantages i am going to face? again, if i change it to the one you mentioned, then how to create a file with an extension of .faces? I cant see any option in my ide to create a file with extension of .faces Please inform how to do it.
Thanks,
Butny
|
|
|
Re: UnsupportedOperationException [message #755489 is a reply to message #755461] |
Tue, 08 November 2011 16:15 |
Wolfgang Knauf Messages: 63 Registered: July 2009 |
Member |
|
|
Hi,
> Q. My url-pattern in web.xml is like this: /faces/*
>
> If i change it to the one you mentioned then what are th
> advantagges/disadvantages i am going to face? again, if i change it to
> the one you mentioned, then how to create a file with an extension of
> .faces? I cant see any option in my ide to create a file with extension
> of .faces :( Please inform how to do it.
>
my URL pattern was just one sample, you have a different sample. That's
all fine ;-).
I think whenever you call an URL which matches the URL pattern, the JSF
servlet will handle the URL first and will try to find a matching JSP file.
So, for my sample: calling "mypage.faces" will trigger the JSF
framework, which will then search a file "mypage.jsp" (replace the URL
extension ".faces" with ".jsp") and render it's content.
Your URL pattern should work in a similar way I think:
"http://myhost/mywebapp/faces/somepage.jsp" will trigger the JSF
framework and will then render "somepage.jsp".
So, in both cases, you will create JSP files in the Eclipse project.
I am not sure about it, but I think the URL stuff might get different if
you use advanced JSF techniques like Facelets...
Best regards
Wolfgang
|
|
|
Goto Forum:
Current Time: Thu Apr 25 22:18:24 GMT 2024
Powered by FUDForum. Page generated in 0.03887 seconds
|