Writing of cookie

2000-12-14 Thread Wong Kok Wai

I cannot seem to be able to write a cookie using
Struts. I've tried using the response instance in the
perform method of Action class. No exception was
thrown but the cookie is not written. Anybody has
better success?

TIA!


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



Re: webwork vs. struts

2000-12-14 Thread Wong Kok Wai

I've taken a quick look at webwork few weeks before.
My impressions:

1) the tag libs in webwork are similar to what Struts
has but webwork does not have the template taglib

2) in terms of architecture, webwork has a similar
model-2 as struts, but the struts-config.xml is way
ahead of webwork

3) I prefer the APL as it allows me to use Struts for
commercial product. Of course, I'll contribute back
whatever I can.






--- Chris Wilson <[EMAIL PROTECTED]> wrote:
> hello,
> 
> i was just reading on the jboss mailing list and
> someone was talking about
> using struts with jboss (http://www.jboss.org -- an
> open source j2ee
> implementation).  one of the authors of jboss said
> he was working on a
> similar framework, "but which is *A LOT* simpler,
> flexible, and cleaner."
> 
> i believe it's called web work.  you can get it at
>
ftp://download.sourceforge.net/incoming/webwork-0.7.zip
> 


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



Re: Bad Multi-Threading Performances

2000-12-14 Thread Matthew Strayer

> Since read access still predominates, I'm interested
> in code design patterns
> that do not require locks for reads, but still deal
> with writes safely.  Anyone
> have any good pointers?
> 

Basic CS that should be covered in any OS course. ;-)

One approach is to use a readers/writers scheme where
the readers are preferred, allowing multiple threads
to read at the same time.  Synchronization is still
required but only for short periods of time for
checking sentinel values.  One would code like:

// read method
public Object someMethod() {
  try {
_lock.startReading(); // acquires and releases
monitor
// do some reading
  } finally {
_lock.stopReading();
  }
}

// write method
public void someOtherMethod(Object o) {
  try {
_lock.startWriting();
// do some writing
  } finally {
_lock.stopWriting();
  }
}

I'll dig up my small thread library at work tomorrow
if you want it.

Another approach is to use "immutable" objects that
copy only on writes.  Additionally, although not
appropriate for Struts, one could use a single thread,
as in Swing, for performing all writes and a message
queue for queueing the changes to be performed.

-Matt

__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



Struts and weblogic

2000-12-14 Thread Azeem, Syed

Is there anyone who has used struts with weblogic, i have some queries .

thanks
Syed



Re: Why are there 2 ForwardTag classes (and someothers)?

2000-12-14 Thread Richard Backhouse

Thanks Craig

Guess I should have read the documentation better :-)

I now have converted my app from 0.5 to 1.0. Took about 3 hours with no change in
behavior.

Richard Backhouse
Oak Grove Software

"Craig R. McClanahan" wrote:

> [EMAIL PROTECTED] wrote:
>
> > Craig,
> >
> > I've just completed converting my apps to struts 1.0 from 0.5 and have a couple
> > of tags that I still have to use from the original struts.tld. I couldn't find
> > equivilent functionality in any of the new tlds for these tags. They are :
> >
> > struts:htmlProperty
>
> Check out
>
> 
>
> >
> > struts:enumerate
> >
>
> and .  Struts 1.0 requires Java2, and the iterate tag that was
> already present in Struts 0.5 is a superset of the enumerate tag, so only iterate
> was kept.
>
> >
> > Are there any plans to make these tags (or equivilents) in the new tlds ?
> >
> > Thanks
> > Richard Backhouse
> > Oak Grove Software
> >
>
> Craig McClanahan




RE: Actions with parameters

2000-12-14 Thread Oliver Burn
Title: RE: Actions with parameters





