forms, formbeans and JavaScript

2001-02-12 Thread Mike Dewhirst


As a lot of forms may have JavaScript in them to dynamically rebuild menus, etc. Is it 
possible to combine this with the Struts tag-styled form design?

Thanks in advance for your help,

Mike


--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.




Re: VAJ Tomcat Test Environment/WS Test Environment serializable error

2001-02-12 Thread Craig R. McClanahan

[EMAIL PROTECTED] wrote:

 FYI anyone working in VAJ with the WTE (EJBs etc), passing ActionForms to
 EJB methods. We are hoping to find the actual either VAJ error or
 non-serializable object details.


Could you try an experiment?  Does making the "servlet" variable in ActionForm 
transient solve this?  (I imagine
the same issue would come up if the multipartRequestHandler variable was non-null.

Craig



 The workaround for this at the moment is to save the ActionServlet object
 from the form bean and then set it to null, send the form bean off to the
 ejb then when the ejb has finished with it put the saved ActionServlet back
 into the form bean. Like so:

 ActionServlet as = form.getServlet();
 form.setServlet(null);

 and then at the end of your try/catch you need a finally:

 finally
 {
  form.setServlet(as);
 }

 Internal Servlet Error:
 java.io.IOException: Serializable readObject method failed internally
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
java.io.IOException(java.lang.String)
void
 com.ibm.rmi.io.IIOPOutputStream.throwExceptionType(java.lang.Class,
 java.lang.String)
void
 com.ibm.rmi.io.IIOPOutputStream.simpleWriteObject(java.lang.Object)
void
 com.ibm.rmi.io.ValueHandlerImpl.writeValueInternal(com.ibm.rmi.io.IIOPOutputStream,

 org.omg.CORBA_2_3.portable.OutputStream, java.io.Serializable)
void
 com.ibm.rmi.io.ValueHandlerImpl.writeValue(org.omg.CORBA.portable.OutputStream,

 java.io.Serializable)
void
 com.ibm.rmi.iiop.CDROutputStream.write_value(java.io.Serializable)
void
 com.ibm.rmi.iiop.CDROutputStream.write_value(java.io.Serializable,
 java.lang.Class)
com.ibm.tricon.User com.ibm.tricon.userprofile.ejb.
 _User_BaseStub.updateUser(au.com.tricon.web.UserPageForm)
com.ibm.tricon.User com.ibm.tricon.userprofile.ejb.
 _User_Stub.updateUser(au.com.tricon.web.UserPageForm)
com.ibm.tricon.User
 
com.ibm.tricon.userprofile.ejb.UserAccessBean.updateUser(au.com.tricon.web.UserPageForm)

org.apache.struts.action.ActionForward
 au.com.tricon.web.ModifyUserAction.perform(org.apache.struts.action.ActionMapping,

 org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
 javax.servlet.http.HttpServletResponse)
org.apache.struts.action.ActionForward
 
org.apache.struts.action.ActionServlet.processActionPerform(org.apache.struts.action.Action,

 org.apache.struts.action.ActionMapping,
 org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
 javax.servlet.http.HttpServletResponse)
void
 org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletRequest,

 javax.servlet.http.HttpServletResponse)
void
 org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequest,

 javax.servlet.http.HttpServletResponse)
void
 javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest,

 javax.servlet.http.HttpServletResponse)
void
 javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
 javax.servlet.ServletResponse)
void
 org.apache.tomcat.core.ServletWrapper.handleRequest(org.apache.tomcat.core.Request,

 org.apache.tomcat.core.Response)
void
 org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request,

 org.apache.tomcat.core.Response)
void
 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(org.apache.tomcat.service.TcpConnection,

 java.lang.Object [])
void org.apache.tomcat.service.TcpConnectionThread.run()
void java.lang.Thread.run()

 --
 dIon Gillard, Multitask Consulting
 Work:  http://www.multitask.com.au
 NetRexx: http://www.multitask.com.au/NetRexx.nsf




Re: Asynchronous request processing

2001-02-12 Thread Craig R. McClanahan

