PrimeFaces in Eclipse Java EE IDE for Web Developers - java

I am a beginner in Java Web Applications and I read some information here on how to start use primefaces and as a result I added PrimeFaces components to my page as xmlns:p="http://primefaces.org/ui" and also added the primefaces-5.0.jar to my classpath:
MyProject->Java_Resources->Libraries->primefaces-5.0.jar
I read that I had to add primefaces-5.0.jar to WEB-INF->lib->primefaces-5.0.jar and I did it, but I couldn't work with primefaces. I ran my project and neither of primefaces didn't show and also I didn't see any warnings and errors. Do you know any solutions to my problem?

You need to add Jsf component libraries which called jsf-imp.jar and jsf-api.jar and should make configuration on web.xml. You should watch the Jsf+Primefaces Tutorial for beginners.Here is good understandable tutorial for you. http://www.youtube.com/watch?v=F4NawR70uT0

Related

Primefaces Calendar does not show up

I am trying to integrate Primefaces 5.2 to a JSF application which has version of 2.0.11-02. I am using IBM WebSphere 8.5.5 as application server. I am trying to use p:calendar in my page but it does not show up.
When I checked from Google Chrome Dev Tools, I noticed that the corresponding input field has no "click" event listener attached to it. In Primefaces Showcase the input fields has "click" event listener so when you click, calendar shows up.
I am also having the same trouble with sorting of datatable. The column has no "click" event listener, so it does not send any request when the header of a sortable column is clicked.
Please help me with that problem.
P.S: The application I am working on was a JSF 1.2 application and were using JWL libraries of IBM. Since I am upgrading the application to JSF 2, I am not able to use that library anymore. That's way I am trying to integrate Primefaces. primefaces-5.2.jar is placed under /WEB-INF/lib and I also still have jsf-ibm.jar, odc-jsf.jar in that directory.
try to create a lib folder out of the meta-inf and PrimeFaces put the library, or you could also try creating a page with the component PrimeFaces calendar to see if it works and put in
<html xmlns:p="http://primefaces.org/ui"</html>
Are you sure that you save your XHTML file with proper extension? If you have deafult settings it would be *.jsp as far as I remember

JSP errors, disable in Eclipse Juno

I have Eclipse, the Juno release. Just recently I am getting a few JSP errors which aren't valid or I don't care to see. Examples of the errors are below.
The function fn:replace is undefined
Attribute (cellpadding) is obsolete. Its use is discouraged in HTML5 documents.
The function error is not valid, as it working perfectly fine when I run the web application. I simple don't care the HTML5 related obsolete messages. I'd like Eclipse to not display these "errors".
I've tried enabling project specific validations, and turning off the HTML, JSP, & Tag validators, but it made no difference.
Maybe you mean that your project is using using older type of (x)html. If you don't like Eclipse falling by default to HTML5, go to project properties, then Web Content Settings, then in Document Type select the one you use.

How do I run "Hello, world!" with WebSphere and Wicket?

I am a Wicket beginner, and I need to develop a Wicket application using WebSphere Application Server 7.0. I've searched Stack Overflow and Google, and found these resources
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Websphere-td1917050.html#a1917051
https://cwiki.apache.org/confluence/display/WICKET/Websphere
but I can't figure out how to run a "Hello, world!" app on WebSphere. Can anyone tell me how to run one, step by step, using Wicket?
For example, for the step "Add a new property called com.ibm.ws.webcontainer.invokefilterscompatibility," where will I add the property?
I have Wicket 1.4 in production on WAS 7.0 and it works just fine - with one exception. I had to use the WicketServlet instead of the WicketFilter.
Try the following:
Create a Wicket Quickstart project
Modify the web.xml to use the Servlet instead of the Filter. The second link you provided contains instructions on how to do do.
Deploy!
I don't recall having to do anything special beyond that.
Note: As I use the Servlet, I have no need to use the com.ibm.ws.webcontainer.invokefilterscompatibility property.

PrettyTime JSP tag

I'm trying to put PrettyTime into JSP as a tag. Found this page - http://www.ke-cai.net/2010/03/formatting-time-with-prettytime-jsp-tag.html - as the only source of the tag. But I've never used Maven, so I can't figure out how to get that prettyTime.tag file along with the source code. Can someone suggest something or should I just go ahead and write a tag myself?
From what I can see in that article, all Maven will be doing is pulling in the java library. You can do this manually, and include it in your standard way (ie, in your "lib").
He seems to be telling you then how to write your own jsp tag (suggesting you call it "prettyTime.tag"), and then how to reference it.
Side note, you may want to consider reading up on and adopting Maven, its quite a powerful build management helper for java web app development.
That's just a blog of someone else. It's available by the manufacturer's site: http://ocpsoft.com/prettytime/
It's however a JSF tag, which means that you have to install and use JSF as well.
Instead of using a server-side component, you can use javascript. See the jQuery timeago plugin

how to start coding and setting up a web server with java?