> -Original Message-
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 14 December 2000 19:57
> To: [EMAIL PROTECTED]
> Subject: Re: Actions with parameters
> 
> Till Nagel wrote:
> 
> > Is there any possibility to map actions with different parameters?
> >
> > Something like:
> >
> > 
> >   
> > 
> >
> > 
> >   
> >   
> > 
> >
> > There would be two advantages:
> > The designers do not have to be aware of parameters. They 
> just call some
> > action.do's.
> > If we want to change the logic (i.e. the parameters) we 
> must only change it
> > at struts-config.xml instead of everywhere referring to this action.
> >
> 
> How about:
> 
> 
>  type="actions.NewsListAction">
> 
> 
> 
> The Struts example application uses this technique quite a 
> bit.  At runtime, the
> servlet container merges any request parameters on the path 
> listed here with
> those from the original request when it does the forward.


I suspect this would not work for POST requests!?


Using the  tag with seems to be clearer and
safer (read work with more Servlet Engines).


> 
> >
> > Regards,
> > Till
> 
> Craig McClanahan
> 


Oliver Burn





Use of BeanUtils.getArrayProperty() etc.

2000-12-14 Thread Eric Wu

I am wondering when the following methods should be used:
   BeanUtils.getScalarProperty()
   BeanUtils.getIndexedProperty()
   BeanUtils.getArrayProperty()

I guess I'm trying to understand what support there is within Struts 1.0 for
populating beans containing collections of objects (other than the standard
Java types).  I see that these methods exist but they do not seem to be
called (directly or indirectly) by BeanUtils.populate().  Can anybody shed
some light on this?  What are some guidelines for using BeanUtils and
PropertyUtils?

Thanks!

Eric Wu  
Java Architect   
www.GlobalMedic.com




Has anyone deployed struts to iPlanet?

2000-12-14 Thread Lou . Farho

I am looking for individuals who are using Struts with iPlanet so I can get
some lessons learned.

Thanks!

Lou Farho
Sr. Engineer
Level (3) Communications, Inc.
720-888-7751




Re: Struts DTD version..

2000-12-14 Thread Craig R. McClanahan

Jannik Nørgaard Steen wrote:

> Hi,
>
> it seems that the DTD avaliable at
> http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd is version 1.3
> In the Struts 20001209 the DTD version is 1.5. Should the DTD at the jakarta
> site also be version 1.5 ?
>

Yep, it should.  I will update that today, after a couple of more changes to it.

>
> Med venlig hilsen/Best Regards
> ---
> Jannik Nørgaard Steen

Craig McClanahan





Re: webwork vs. struts

2000-12-14 Thread Craig R. McClanahan

Chris Wilson wrote:

> hello,
>
> i was just reading on the jboss mailing list and someone was talking about
> using struts with jboss (http://www.jboss.org -- an open source j2ee
> implementation).  one of the authors of jboss said he was working on a
> similar framework, "but which is *A LOT* simpler, flexible, and cleaner."
>
> i believe it's called web work.  you can get it at
> ftp://download.sourceforge.net/incoming/webwork-0.7.zip
>
> anyhow, i'm not writing about this to publicize competitors to struts (cause
> i think it rocks!), however, i'm just curious if anyone (craig?) has heard
> of this or actually played with it?  i'm interested in your thoughts if
> you've seen it.  how does it compare?
>

If that is Rickard's project, he and I have chatted briefly, and have a lot of
commonality in our goals, but some differences in approach, and -- at least at
that time -- preferred open source license (Struts uses the Apache Software
License; last time I checked all the JBoss stuff was GPL or LGPL).

I have not had a chance to play with this to date, so cannot give you any more
detailed or useful comparison.  But Rickard is a smart guy, so I'm certainly
going to re-use any good ideas that I see there if they fit in to Struts :-)


> cheerio,
> chris
>
> | chris wilson || web dev ||| www.wondergeek.com || |

Craig





Re: Bad Multi-Threading Performances

2000-12-14 Thread Craig R. McClanahan

Van der Auwera Koen wrote:

> Hello,
>
> Why is it that struts uses objects that are synchronized (hashtable, vector)
> ?
> This really sucks in a multi-threaded environment!!
>
> I mean, Struts is crowded with objects that could be thought as 'read-only'
> (initialized at the server startup)
> Because the Hashtable methods are synchronized, this causes a huge
> performance drop in a multi-client environment.
> Maybe a better way to handle this is to use the JDK1.2 hashmap
>

> Some defense please...
>

Not defense, necessarily, but a little history is useful ...