Rey Francois wrote:

 We are currently investigating the possibility to service HTTP requests with
 an asynchronous model. The idea is to retrieve the dynamic content from the
 back-end using asynchronous calls. The motivations are:
 *   Sometimes the existing backend systems already have an asynchronous
 interface
 *   The increased response time when building a page which dynamic
 content is retrieved from multiple calls to the backend: these calls can be
 executed concurrently.
 *   Better scalability: the web server does not need to wait idly for
 the results
 The difficulty to implement such a mechanism is due to the Servlet spec
 itself: once the service() method returns, container can assume that the
 servicing of the request is finished and the response object should be
 closed. This means that while waiting for the results of the operations in
 the backend, we cannot just simply return the control to the container.
 Rather then having the servicing thread actively wait for the results, we're
 thinking about putting it to sleep and awake it when the results are ready.
 One way to achieve this is the use of the Object.wait() and Object.notify()
 methods. The code in the ActionForm.perform() would look more or less like
 this:
 Action.perform() {
 ResultHandler resultHandler = new
 ResultHandler(request, response) {
 handleResult(command) {
 // process results
 // when all results have
 arrived, call notify()
 }
 };
 Command c1 = Command.getCommand("COMMAND1");
 c1.execute(resultHandler); // async. call
 Command c2 = Command.getCommand("COMMAND2");
 c.execute(resultHandler); // async call
 Try {
 resultHandler.acceptResults(long timeout) ;
 } catch (TimeOutException) {
 // time out error handling
 }
 // from here all results have been returned.
 ...
 return new ActionForward(...) ;
 }
 The ResultHandler class would look somehow like this:

 public class ResultHandler {
 synchronized void acceptResults(long timeout) throws
 TimeOutException {
 wait(timeout);
 if (!areAllCommandFinished) {
 throw new TimeOutException(...);
 }
 }
 // Method called internally in order to register the commands
 // this handler is waiting for
 void registerCommand(Command command) {...}

 // Return true if all registered commands have terminated
 boolean areAllCommandFinished() {...}

 // Method called internally when results arrive
 void internalHandleResults(Command command) {
 // Check if the command is registered and mark it as
 terminated
 // then call the user's logic for processing results
 handleResults(command);
 // If all commands are finished, awake servicing thread
 if (areAllCommandFinished) {
 synchronize(this) {
 notify();
 }
 }
 }

 // Method to be overridden by the user
 abstract synchronized void handleResults(Command command);
 }
 The code above is just indicative and may contains syntax or design errors,
 but I think the idea is well illustrated.
 Does anybody have any comments on this approach? I'm also particularly
 interested in your comments regarding the fact that the servicing thread is
 put to "sleep": is there any risk in doing this? Can this have any conflict
 with the container and the way it manages its threads?


This approach looks like it should be safe -- from the perspective of the
servlet container, the call is still synchronous.  Where you get into trouble is
trying to reference the request and response objects of a particular request
after the service() method has returned, which does not happen in your scenario.

One caveat is that some servlet containers might run your web apps under a
SecurityManager that does not allow asynchronous threads at all, so you will
want to make sure that this is allowed.

An alternative approach to asynchronous processing is to remember that the user
might want to see some intermediate feedback while the asynchronous commands are
executing.  You might think about an Action designed (in general) like this:

if (background-commands-not-started) {
start-background-commands (in separate threads)
return "Work in progress" page

Using ATG Dynamo w/ Struts/JSP?

2001-02-12 Thread Nino Walker

Hi,

I'm experimenting with struts and Dynamo 5, and was hoping others might
share their experiences.  So far, I've been moderately successful, but
have run into several inconsistencies between their JSP Container and
Tomcat's.  I'm working with Struts v0.5 and have been tracking down one
bug/inconsistency after another...

Thanks for your time,

Nino




Re: forms, formbeans and JavaScript

2001-02-12 Thread Craig R. McClanahan

Mike Dewhirst wrote:

 As a lot of forms may have JavaScript in them to dynamically rebuild menus, etc. Is 
it possible to combine this with the Struts tag-styled form design?


The challenge with doing this is that the JSP tags run on the server (as the page is 
being generated), while the JavaScript runs on the client side.  To integrate the two, 
you need your tags (and other JSP code) to dynamically generate the JavaScript 
functions themselves -- sort of having a program write a program --
so that the JavaScript is customized to your particular need on this particular page.

A very trivial example is the way that the html:form tag deals with the "focus" 
attribute.  If you specify it, a dynamically generated bit of JavaScript is created to 
set the input focus, which includes the name of the field you want initial focus 
assigned to.

For a more comprehensive scenario, consider that for most menuing systems you will 
need to configure the list of available options into a JavaScript array or something.  
You could use the logic:iterate tag to render the elements that get set in the 
array's initialization expression.


 Thanks in advance for your help,

 Mike


Craig





Fwd: INSTALL notes for SilverStream Application Server

2001-02-12 Thread Rousseau, John

Hi Ted,

I sent this out on the 6th, but some people have told me that they
never saw it on the list. I also saw your most recent INSTALL
checkin without these changes.

Can you please send me an ack when you get this?

Thanks!
-John

--- start of forwarded message ---
From: John Rousseau [EMAIL PROTECTED]
Subject: INSTALL notes for SilverStream Application Server
Date: Tue, 6 Feb 2001 12:57:29 -0500

Hi Ted,

Here are the instructions for deploying the struts example and
documentation WAR files to SilverStream Application Server 3.7.1 (the
latest).

Thanks!
-John


John Rousseau   [EMAIL PROTECTED]
SilverStream Software Phone: +1 978 262 3564
2 Federal StreetFax: +1 978 262 3499
Billerica, MA 01821  http://www.silverstream.com



SilverStream Application Server 3.7.1
-

* Start the SilverStream application server.

* Create an XML deployment plan for the "struts-example.war"
  application. Call the file "struts-example-depl-plan.xml". You can
  use the following contents for the file:

--- cut here 
?xml version="1.0" encoding="UTF-8"?
!DOCTYPE warJarOptions PUBLIC
"-//SilverStream Software, Inc.//DTD J2EE WAR Deployment 
Plan//EN"
"deploy_war.dtd"

warJarOptions
warJar
warJarNamestruts-example.war/warJarName
isEnabledtrue/isEnabled
urlselstruts-example/el/urls
/warJar
/warJarOptions
--- cut here 

* Create an XML deployment plan for the "struts-documentation.war"
  application. Call the file
  "struts-documentation-depl-plan.xml". You can use the following
  contents for the file:

--- cut here 
?xml version="1.0" encoding="UTF-8"?
!DOCTYPE warJarOptions PUBLIC
"-//SilverStream Software, Inc.//DTD J2EE WAR Deployment 
Plan//EN"
"deploy_war.dtd"

warJarOptions
warJar
warJarNamestruts-example.war/warJarName
isEnabledtrue/isEnabled
urlselstruts-documentation/el/urls
/warJar
/warJarOptions
--- cut here 

* Run the following 'SilverCmd DeployWAR' commands to deploy the
  applications.  You can change 'localhost' to whatever server you
  are deploying to. You can change 'Silvermaster' to whatever
  database you are deploying to.

SilverCmd DeployWar localhost Silvermaster struts-example.war -f 
struts-example-depl-plan.xml
SilverCmd DeployWar localhost Silvermaster struts-documentation.war -f 
struts-documentation-depl-plan.xml


--- end of forwarded message ---



cvs commit: jakarta-struts/web/blank/WEB-INF/classes - New directory

2001-02-12 Thread craigmcc

craigmcc01/02/12 15:58:21

  jakarta-struts/web/blank/WEB-INF/classes - New directory



cvs commit: jakarta-struts/web/blank/WEB-INF/classes ApplicationResources.properties

2001-02-12 Thread craigmcc

craigmcc01/02/12 15:59:43

  Modified:.build.xml
  Added:   web/blank index.jsp
   web/blank/WEB-INF struts-config.xml web.xml
   web/blank/WEB-INF/classes ApplicationResources.properties
  Log:
  Add the "struts-blank" starter application (contributed by Ted Husted) to
  the Struts build process.  It will now show up as file "struts-blank.war"
  in the Struts binary distribution.
  
  Revision  ChangesPath
  1.36  +59 -9 jakarta-struts/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-struts/build.xml,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- build.xml 2001/02/02 00:18:11 1.35
  +++ build.xml 2001/02/12 23:59:37 1.36
  @@ -30,6 +30,18 @@
   /copy
 /target
   
  +  !-- BUILD:  Create directories and copy files for blank application --
  +  target name="prepare.blank"
  +mkdir   dir="${build.home}"/
  +mkdir   dir="${build.home}/blank"/
  +mkdir   dir="${build.home}/blank/WEB-INF"/
  +mkdir   dir="${build.home}/blank/WEB-INF/classes"/
  +mkdir   dir="${build.home}/blank/WEB-INF/lib"/
  +copy  todir="${build.home}/blank"
  +  fileset dir="web/blank"/
  +/copy
  +  /target
  +
 !-- BUILD:  Create directories and copy files for documentation app --
 target name="prepare.documentation"
   mkdir   dir="${build.home}"/
  @@ -130,6 +142,29 @@
   /copy
 /target
   
  +  !-- BUILD:  Compile blank application components --
  +  target name="compile.blank"
  +   depends="dist.library,prepare.blank"
  +!--
  +javac srcdir="src/blank"
  +  destdir="${build.home}/blank/WEB-INF/classes"
  +classpath="${build.home}/library/classes:${servlet.jar}"
  +debug="${debug}" optimize="${optimize}"
  +  deprecation="${deprecation}"/
  +copy  todir="${build.home}/blank/WEB-INF/classes"
  +  fileset dir="src/blank" includes="**/*.properties"/
  +/copy
  +--
  +copy   todir="${build.home}/blank"
  +  fileset dir="web/blank"/
  +/copy
  +copyfile="${dist.home}/lib/${app.name}.jar"
  +   tofile="${build.home}/blank/WEB-INF/lib/${app.name}.jar"/
  +copy   todir="${build.home}/blank/WEB-INF"
  +  fileset dir="${dist.home}/lib" includes="*.tld"/
  +/copy
  +  /target
  +
 !-- BUILD:  Compile documentation application components --
 target name="compile.documentation"
  depends="dist.library,prepare.documentation"
  @@ -284,6 +319,12 @@
 basedir="${build.home}/library/classes" includes="**"/
 /target
   
  +  !-- DIST:  Construct blank distributables --
  +  target name="dist.blank" depends="dist.library,compile.blank"
  +jar  jarfile="${dist.home}/webapps/${app.name}-blank.war"
  +  basedir="${build.home}/blank" includes="**"/
  +  /target
  +
 !-- DIST:  Construct documentation distributables --
 target name="dist.documentation"
  depends="dist.library,compile.documentation,compile.javadoc"
  @@ -303,18 +344,18 @@
 basedir="${build.home}/template" includes="**"/
 /target
   
  -  !-- DIST:  Construct upload example distributables --
  -  target name="dist.upload" depends="dist.library,compile.upload"
  -jar jarfile="${dist.home}/webapps/${app.name}-upload.war"
  - basedir="${build.home}/upload" includes="**"/
  -  /target
  -
 !-- DIST:  Construct test distributables --
 target name="dist.test" depends="dist.library,compile.test"
   jar  jarfile="${dist.home}/webapps/${app.name}-test.war"
 basedir="${build.home}/test" includes="**"/
 /target
   
  +  !-- DIST:  Construct upload example distributables --
  +  target name="dist.upload" depends="dist.library,compile.upload"
  +jar jarfile="${dist.home}/webapps/${app.name}-upload.war"
  + basedir="${build.home}/upload" includes="**"/
  +  /target
  +
 !-- DIST:  Copy sources --
 target name="dist.source" depends="prepare.dist"
   copy   todir="${dist.home}/etc"
  @@ -333,10 +374,14 @@
   
 !-- DIST:  Construct complete release distribution --
 target name="dist"
  -   
depends="dist.library,dist.documentation,dist.example,dist.template,dist.upload,dist.test,dist.source"/
  +   
depends="dist.library,dist.blank,dist.documentation,dist.example,dist.template,dist.test,dist.upload,dist.source"/
   
 !-- DEPLOY:  Deploy these applications on Catalina --
  -  target name="deploy.catalina" 
depends="compile.documentation,compile.example,compile.template,compile.upload,compile.test"
  +  target name="deploy.catalina" 
depends="compile.blank,compile.documentation,compile.example,compile.template,compile.test,compile.upload"
  +mkdir   dir="${catalina.home}/webapps/struts-blank"/
  +copy  todir="${catalina.home}/webapps/struts-blank"
  +  fileset dir="${build.home}/blank"/
  +/copy
   

cvs commit: jakarta-struts/src/share/org/apache/struts/util LocalStrings.properties

2001-02-12 Thread craigmcc

craigmcc01/02/12 16:06:26

  Added:   src/share/org/apache/struts/util LocalStrings.properties
  Log:
  Add new messages file.
  
  Revision  ChangesPath
  1.1  
jakarta-struts/src/share/org/apache/struts/util/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  lookup.access=Invalid access looking up property {0} of bean {1}
  lookup.bean=Cannot find bean {0} in scope {1}
  lookup.method=No getter method for property {0} of bean {1}
  lookup.scope=Invalid bean scope {0}
  lookup.target=Exception thrown by getter for property {0} of bean {1}
  write.io=Input/output error: {0}
  
  
  



cvs commit: jakarta-struts/web/test bean-size.jsp index.jsp

2001-02-12 Thread craigmcc

craigmcc01/02/12 17:56:08

  Modified:src/doc  struts-bean.xml
   src/share/org/apache/struts/taglib/bean
LocalStrings.properties
   web/test index.jsp
  Added:   src/share/org/apache/struts/taglib/bean SizeTag.java
SizeTei.java
   web/test bean-size.jsp
  Log:
  Add a new bean:size tag that will store the size of an array,
  Collection, or Map into a page-scope bean with type java.lang.Integer.
  
  Submitted by: Hal Deadman [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.19  +82 -0 jakarta-struts/src/doc/struts-bean.xml
  
  Index: struts-bean.xml
  ===
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-bean.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- struts-bean.xml   2001/02/03 03:23:24 1.18
  +++ struts-bean.xml   2001/02/13 01:56:05 1.19
  @@ -662,6 +662,88 @@
   
 tag
   
  +namesize/name
  +summary
  +Define a bean containing the number of elements in a Collection or Map.
  +/summary
  +tagclassorg.apache.struts.taglib.bean.SizeTag/tagclass
  +teiclassorg.apache.struts.taglib.bean.SizeTei/teiclass
  +bodycontentempty/bodycontent
  +info
  +pGiven a reference to an array, Collection or Map, creates a new bean, of
  +type codejava.lang.Integer/code, whose value is the number of elements
  +in that collection.  You can specify the collection to be counted in any
  +one of the following ways:/p
  +ul
  +liAs a runtime expression specified as the value of the
  +codecollection/code attribute./li
  +liAs a JSP bean specified by the codename/code attribute./li
  +liAs the property, specified by the codeproperty/code attribute,
  +of the JSP bean specified by the codebean/code attribute./li
  +/ul
  +/info
  +
  +attribute
  +  namecollection/name
  +  requiredfalse/required
  +  rtexprvaluetrue/rtexprvalue
  +  info
  +  pA runtime expression that evaluates to an array, a Collection, or
  +  a Map./p
  +  /info
  +/attribute 
  +
  +attribute
  +  nameid/name
  +  requiredtrue/required
  +  rtexprvaluetrue/rtexprvalue
  +  info
  +  pThe name of a page scope JSP bean, of type
  +  codejava.lang.Integer/code, that will be created to contain the
  +  size of the underlying collection being counted./p
  +  /info
  +/attribute
  +
  +attribute
  +  namename/name
  +  requiredfalse/required
  +  rtexprvaluetrue/rtexprvalue
  +  info
  +  pThe name of the JSP bean (optionally constrained to the scope
  +  specified by the codescope/code attribute) that contains the
  +  collection to be counted (if codeproperty/code is not specified),
  +  or whose property getter is called to return the collection to be
  +  counted (if codeproperty/code is specified./p
  +  /info
  +/attribute
  +
  +attribute
  +  nameproperty/name
  +  requiredfalse/required
  +  rtexprvaluetrue/rtexprvalue
  +  info
  +  pThe name of the property, of the bean specified by the
  +  codename/code attribute, whose getter method will return the
  +  collection to be counted./p
  +  /info
  +/attribute
  +
  +attribute
  +  namescope/name
  +  requiredfalse/required
  +  rtexprvaluetrue/rtexprvalue
  +  info
  +  pThe bean scope within which to search for the JSP bean specified
  +  by the codename/code attribute.  If not specified, the available
  +  scopes are searched in ascending sequence./p
  +  /info
  +/attribute
  +
  +  /tag
  +
  +
  +  tag
  +
   namestruts/name
   summary
   Expose a named Struts internal configuration object as a bean.
  
  
  
  1.10  +1 -0  
jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LocalStrings.properties   2001/02/12 01:26:57 1.9
  +++ LocalStrings.properties   2001/02/13 01:56:06 1.10
  @@ -11,5 +11,6 @@
   page.selector=Invalid page context selector {0}
   parameter.get=No parameter {0} was included in this request
   resource.get=No resource {0} available in this application
  +size.collection=No valid collection specified for size tag
   struts.missing=No Struts internal object named {0} is available
   struts.selector=You must specify exactly one of formBean, forward, or mapping
  
  
  
  1.1  
jakarta-struts/src/share/org/apache/struts/taglib/bean/SizeTag.java
  
  Index: SizeTag.java