RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Putting a YUI Face on a Java Web Application : Page 4

Learn how to use Yahoo User Interface (YUI) Web components to develop a real world application with just the right mix of JavaScript/AJAX.


Tips for JavaScript and YUI Programming

Keep the following tips in mind when using JavaScript and YUI for web application development:
  • Be aware of the scope for callback methods. If the scope is incorrect, the this keyword will not reference the intended object. The YUI library event-handling classes have the ability to let you pass the object to which you set the scope. Go through the API documentation to see how this can be accomplished for a widget.
  • Use server-side includes to conditionally include screen parts. This improves the modularity of the application. The demo application renders the containers for all the entities. Instead, UI elements of other entities can be restricted from rendering based on a request parameter to the page. Alternatively, separate pages can be defined for each entity, and common HTML can be included as a file header and footer.
  • Refer to this W3C JavaScript Event Reference to learn the list of supported events.
  • If you are unfamiliar with the concept you are trying in JavaScript or a JavaScript framework, test the application for every change you make. If you fail to test and keep writing code, when an error occurs it will be difficult to backtrack and find the actual cause.
  • Be aware of how to revert a source file to a specific time using Local History in Eclipse. It's handy to know how to revert if things go wrong.

Take the Next Step

With this article under your belt, you should have the confidence to try JavaScript programming and to use YUI for web application development. You can strengthen your understanding of the concepts presented here by downloading the attached source files and trying to implement the incomplete entities of Birthdays and Appointments. You will need to define the necessary HTML markup, create listing and details classes for these entities, and hook them up to the Main class.

The next and final installment will cover the YUI DataTable in detail and demonstrate how to make AJAX server requests.

Narayanan A.R. is a passionate advocate of test-driven development, agile methodologies, Java technology, and design patterns. He has several years of experience in software design and development using Java technologies.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date