When Struts started out, JDK 1.1 compatibility was considered very important by
the community -- so we stuck with JDK 1.1 collection classes.  That feeling has
only very recently changed, and a migration to Java2 collection classes has not
yet been completed.

That being said, many/most of these "read only" collections can still be changed
at runtime.  For example, the cache of Action instances is modified every time
you call a new Action for the very first time.  Others (such as the set of
defined mappings) can be dynamically changed if you include one of the standard
Actions (see package org.apache.struts.actions) that lets you manage this
remotely.

Since read access still predominates, I'm interested in code design patterns
that do not require locks for reads, but still deal with writes safely.  Anyone
have any good pointers?

>
> Koen Van der Auwera
>

Craig





Re: usage of select tag when multiple is set

2000-12-14 Thread Till Nagel

Hi,

> Is there a possibility to use the select tag with multiple="1" and let the
> action class make the matching to a Collection in the form object?
I have extended the Select- and the Options-Tag to support multiple select
boxes a while ago. But sadly the tags just suport String-Arrays instead of
Collections. That's because of the result type of getParameterValues(..).
One could change that (convert it into a Collection) but how to decide which
usage in BeanUtils.populate(..)?

So for now use it this way


Your ObjectForm needs an attribute myStringArray which is set by the
ActionServlet.


Regards,
Till

P.S. Excuse the bad style just to change the Struts-Tags instead of really
extending them. I'd changed them quick'n'dirty.

 OptionsTag.java
 SelectTag.java


Struts DTD version..

2000-12-14 Thread Jannik Nørgaard Steen

Hi,

it seems that the DTD avaliable at
http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd is version 1.3
In the Struts 20001209 the DTD version is 1.5. Should the DTD at the jakarta
site also be version 1.5 ?

Med venlig hilsen/Best Regards
---
Jannik Nørgaard Steen
Software Developer
Digital Zone International

http://www.digitalzone.dk
mailto:[EMAIL PROTECTED]
---
"As a software developer, I can offer you this advice:
if you have a performance issue, buy faster hardware!"





webwork vs. struts

2000-12-14 Thread Chris Wilson

hello,

i was just reading on the jboss mailing list and someone was talking about
using struts with jboss (http://www.jboss.org -- an open source j2ee
implementation).  one of the authors of jboss said he was working on a
similar framework, "but which is *A LOT* simpler, flexible, and cleaner."

i believe it's called web work.  you can get it at
ftp://download.sourceforge.net/incoming/webwork-0.7.zip

anyhow, i'm not writing about this to publicize competitors to struts (cause
i think it rocks!), however, i'm just curious if anyone (craig?) has heard
of this or actually played with it?  i'm interested in your thoughts if
you've seen it.  how does it compare?

cheerio,
chris

| chris wilson || web dev ||| www.wondergeek.com || |




Bad Multi-Threading Performances

2000-12-14 Thread Van der Auwera Koen

Hello, 

Why is it that struts uses objects that are synchronized (hashtable, vector)
?
This really sucks in a multi-threaded environment!!

I mean, Struts is crowded with objects that could be thought as 'read-only'
(initialized at the server startup)
Because the Hashtable methods are synchronized, this causes a huge
performance drop in a multi-client environment.
Maybe a better way to handle this is to use the JDK1.2 hashmap 


Some defense please...


Koen Van der Auwera



The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
The Capital Markets Company.

http://www.capco.com
***




Re: Example for Internationalization

2000-12-14 Thread Michael Westbay

MARGALEFF-san wrote:

> I am also interested in this example. Did you post it somewhere and I
> missed?

Kapur-san posted it to the list on 2000/12/07.  You can find it in the
mail archives at:

http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg00999.html

It's a very good example.  Took just minutes to add Japanese support.

--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:   http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/



Re: Actions with parameters

2000-12-14 Thread Till Nagel

Hi,

> How about:
>   type="actions.NewsListAction">
> 
> 
How does it work? If I use it as in the example above there is no correct
mapping path (neither /newsListAFew.do nor /newsListAFew?number=10.do).

> The Struts example application uses this technique quite a bit.
Did you mean this?