so now i think i have learned all basics and terminology for java. but what i don´t know is how to code and display a web page with Netbeans in Java.
the most tutorials contains lots of talks about different technologies "Java uses Java Beans, JSP and servlets" and so on. Where can i find short practical tutorials that actually teach me where to code what and then compile and where to put all the files (war, jar, ear..) in Glassfish to be able to see the output from a Web browser. Simples things that makes one understand all these different "layers" which are just classes using classes. Feels like i never get to know how i can put up a web server with Java cause I can´t find this kind of tutorials.
Would be great if someone could send some links to such practical stuff.
Thanks.
This is the first such document I found: http://www.java-tips.org/java-tutorials/tutorials/introduction-to-java-servlets-with-netbeans.html
More:
http://netbeans.org/kb/docs/web/quickstart-webapps.html
http://blogs.oracle.com/jonasdias/entry/webservices_with_jsp_on_netbeans
http://www.fuzzylizard.com/archives/2005/09/18/628/
http://cit.wta.swin.edu.au/cit/subjects/CITP0014/tutorials/netbeans/tomcat/Running_Tomcat_from_Netbeans.html
http://supportweb.cs.bham.ac.uk/documentation/java/servlets/netbeans-webapps/
I even found a small ebook on this (PDF!) http://www.comp.dit.ie/bduggan/Courses/projects/Getting%20Started%20with%20Tomcat%20&%20NetBeans.pdf
How do I code and display a web page with NetBeans in Java?
Let's go! Fire up NetBeans. I'm using NetBeans 6.7.1 with the Java EE stuff installed, and I've got a GlassFish installed and tied up, so I don't have to care about that stuff. Your setup might differ in the details.
Do a File->New Project, and pick "Java Web" from the categories. Select "Web Application" and hit Next. Enter a project name and tweak the location, if liked. Hit Next. The next page should have a server selection drop-down; as hinted above, mine has "GlassFIsh v2.1" selected. That's fine - as long as NetBeans can interact with a Java application server of some sort, this crash course will run okay.
Make a note of the "context path" - this will be based on the project name, and basically forms the base of the URL at which your application will reside. Hit Next. Ignore the next page, for now, which talks about various frameworks, and hit Finish.
Churn, churn. You should eventually see your web project created. It's a very simple application which contains a single JSP file, and that will be open in the main editor. It's got a bunch of HTML in it, and some JSP syntax.
Take a look at the project structure. You've got a "web pages" folder which contains a WEB-INF directory, and an index.jsp file. That's the same file you're looking at. WEB-INF is a standard directory which contains the metadata used to deploy your application, and also the compiled classes that power it.
The only thing you should need to do now, in order to get to the original objective, is to hit the big ol' Run button, or right-click on the project and select "Run" from the menu. NetBeans will compile, and then fire up your application server and deploy the application to it. Finally, your web browser should pop open a new tab with the classic "Hello, world" page in it.
At this point, what do you actually have? You've got an empty web project with a single JSP file in it. You could customise it, but that's maybe not very exciting. What you're really looking at is a basic framework in which you can apply your learning of JSP and of servlets as you get to grips with them.
How to proceed with said knowledge transfer? I recommend a decent book or two. The one I used to get going was "Beginning JSP, JSF and Tomcat Web Development: From Novice to Professional" (Zambon, Guilio; Apress; ISBN 1-59059-904-7), which has a decent beginner's guide to how JSP and servlets work together, and a handy reference guide for the former.
As soon as possible, you're going to want to migrate away from raw servlets and JSP to tying them together in a slightly more flexible way using one of the frameworks I skipped over earlier. I'm not going to tell you which one to learn; there are several pretty decent ones. Try Spring MVC, or Struts. Once again, I'd suggest getting a decent book.
I would start by taking a look at servlets and JSP. I found this book helpful when I read it: Head First Servlets and JSP
Netbeans comes with many sample projects, create a few and browse the source code.
A already working sample is always a good starting-point for your coding.
If you're also interested in using Eclipse, which makes it very simple to create and deploy web applications here's a nice tutorial - WTP Tutorials
Hi to start code and setting up web server with java follow the following procedure.
First you need to install Apache-Tomcat or Jetty any web container or servlet container.
And you have set the classpath of servlet-api.jar file.
Next you will have to save your web-page code stuff in web-apps folder of tomcat.In web-apps folder there you have to create a web-inf folder in which web.xml file is stored.And after writing servlet and jsp programs the compiled class files are stored in classes folder of web-inf folder.JSP files are stored along with WEB-INF folder.
You have to keep all the jar files in LIB folder of classes folder.
The web container will take care of initalizing servlet, loading class using inti method.Using service method it will create two objects request and response.
The Java EE stack is quite a mouthful. I suggest you just look at writing a Web Application (WAR), and deploy it to Tomcat.
Unfortunately doing a full WAR-file deployment is rather tedious so you generally want some help from your IDE or the web container.
The easiest place to start is probably installing and starting Tomcat and then fiddle with the files in the file system. There is an example application.

Categories

Resources