7
I was recently asked: “What is jQuery?”.
By now, most Javascript enthusiasts understand the advantages of jQuery’s power. To demonstrate one of those advantages, I’ve added a simple portlet demonstrating the use of jQuery with a submit button.
Play the video below to see this portlet in action. Notice that the screen immediately updates and does not flicker when the button is clicked. Subsequent clicks removes the previous list and redisplays the list again.

I cought: (Liferay 5.2.2; hello jQuery portlet 5.2.2.1)
03:27:18,917 ERROR [jsp:165] org.apache.jasper.JasperException: /html/portlet/hellojQuery_portlet/view.jsp(25,0) The absolute uri: http://java.sun.com/jsp/jstl/fmt cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
Understood, pls edit liferay-plugin-package.properties:
remove “,\” after fmt.tld
Andrew:
Thanks for catching this problem. Although the trailing slash wasn’t causing any exceptions in Tomcat 6, it probably did present headaches for other Application servers.
I’ve updated the distribution file to remove the slash. Also, changed the category of this portlet to go to “samples” just like the other hello portlets.
I am trying to modify this portlet, but I’m new to developing in LifeRay. How do you debug JavaScript that is running in a portlet in LifeRay? I usually use Firebug to debug my JS and I can’t get it to recognize the JS within LifeRay.
Amity,
I’m sorry to say that I’ve never used Firebug in that context, either. However, I assume that because a portlet’s code is part of the aggregated html output for the page, you would first have to determine where the JS code was placed in the final output (Use View/ Page Source). If all else fails, use alert statements to mark the execution of the jQuery code.
I used your examples to put jquery in my portlets, so I’m able to embed js script in the jsp file, but if I put the js script in a separate file and I use tag the code is present but it doesn’t work. Can you help me?
If you send me a copy of the source I can take a look at it for you. Also try looking at the source through FireBug (or just View Source) to see if the included script file is actually getting pulled in.