It seems there are a few people interested in our solution with updating
forms dynamically using an applet so I post a little further info on the
list.

Our problem was that when the user changes the value of some field (a
"key field") in some form, some or all other values are supposed to be
updated from the database. The database has an "unlimited" number of
records so sending it all to the client and update with JavaScript was
never an option. You could of course solve this issue with a reload with
the new values. We wanted to avoid this because a) it's "ugly" and takes
time and b) our users come from a Windows- client environment where
there is no such reload.

So, our solution is that when the user changes the key field, normally a
text field but a combo will work also, we have a JavaScript (onChange)
that calls an applet. The applet gets the new data from a JSP page. The
data is in XML, so the applet parses it with NanoXML
(http://nanoxml.sourceforge.net). After that our JavaScript updates the
fields of the form.

The script (somewhat simplified) could look like this (we support only
IE but I suppose you can make it work with NS too):

function update(theField, ...)
{
  // Collect parameters from theField and maybe other fields of
theField.form
 
  ourApplet.execute(..., parameters);
  
  while( ourApplet.hasNextColumn() )
  {
    var name = ourApplet.header(); // Get the name of the field
    var value = ourApplet.value(); // Get the new value

    eval( theField.form.name + "." + name + ".value='" + value + "'" );
  }
}

  Mattias Jiderhamn
  Expert Systems
  [EMAIL PROTECTED]
�

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to