GenericConnection.close() - Test before setting before resetting to default.

2001-02-07 Thread Johan Compagner

Hi,

I use the JDBCODBC driver at this time to a Access DB (just in the
development fase)
And i have build in a PreparedStatement Connection pool.
So that connection.preparedStatement returns a pooled one instead of
creating new ones all
the time. in the Close() of my GenericPreparedStatement class i return it to
the pool of the
GenericConnection.
But when the GenericConnection is closed. the close() method of
GenericConnection
just set's the default values like this: (and for readonly, ect ect)

 try
 {
   conn.setCatalog(this.catalog);
 }
 catch (SQLException e)
 {
  ;
 }

The problem is that when i set the Catalog even it is not changed i can't
use my
PreparedStatements anymore, the next time i use one after thet setCatalog
call i get
a exception: Function Sequence Error

So what i did for all the default params is first test it if it is changed:

 try
 {
  if(!conn.getCatalog().equals(this.catalog))
  {
   conn.setCatalog(this.catalog);
  }
 }
 catch (SQLException e)
 {
  ;
 }

Can struts do the same?
Why resetting a default property if it isn't changed?

I attached my GenericConnection and all the classes that are added and
changed for the
preparedStatement Pool. Maybe this is something for struts?

By Default nothing is cached or pooled because the CacheStatements boolean
of the
GenericDataSource i added is false.
It would be nice if i could set that property in the struts-config.xml file
in the datasource section.


Johan




 GenericPreparedStatement.java
 GenericDataSource.java
 GenericConnection.java


OptionsTag comments

2001-02-07 Thread Johan Compagner

Hi,

I want to set the value of a Option.
That value is a integer.

So first i thougth i can just return a int[]
But then i get a class cast exception because the
OptionsTag.getIterater(String,String)
does check if it is a array and then cast it to a Object[] which it isn't.
(Maybe this should be in the doc!)

 if (collection.getClass().isArray())
  collection = Arrays.asList((Object[]) collection);

But then i thought, OK then i make it Integer object array.
But then the OptionsTag.doEndTag() throws a class cast exception because
all the values that are in the iterator are cast to a string!

  while (valuesIterator.hasNext())
  {
   String value = (String) valuesIterator.next();
^^
   String label = value;
   if (labelsIterator.hasNext())
label = (String) labelsIterator.next();
   addOption(sb, value, label, match);
  }

The first thing (it can't be a primitive array, i can live with)
But why must it be a string?
Just do this:
   String value = valuesIterator.next().toString();

If you want it to be a String.

This is because the selected value is also just a int in the Form class.
So why must i myself make it a string?

Johan






cvs commit: jakarta-struts/web/example index.jsp

2001-02-07 Thread craigmcc

craigmcc01/02/07 15:10:48

  Modified:src/doc  struts-html.xml
   src/share/org/apache/struts/taglib/html ImgTag.java
LocalStrings.properties
   web/example index.jsp
  Log:
  Add a "page" attribute to the html:img tag that can be used, instead of the
  "src" attribute, to specify a context-relative path to the image resource to
  be rendered.  The tag will automatically prepend the context path of this web
  application to the rendered URL, in a manner analogous to the way that the
  "page" attribute on the html:link tag works.
  
  Revision  ChangesPath
  1.6   +70 -59jakarta-struts/src/doc/struts-html.xml
  
  Index: struts-html.xml
  ===
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-html.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- struts-html.xml   2001/01/28 03:48:02 1.5
  +++ struts-html.xml   2001/02/07 23:10:42 1.6
  @@ -1402,15 +1402,19 @@
   pRenders an HTML codelt;imggt;/code element with
   the image at the specified URL.  Like the link tag, URL
   rewriting will be applied automatically to the value
  -specified in codesrc/code, to maintain session state
  +specified in codesrc/code or codepage/code,
  +to maintain session state
   in the absence of cookies.  This will allow dynamic
   generation of an image where the content displayed for this
   image will be taken from the attributes of this tag./p
   
   pThe base URL for this image is calculated based on
  -the value specified in codesrc/code./p
  +the value specified in codesrc/code or codepage/code.
  +You strongmust/strong specify exactly one of these
  +attributes./p
   
  -pNormally, the codesrc/code you specify will be left
  +pNormally, the codesrc/code or codepage/code that
  +you specify will be left
   unchanged (other than URL rewriting if necessary).  However,
   there are two ways you can append one or more dynamically
   defined query parameters to the codesrc/code URL --
  @@ -1521,18 +1525,6 @@
   /attribute
   
   attribute
  -  nameimageName/name
  -  requiredfalse/required
  -  rtexprvaluetrue/rtexprvalue
  -  info
  -  pThe scriptable name to be defined within this page, so 
  -  that
you can reference it with intra-page scripts.  In other
  -  words, the value specified here will render a "name" element
  -  in the generated image tag./p
  -  /info
  -/attribute
  -
  -attribute
 nameheight/name
 requiredfalse/required
 rtexprvaluetrue/rtexprvalue
  @@ -1600,50 +1592,6 @@
   /attribute
   
   attribute
  -  namesrc/name
  -  requiredtrue/required
  -  rtexprvaluetrue/rtexprvalue
  -  info
  -  pThe URL to which this image will be transferred from
  -  This image may be dynamically modified
  -  by the inclusion of query parameters, as described in the
  -  tag description.  You strongmust/strong specify
  -  the codesrc/code attribute./p
  -  /info
  -/attribute
  -
  -attribute
  -  nameusemap/name
  -  requiredfalse/required
  -  rtexprvaluetrue/rtexprvalue
  -  info
  -  pThe name of the map as defined within this page for
  - mapping hot-spot areas of this image./p
  -  /info
  -/attribute
  -
  -attribute
  -  namevspace/name
  -  requiredfalse/required
  -  rtexprvaluetrue/rtexprvalue
  -  info
  -  pThe amount of vertical spacing between the icon and
  - the text, above and below./p
  -  /info
  -/attribute
  -
  -attribute
  -  namewidth/name
  -  requiredfalse/required
  -  rtexprvaluetrue/rtexprvalue
  -  info
  -  pThe width of the image being displayed.  This parameter
  - is very nice to specificy (along with codeheight/code)
  - to 

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html LinkTag.java

2001-02-07 Thread craigmcc

craigmcc01/02/07 17:08:20

  Modified:src/share/org/apache/struts/taglib/html LinkTag.java
  Log:
  Reset property values for paramId, paramName, paramProperty, and
  paramScope in the release() method.
  
  Submitted by:  Hal Deadman [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.4   +8 -4  
jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java
  
  Index: LinkTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LinkTag.java  2001/01/08 21:36:07 1.3
  +++ LinkTag.java  2001/02/08 01:08:15 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java,v 1.3 
2001/01/08 21:36:07 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/01/08 21:36:07 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java,v 1.4 
2001/02/08 01:08:15 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/02/08 01:08:15 $
*
* 
*
  @@ -86,7 +86,7 @@
* Generate a URL-encoded hyperlink to the specified URI.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/01/08 21:36:07 $
  + * @version $Revision: 1.4 $ $Date: 2001/02/08 01:08:15 $
*/
   
   public class LinkTag extends BaseHandlerTag {
  @@ -377,6 +377,10 @@
   linkName = null;
name = null;
   page = null;
  + paramId = null;
  + paramName = null;
  + paramProperty = null;
  + paramScope = null;
property = null;
   scope = null;
target = null;