That's not the mechanism I have searched for.
But if there is any easier way (without using own ActionMapping class) to
call actions with parameters, I would be glad to hear about.


Regards,
Till






Re: Problem with daily binary distribution

2000-12-14 Thread Craig R. McClanahan

Wong Kok Wai wrote:

> The daily binary build seems to have stopped since
> 10th Dec. Same goes for the source distribution. I
> cannot get the sources from CVS directly due to
> firewall. Can the nightly build start again?
>

That was my fault.  You should be able to download nightly builds from last
night and tonight.  I will double check in the morning.

Craig





Re: Dynamic form

2000-12-14 Thread Craig R. McClanahan

Wong Kok Wai wrote:

> What's the recommended way to implement a dynamic form
> using Struts? Typical scenario: an address book for
> email where the number of contacts varies. No problem
> with renderering the form in the JSP but how do I
> associate the " instance of the ActionForm?
>

Struts 1.0 does not really address the issue of dynamic forms -- it is more
focused on "static forms where the names of the request parameters, and thus the
names of the corresponding properties on your ActionForm bean, are known.

Elegant support for dynamic forms will be a focus area for Struts 1.1.

>
> TIA!
>

Craig McClanahan





Re: Example for Internationalization

2000-12-14 Thread Josep SERRANO MARGALEFF

Hello all,

I am also interested in this example. Did you post it somewhere and I
missed?

Cheers,
Pep

Michael Westbay wrote:
> 
> Kapur-san wrote:
> 
> > I was building some prototype for my company and I have modified the Struts
> > out-of-box example to add a language drop down on the Login page (which just
> > displays English and German) and if the user logs in after selecting the
> > language as German all the screens are in German.
> >
> > If anybody is interested I can post the modified example and the code.
> 
> I think a lot of people are interested.  Perhaps it would be best to put the
> .war file up on a web site that it can be downloaded from, then send the
> URL to the list.  Anyone who wants it can get it from there.  Those who don't
> won't lose the bandwidth.
> 
> If you don't have an extronet site to place it on, I'd be more than happy to
> put it up for you.



Re: reset(..) in ActionForm

2000-12-14 Thread Craig R. McClanahan

"SHROM,BENJAMIN (HP-USA,ex1)" wrote:

> Hello,
>
> When does reset(..) in ActionForm being called ?
>
> >From API:
> "This method is called before the properties are repopulated by the
> controller servlet."
>
> What are the cases when it happens?
>

As Ron points out, it is called immediately before the property setters that
correspond to the request parameters in your form are called.

A primary reason this method exists is to deal with checkboxes.  Due to
restrictions of the way HTML forms work, you will receive notification if a
checkbox is checked, but *not* if it is unchecked.  To make sure that your
checkboxes are recorded accurately, you should set the corresponding boolean
property to null in the reset() method.

>
> Regards,
> Benjamin.

Craig McClanahan





Re: Database connection pool bug

2000-12-14 Thread Craig R. McClanahan

Howard Moore wrote:

> There appears to still be a problem with the database connection pool when
> used with the JDBC-ODBC bridge (build 20001209).
>
> In the close() method of org.apache.struts.util.GenericConnection the
> statement
>
> "conn.setTypeMap(this.map);"
>
> throws an UnsupportedOperationException rather than a SQLException (at least
> when used with the Microsoft SQL Server ODBC driver). Since this is not
> caught the method fails and the connection is not returned to the pool.
>

