MECHENG401:DevelopmentNotes

From Marks Wiki
Revision as of 05:08, 3 November 2008 by Mark (Sọ̀rọ̀ | contribs) (10 revision(s))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Home

AJAX

Problems with AJAX

  • To add the taglib declaration to a page:
    • Save the page. Add the Taglib declaration. Save the page. remove the taglib declaration, save, add it again....
      • Something like that, anyway it is not very good at picking it up

Creating my first use of the AjaxTags library

  • Decided to use a Servlet as my server side request handler.
    • This required adding the servlet jar to my jre classpath
    • I did this by adding the servlet-api.jar found in my tomcat lib directory to the jre1.6.0_03\lib\ext directory, and modifying my jre definition in eclipse, via window->preferences->installed jres, and clicking edit the workspace default, or whatever you use. Select the jar you added and add it to the path.
      • Turns out this is Haxx and evil, and should be avoided. Instead, just add the servlet jar and whatever other jars you need to the classpath, and leave the physical files in the current location.
  • The servlet should extend org.ajaxtags.servlets.BaseAjaxServlet from the ajaxtags jar.
  • Need org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager
  • Need org.apache.commons.lang.StringUtils - actually may as well get the whole lot...

Second try at AJAX

  • Libraries required from Tomcat's lib directory:
    • servlet-api.jar
    • standardXXXXXXX.jar
    • commons-lang-2.4.jar
    • jsp-api.jar



  • Win! I got it working.
  • Things to watch for when implementing:
    • BaseURL - I had problems with variables not being expanded correctly e.g PageContext to get the context path thing e.g /Archivista therefore hard code it for now
    • parser - look at the default and consider if you need to change it. Feedback if you have a mismatch between what is expected and what is given -> the result is "undefined"
    • When testing, make sure there is a valid IEPDataBean in session scope e.g go through the process of creating one. Else you may expect null pointer exceptions in the servlet
    • Many many problems will come from not having the right libraries in the classpath. See above.