Grr ... I wish people would update their drivers if they implement the new JDBC
methods :-(

I will fix close() to ignore this error.

> Howard Moore

Craig McClanahan





Re: Use of Actionmappings

2000-12-14 Thread Craig R. McClanahan

De Smet Koen wrote:

> Hi,
>
> As I see it now, in Struts, each form has 0 or 1 action. If you want to use
> multiple buttons in one form, you have to add parameters to the action to
> define what should be done by the action.
>

The key issue is that an HTML form only has one action.  However, as others have
pointed out, you can attach JavaScript code to your alternate buttons that
adjust the destination to which the form will be posted -- and thus invoke
different actions.

>
> Is it possible to say in 1 form to connect 1 action to each button in stead
> of using parameters?
> Is it possible to use regular expressions?
>
> Thanks,
>
> Koen
>

Craig McClanahan





Re: Actions with parameters

2000-12-14 Thread Craig R. McClanahan



Till Nagel wrote:

> Is there any possibility to map actions with different parameters?
>
> Something like:
>
> 
>   
> 
>
> 
>   
>   
> 
>
> There would be two advantages:
> The designers do not have to be aware of parameters. They just call some
> action.do's.
> If we want to change the logic (i.e. the parameters) we must only change it
> at struts-config.xml instead of everywhere referring to this action.
>

How about:





The Struts example application uses this technique quite a bit.  At runtime, the
servlet container merges any request parameters on the path listed here with
those from the original request when it does the forward.

>
> Regards,
> Till

Craig McClanahan





Re: Idle timeout Handling

2000-12-14 Thread Craig R. McClanahan



Shiraz Wasim Zaidi wrote:

> Hi!,
>
> I have just started working with the struts framework and like it a lot.
> I have a question about idletimeout handling. The only way i can handle it
> now is to do an idle timeout check at the start of perform method of my
> action classes.
> I cannot rely on getSession(false) check as i wont get a null session in
> case i have a
> session scoped form asscoiated with the mapping. I can check for some
> attribute say user
> profile that i bind to the session in the Authenticating action class.
>

Even if the controller servlet calls getSession() for you (as it does when you
have a session-scoped ActionForm bean), it is still quite easy to check for
expired sessions.

When you initially log a user on, store an object specific to that user in the
session (the Struts example application stores an instance of the User class).
Then, if a new session got created for you, this object will be missing -- so
you can easily detect that this happened.

If you want such a check on every single request sent to the controller servlet,
you might consider subclassing the controller servlet and adding your own custom
check at the appropriate point.

> Is there someother way idle timeouts can be handled then doing it repeatedly
> in almost every action class?
>

Don't forget to check in your JSP pages as well -- in case the user bookmarks a
page and then returns to it directly, rather than through the controller
servlet.

The Struts example application includes an application-specific custom tag
() that makes exactly this sort of a check.

>
> Appreciate any response.
>

A completely different approach is to use container-managed security, as
described in the Servlet API Specification
.  Here, you are relying on
the servlet container to manage user logon, so that you do not have to check
anything on a per-request basis.

>
> Thanks,
> Shiraz

Craig McClanahan





Re: Why are there 2 ForwardTag classes (and someothers)?

2000-12-14 Thread Craig R. McClanahan



[EMAIL PROTECTED] wrote:

> Craig,
>
> I've just completed converting my apps to struts 1.0 from 0.5 and have a couple
> of tags that I still have to use from the original struts.tld. I couldn't find
> equivilent functionality in any of the new tlds for these tags. They are :
>
> struts:htmlProperty

Check out



>
> struts:enumerate
>

and .  Struts 1.0 requires Java2, and the iterate tag that was
already present in Struts 0.5 is a superset of the enumerate tag, so only iterate
was kept.

>
> Are there any plans to make these tags (or equivilents) in the new tlds ?
>
> Thanks
> Richard Backhouse
> Oak Grove Software
>

Craig McClanahan





Re: Why are there 2 ForwardTag classes (and someothers)?

2000-12-14 Thread Craig R. McClanahan

Johan Compagner wrote:

> > The tags listed in "struts.tld" (and implemented in the org.apache.struts.taglib 
>package) are
> > the Struts 0.5 version of the tags, and are only kept for backwards compatibility. 
> New code
> > should use the separate tag libraries.
>
> and for complete backwards compatibility you can't point the old struts.tld to the 
>new code.
> if struts.tld goes away, where does the ifAttributeMissing goes to?
>

All of the "if" tags have been replaced by much more powerful and generalized tags in 
the "logic"
library.  For example,  becomes just one of the cases 
supported by the
 tag.

In addition to checking for the presence of attributes,  can check for 
the presence
of particular bean properties, cookies, request headers, and request parameters.

For more information on this particular set of tags, see

http://jakarta.apache.org/struts/struts-logic.html

>
> johan

Craig McClanahan