Re: How does one get an instance of the GenericDataSource?

2000-12-27 Thread Ted Husted

I've adapted to Struts the first JDBC example from Core Servlets and
JavaServer Pages by Marty Hall  http://coreservlets.com/ . 

There's a ZIP available for download at 
http://husted.com/about/struts/ .

Comments are of course welcome. The Struts treatment is only meant to
be as robust as Hall's original example (see http://coreservlets.com -
chapter 18).

I'd be interested in any experience anyone has had with getting more of
the business logic out of the Struts Actions. 

In a relational DBMS application, most of the real business logic is
expressed in the SQL statements, and so it might be enough to just
store the SQL statements in a seperate resource could be used by
another (non-Web) application. Thoughts?

fruits readme
=

This is a simple Struts adaption of the first JDBC example from Core
Servlets 
and JavaServer Pages by Marty Hall  http://coreservlets.com/ . 

Prequesites are a Servlet/JSP container, like Tomcat 3.2 and MySQL. 

To start, enter
http://localhost:8080/coreservlets-jdbc/fruitCreation.do

This should create a test table in your MySQL installation, and then
retrieve 
and display a sample report.

See WEB-INF/struts-config.xml for more about setting up MySQL. You can
also 
configure for another JDBC from here.

Java 2 binaries (JDK 1.2.2) are included, along with a sample build.xml
for Ant.

(See jakarta.apache.org for more about Ant.)

The build file is setup to copy the class files to the webapps folder,
so you 
may need to edit the path for it to work with your installation. 

To build, you will also need j2ee.jar in your classpath. You can get
this from 
the jd2sdkee.

This is setup as a ZIP file that you can extract to your webapps folder
for now. 
WAR to follow.

-- Ted Husted, 2000-DEC-27  [EMAIL PROTECTED] .





Re: Help: logic:iterate and form input fields

2000-12-27 Thread Ted Husted



A clear statement of what you need to accomplish, without posing a 
particular implementation, might be helpful. I'm not exactly sure what it is you 
need to do. My first guess is that the part about "count" should be encapsulated 
in a bean, and not exposed to the JSP. But I'm not sure if I understand the 
business or application logic behind your question well enough.
*** REPLY SEPARATOR 
***On 12/27/2000 at 8:51 AM Chandan Kulkarni wrote: 

Actually OrderItem is an object with several fields. I trimmed 
it down to just one field to simplify the problem. So "items" is an ArrayList of 
OrderItems.

I couldn't find the right combination of nested/indexed 
property names for the form:text tag to generate the correct input tag. Here's 
what I tried...

form:text name="orderItems" property="%= "orderitems[" 
+ count + "]" %" 
 
value="%= ((OrderItem)orderlist).getItemNumber() %" 
/
When it can't find the correct property name in the bean it 
gives a compilation error.I used a run-time expression to create 
items[0].itemName. In this case the form:text tag is just ignored and is left in 
the html generated just as is...

It seems the only way to use an indexed/nested property name 
is to use the input tag itself.

I am using the struts 12/15 build

Thanks,

 -Chandan 

  -Original Message-From: 
  Ted Husted [EMAIL PROTECTED]To: 
  Struts List [EMAIL PROTECTED]Date: 
  Tuesday, December 26, 2000 4:32 PMSubject: Re: Help: 
  logic:iterate and form input fields
  If I understand the situation, you might be able to do this with an array 
  of orderItem beans (orderItems), with getName and getValue methods.
  
  logic:iterate name="orderItems" id="orderItem" 
  tr TD  
  form:text name="orderItem" / /td 
  /TR/logic:iterate
  
  form:text should then call getName and getValue for the name and value of 
  each text field.
  
  getName might use and internal counter to give the text fields different 
  names. 
  *** REPLY SEPARATOR 
  ***On 12/26/2000 at 3:50 PM Chandan Kulkarni wrote: 
  
  I am trying to use logic:iterate to iterate 
  through a list of order items.I cannot get it to work. I have seen several 
  emails about patches for handling nested and indexed properties... 
  
  
  OrderForm consists of an ArrayList of items.
  
  I have added indexed getters ArrayList 
  getItems()and  OrderItem getItems(int 
  index)
  
  I can't see how an indexed setter would help for setting the 
  properties of OrderItems. Here are partsof my 
  orderform.jsp==
  
  form:form action="orderform.do" name="orderform" 
  type="OrderForm" 
  
  TABLETRTD Order Number : 
  /TDTD form:text name="orderform" 
  property="orderNumber" / 
  /TD/TR 
  ...% int count=0; %logic:iterate id="orderlist" 
  name="orderform" property="items" length="2"tr 
  TD  form:text name="orderlist" 
  property="itemNumber" 
   
  value="%= ((OrderItem)orderlist).getItemNumber() %" / 
  /td  /TR% count++; 
  %/logic:iterate
  
  form:submit//form:form==
  
  Unfortunately this generates input tags with identical names 
  for each iteration. This is a problem when you try to set the properties in 
  the items.The value= part of the form:text tag is a hack to get 
  the values from the Bean.
  
  Since the name generated needs to be unique I replaced 
  the form:text lines with input tags like this:
  
   input TYPE="TEXT" name="%= 
  "items.itemName[" + count++ + "]" %" value="%= 
  ((OrderItem)orderlist).getItemName() %" / 
  
  the run-time expression used above cannot be used in the 
  form:text property value, so you have to use the input tag.
  
  This still does not allow for setting the values in the 
  OrderItem...
  
  Also what do you think of the name used above...should 
  it be items[0].itemName (more semantically correct - I 
  think)
  
  or should it be 
  items.itemName[0]...
  
  I have tried both but that doesn't work...
  
  Does anyone have any pointers/suggestions to get this to 
  work...?
  
  Thanks in advance
  
   -Chandan



Re: Help: logic:iterate and form input fields

2000-12-27 Thread Ted Husted



Are youtrying to do something like this order form 
(Javascript) 

https://public.wxxi.org/schedules/fm/voice-order.htm

This only shows one item, but the idea is that 
there would be one line for each item in a small inventory.




-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/




Can't Connect to PostgreSQL with struts-example on Orion App Server

2000-12-27 Thread Neal Kaiser

Can someone tell me what I'm missing?

In web.xml I have:

servlet
servlet-namedatabase/servlet-name
servlet-classorg.apache.struts.example.DatabaseServlet/servlet-class
init-param
  param-namedebug/param-name
  param-value2/param-value
/init-param
load-on-startup1/load-on-startup
  /servlet


In struts-config.xml I have:

data-source
 autoCommit="false"
description="Example Data Source Configuration"
driverClass="org.postgresql.Driver"
   maxCount="4"
   minCount="2"
   password="password"
url="jdbc:postgresql://localhost/galacy"
   user="galacy"
  /


I know that my postgresql.jar is OK and have tried a connection successfully
with the jdbc URL above.

When I go to localhost/struts-example I get:

ERROR: User database not loaded -- check servlet container logs for error
messages

What's weird is that since I have debug=2 I should see some log() statements
about connecting to PostgreSQL. I get nothing in my log. The only thing I
see on my console is:

New org.apache.struts.util.GenericDataSource
Set org.apache.struts.util.GenericDataSource properties
Call
org.apache.struts.action.ActionServlet.setDataSource(GenericDataSource[activ
eCount=0, autoCommit=false, closed=false, description=Example Data Source
Configuration, driverClass=org.postgresql.Driver, loginTimeout=0,
maxCount=4, minCount=2, password=password, readOnly=false,
url=jdbc:postgresql://localhost/galacy, useCount=0, user=galacy])
Pop org.apache.struts.util.GenericDataSource


Any ideas?

Thanks.




RE: Proposal: RetroFit Struts with the Delegation Event Model

2000-12-27 Thread McCay, Larry

I agree - I would like to see the inclusion of events for any and all
interesting events.

I think the following article link may be of some interest as well:

http://www.sys-con.com/java/archives/0601/grant/

It includes an interesting implementation of events for template based
processing - for pre and post processing of jsp includes.  I like the
concepts of a Document class and ModelContext.

Personally, I would like to see a View class/interface and ViewContext and
Controller class/interface and Controller Context as well.

Coupled with appropriate event subscriptions and notifications Struts would
more closely resemble the original MVC model.

It would be interesting to use this notification mechanism to allow for
multiple Views to be notified of Model Change Events.  This would open the
door ( a little wider at least ) for other types of application development
such as B2B.

The controller seems the appropriate place from which to fire events.

* Single ActionEvent class, or subclasses for various types
  of events that have different properties (some events care
  about the current ActionMapping and some don't).

Subclasses

* SIngle registrations of ActionListeners that receive all types of
  events, or separate registrations for separate event families?

Seperate event listener registrations for event families seems the cleanest
implementation and would eliminate event-storm like activity.

* An ActionEvent, or the ActionListener that receives it,
  should have knowledge of the ActionServlet
  it is associated with, to provide access to underlying resources
  provided by the servlet.  (The whole event listener model is
  intimately tied to Struts anyway, so this does not seem onerous).

This would be a good place for the Controller class/interface and
ControllerContext.

Just my 2 cents.

Thanks,

Larry

-Original Message-
From: Craig R. McClanahan
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: 12/26/00 9:57 PM
Subject: Re: Proposal: RetroFit Struts with the Delegation Event Model

I like the basic idea of event listeners for Struts events.  About the
particular proposal, though, I've got some comments and questions I
would like
feedback on.

* As fleshed out, the only events reported with this model so far
  are before and after an Action's perform() method is called.
  The abstract talks about building listeners for all "interesting"
  events.  If we're going to do a listeners model, I think we should
  extend it to basically all of the processXxx methods, not just
  processPerform().

* If we go with generalized events, putting the firing logic inside
  Action seems wrong -- general purpose support classes, or
  public methods inside ActionServlet, seem more appropriate.

* Given that there will be many more events, we've got some
  representation choices:

* Single ActionEvent class, or subclasses for various types
  of events that have different properties (some events care
  about the current ActionMapping and some don't).

* SIngle registrations of ActionListeners that receive all types of
  events, or separate registrations for separate event families?

* I also have a couple of nit-picky type thoughts:

* Event type codes inside the ActionEvent seem redundant,
  given that the type is implicitly defined by which listener
  method you call.

* An ActionEvent, or the ActionListener that receives it,
  should have knowledge of the ActionServlet
  it is associated with, to provide access to underlying resources
  provided by the servlet.  (The whole event listener model is
  intimately tied to Struts anyway, so this does not seem onerous).

* We need to use collection classes (with an implementation I'm
  currently working on) that do not require lots of synchronization
locks
  or new object creations when processing event notifications, since
  they happen on every request.

Thoughts?

Craig



David Geary wrote:

 ABSTRACT

 It's often convenient, and sometimes necessary, to handle Struts
events,
 such as when an action has its locale set, or when the action servlet
 processes an action's form. This document proposes retrofitting Struts
 with the delegation event model. That model, which is used by the AWT
 and
 Swing, makes event handling simple, flexible, and scalable.

 CREDITS

 Delegation and Event Model for Struts? -- posted to struts-dev by
   Robert Leland

 INTRODUCTION

 Currently, you can use inheritance to handle Struts events like those
 described above. Typically, that means extending ActionServlet and
 overriding a protected method, such as
 ActionServlet.processActionPerform.

 Inheritance-based event handling is inflexible and does not scale well
 because event sources and listeners are tightly coupled at compile
time.
 This was evident to AWT engineers, who replaced the AWT's original
 inheritance-based event model 

Null Pointer Exception in Stuts 0.5 example

2000-12-27 Thread HT Levine

Hi.  I am new to using struts.  I requested the FAQ for this mailgroup and
apparently there isn't one.  I am using version 0.5 with Weblogic5.1 and
trying to run the example application.  I am getting the following
stacktrace. It seems the ApplicationResources.properties files is not being
found?  I put this in the org.apache.stuts.example directory with the .class
files?  ANy  help you can give is much appreciated.


Wed Dec 27 08:46:26 PST 2000:E ServletContext-General Root cause of
ServletException
java.lang.NullPointerException
at
weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:159)
at
org.apache.struts.taglib.IfAttributeMissingTag.doStartTag(IfAttributeMissing
Tag.java:94)
at jsp.index_45_example._jspService(index_45_example.java:83)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:124)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:142)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:744)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:692)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:251)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)



Re: Mildly complex bean:message situation

2000-12-27 Thread Craig R. McClanahan

Erik Horstkotte wrote:

 [snip]
 The problem, of course, is that

 bean:message key="foo" arg="uri"

 won't work, because I can't use form:rewrite for the uri arg.

 Any ideas?


How about something like this:

bean:message key="foo"
 arg0='%= response.encodeURL("url") %'/

Craig



Re: Example App - A Walking Tour

2000-12-27 Thread Craig R. McClanahan

Wong Kok Wai wrote:

 Thanks! I was hoping for Struts 1.0 FCS for Christmas

I was too :-(.  But this week should go a long ways towards getting to a 1.0
release.


 but this also make my day.


Yep.  Thanks Ted!

Craig



Weblogic 510 struts

2000-12-27 Thread Sharon Curlee


Can anyone help shed some light on this error?  I have been aggrivated
with this error all morning and havent the faintest clue ... Oh - and
this is being deployed to Weblogic 510 sp6.

Wed Dec 27 13:17:55 EST 2000:E WebAppServletContext-prototype Root
cause of ServletException
javax.servlet.ServletException: runtime failure in custom tag 'message'
at jsp_servlet._index._jspService(_index.java:105)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:123)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:141)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContex
tImpl.java:761)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContex
tImpl.java:708)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletCon
textManager.java:252)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:3
46)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:246)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:135)
Wed Dec 27 13:17:55 EST 2000:I ServletContext-General servletimages:
init

Any help is greatly apprecitated.  Thanks!

BTW - Has anyone been able to run a Struts web app on Weblogic ONLY?


Sharon Curlee
Software Engineer

elogex, inc.
212 S. Tryon St.
Ste 303
Charlotte NC, 28281
(704) 227-1928





Is there a good documentation for all the xml config files parameters/settings that can be used?

2000-12-27 Thread Johan Compagner

Hi,

What parameters can i use and is recognized by struts in the WEB.XML file?
And the struts-config.xml? (i know i can look into the dtd but is there also a 
doc/html that explains everything?)

johan





Re: Weblogic 510 struts

2000-12-27 Thread Andreas Doerr

Hi Sharon,

 Can anyone help shed some light on this error?  I have been aggrivated
 with this error all morning and havent the faintest clue ... Oh - and
 this is being deployed to Weblogic 510 sp6.

I guess your want to run the struts example application ...

Please see the message "Re: Null Pointer Exception in Struts 0.5 example" by
Alain Bienvenue. The basic problem is, that WLS 510 does not honor the
"load-on-startup" attribute. This means that ActionServlet will not be properly
initialized.

One possible solution is to make a fake request to ActionServlet before any
other processing.

Regards,
--Andreas



Re: Weblogic 510 struts

2000-12-27 Thread Doug Bateman

 I guess your want to run the struts example application ...
 
 Please see the message "Re: Null Pointer Exception in Struts 0.5 example" by
 Alain Bienvenue. The basic problem is, that WLS 510 does not honor the
 "load-on-startup" attribute. This means that ActionServlet will not be properly
 initialized.
 
 One possible solution is to make a fake request to ActionServlet before any
 other processing.

I've successfully worked around the problem by reconfiguring struts to
"lazy initialize" itself, meaning that every servlet first runs an init
method, which then checks the config and initializes it as
necessary.  This way the application is no longer dependant on the order
in which the servlets initialize.  Sure, the check adds a small amount of
overhead, but it truely is negligable.

-- 
He who pursues learning will increase every day;
He who pursues The Eternal will decrease every day.
He will decrease and continue to decrease,
Till he comes at non-action;
By non-action everything can be done.

 Lao-Tzu (fl. B.C. 600)
 Chinese Philosopher - Founder of Taoism




RE: Weblogic 510 struts

2000-12-27 Thread Sharon Curlee

calling the .do directly worked.  Grr .. just a tad bit frustrating.

Thanks so much!

-Original Message-
From: Andreas Doerr [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 27, 2000 1:44 PM
To: [EMAIL PROTECTED]
Subject: Re: Weblogic 510  struts


Hi Sharon,

 Can anyone help shed some light on this error?  I have been aggrivated
 with this error all morning and havent the faintest clue ... Oh - and
 this is being deployed to Weblogic 510 sp6.

I guess your want to run the struts example application ...

Please see the message "Re: Null Pointer Exception in Struts 0.5
example" by
Alain Bienvenue. The basic problem is, that WLS 510 does not honor the
"load-on-startup" attribute. This means that ActionServlet will not be
properly
initialized.

One possible solution is to make a fake request to ActionServlet before
any
other processing.

Regards,
--Andreas



Re: Weblogic 510 struts

2000-12-27 Thread Andreas Doerr

Hi Doug,

 I've successfully worked around the problem by reconfiguring struts to
 "lazy initialize" itself, meaning that every servlet first runs an init
 method, which then checks the config and initializes it as
 necessary.  

could you please explain this in a little more detail?

The problem with the struts example application is, that 'index.jsp' is
configured to be the welcome file of the web app. This means it is kind of an
'index.html' for the web app.

At the beginning of 'index.jsp' a message tag is used. Message tag relies on the
initialization work done by ActionServlet. However at this point in time no
servlet has been called at all. So I don't see how "lazy initialize" done by an
init method should help in this case.

Regards,
--Andreas



Re: Example App - A Walking Tour

2000-12-27 Thread Ted Husted

My pleasure!

(Though, to be honest, I had to turn my clock back to make my Christmas
deadline!)

*** REPLY SEPARATOR  ***

On 12/27/2000 at 9:54 AM Craig R. McClanahan wrote:
Wong Kok Wai wrote:
 Thanks! I was hoping for Struts 1.0 FCS for Christmas
I was too :-(.  But this week should go a long ways towards getting to
a 1.0release.

 but this also make my day.
Yep.  Thanks Ted!





Re: Proposal: RetroFit Struts with the Delegation Event Model

2000-12-27 Thread David Geary

"Craig R. McClanahan" wrote:

 * As fleshed out, the only events reported with this model so far
   are before and after an Action's perform() method is called.
   The abstract talks about building listeners for all "interesting"
   events.  If we're going to do a listeners model, I think we should
   extend it to basically all of the processXxx methods, not just
   processPerform().

Yes.

 * If we go with generalized events, putting the firing logic inside
   Action seems wrong -- general purpose support classes, or
   public methods inside ActionServlet, seem more appropriate.

Agreed. I vote for a support class.

 * Given that there will be many more events, we've got some
   representation choices:

 * Single ActionEvent class, or subclasses for various types
   of events that have different properties (some events care
   about the current ActionMapping and some don't).

I envision an event hierarchy.

 * SIngle registrations of ActionListeners that receive all types of
   events, or separate registrations for separate event families?

The latter would be more type-safe, and is probably preferred.

 * I also have a couple of nit-picky type thoughts:

 * Event type codes inside the ActionEvent seem redundant,
   given that the type is implicitly defined by which listener
   method you call.

True, but that assumes that the handler will never pass the event
to other methods that need to distinguish the event type -- the
information's not available to those methods.

 * An ActionEvent, or the ActionListener that receives it,
   should have knowledge of the ActionServlet
   it is associated with, to provide access to underlying resources
   provided by the servlet.  (The whole event listener model is
   intimately tied to Struts anyway, so this does not seem onerous).

Agreed.

 * We need to use collection classes (with an implementation I'm
   currently working on) that do not require lots of synchronization locks
   or new object creations when processing event notifications, since
   they happen on every request.

Ok.


david



 Thoughts?

 Craig

 David Geary wrote:

  ABSTRACT
 
  It's often convenient, and sometimes necessary, to handle Struts events,
  such as when an action has its locale set, or when the action servlet
  processes an action's form. This document proposes retrofitting Struts
  with the delegation event model. That model, which is used by the AWT
  and
  Swing, makes event handling simple, flexible, and scalable.
 
  CREDITS
 
  Delegation and Event Model for Struts? -- posted to struts-dev by
Robert Leland
 
  INTRODUCTION
 
  Currently, you can use inheritance to handle Struts events like those
  described above. Typically, that means extending ActionServlet and
  overriding a protected method, such as
  ActionServlet.processActionPerform.
 
  Inheritance-based event handling is inflexible and does not scale well
  because event sources and listeners are tightly coupled at compile time.
  This was evident to AWT engineers, who replaced the AWT's original
  inheritance-based event model with the delegation event model.
 
  The delegation event model, which has its roots in java.util, implements
  the Observer design pattern to loosely couple event sources and event
  listeners at runtime. That loose coupling makes it easy to associate
  disparate types of objects, so that event listeners can easily react to
  changes in event sources.
 
  STRUTS AND THE DELEGATION EVENT MODEL
 
  So what does it mean to retrofit Struts with the delegation event model?
  It means that Struts will fire events when it performs certain
  functions. You can register with Struts as an event listener, and
  handle events as you see fit.
 
  This proposal advocates firing events for all interesting Struts
  functions; for example, the action servlet should fire a robust set of
  events for processing actions and forms, performing mappings, etc.
  Implementing support for those events follows the same
  design pattern discussed in this proposal for implementing action
  events.
 
  This proposal illustrates how to modify Struts to fire events just
  before, and immediately after, a Struts action has its perform method
  invoked. Those events are hereafter known as action events.
 
  IMPLEMENTING ACTION EVENTS AND ACTION LISTENERS
 
  Getting Struts to fire action events is easy. First, we define a
  listener interface and an event class:
 
  org/struts/apache/event/action/ActionListener.java
  org/struts/apache/event/action/ActionEvent.java
 
  Here's the listing for ActionListener:
 
 public interface ActionListener {
public void beforeActionPerform(ActionEvent event)
  throws ServletException;
public void afterActionPerform(ActionEvent event)
  throws ServletException;
 }
 
  ActionListener methods are 

RE: Weblogic 510 struts

2000-12-27 Thread Doug Bateman

 calling the .do directly worked.  Grr .. just a tad bit frustrating.

What did you do exactly?  This sounds like a nice and really simple work
around.

-- 
He who pursues learning will increase every day;
He who pursues The Eternal will decrease every day.
He will decrease and continue to decrease,
Till he comes at non-action;
By non-action everything can be done.

 Lao-Tzu (fl. B.C. 600)
 Chinese Philosopher - Founder of Taoism




Re: Proposal: RetroFit Struts with the Delegation Event Model

2000-12-27 Thread Ted Husted

On 12/26/2000 at 6:57 PM Craig R. McClanahan wrote:
 An ActionEvent, or the ActionListener that receives it, should have
knowledge of the ActionServlet it is associated with, to provide access
to underlying resources provided by the servlet.  (The whole event
listener model is intimately tied to Struts anyway, so this does not
seem onerous).

I'm not sure of all the implications of this suggestion, but fools rush
in ...

As David mentioned in a followup, the Barracuda/Enhydra gang is working
on an event framework, with the premise that they can then hook it up
to a presentation framework, including Struts and their own. So, I
wonder if the event framework could be another component, that could be
used with or without Struts -- like the custom tag library. The event
framework might link up to the ActionServlet, like a datasource. If a
listener had something to say to Struts, it could post it in the form
of a HTTP Request to the event queue. Struts would fire it's own events
into the queue (if installed), and listen for HTTP Requests posted by
others. 



-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/





Re: Can't Connect to PostgreSQL with struts-example on Orion App Server

2000-12-27 Thread Ted Husted

On 12/27/2000 at 2:31 PM Ted Husted wrote:
  http://husted.com/struts/about/ 

Ooops, should be 

 http://husted.com/about/struts/  






RE: Weblogic 510 struts

2000-12-27 Thread Doug Bateman

That looks more like a classpath problem.  Is the struts jar in listed in
the weblogic servlet classpath, weblogic.httpd.servlet.classpath (in
weblogic.properties)?

On Wed, 27 Dec 2000, Sharon Curlee wrote:

 well, I spoke too soon.  All I did was called action.do directly.  It
 did well in bringing up the index.jsp, but when I try and called another
 .do, it blew up.  I am back to this error. (and I called a .do in the
 URL before running it)
 
 Wed Dec 27 14:46:43 EST 2000:I WebAppServletContext-prototype
 action: Processing a GET for /addLoad
 Wed Dec 27 14:46:43 EST 2000:E WebAppServletContext-prototype
 Servlet failed with Exception
 java.lang.NoClassDefFoundError: org/apache/struts/util/PropertyUtils
 at
 com.elogex.web.taglib.logic.NullPropertyCheck.doStartTag(NullPropertyChe
 ck.java:103)
 
 
 
 -Original Message-
 From: Doug Bateman [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 27, 2000 2:45 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Weblogic 510  struts
 
 
  calling the .do directly worked.  Grr .. just a tad bit
 frustrating.
 
 What did you do exactly?  This sounds like a nice and really simple work
 around.
 
 

-- 
He who pursues learning will increase every day;
He who pursues The Eternal will decrease every day.
He will decrease and continue to decrease,
Till he comes at non-action;
By non-action everything can be done.

 Lao-Tzu (fl. B.C. 600)
 Chinese Philosopher - Founder of Taoism




RE: Weblogic 510 struts

2000-12-27 Thread Sharon Curlee

no, but it I put it explicitly in the startWeblogic.cmd file.   

I will modify the .properties file and try again.  (Should it matter?)

-Original Message-
From: Doug Bateman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 27, 2000 3:00 PM
To: [EMAIL PROTECTED]
Subject: RE: Weblogic 510  struts


That looks more like a classpath problem.  Is the struts jar in listed
in
the weblogic servlet classpath, weblogic.httpd.servlet.classpath (in
weblogic.properties)?

On Wed, 27 Dec 2000, Sharon Curlee wrote:

 well, I spoke too soon.  All I did was called action.do directly.  It
 did well in bringing up the index.jsp, but when I try and called
another
 .do, it blew up.  I am back to this error. (and I called a .do in the
 URL before running it)
 
 Wed Dec 27 14:46:43 EST 2000:I WebAppServletContext-prototype
 action: Processing a GET for /addLoad
 Wed Dec 27 14:46:43 EST 2000:E WebAppServletContext-prototype
 Servlet failed with Exception
 java.lang.NoClassDefFoundError: org/apache/struts/util/PropertyUtils
 at

com.elogex.web.taglib.logic.NullPropertyCheck.doStartTag(NullPropertyChe
 ck.java:103)
 
 
 
 -Original Message-
 From: Doug Bateman [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 27, 2000 2:45 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Weblogic 510  struts
 
 
  calling the .do directly worked.  Grr .. just a tad bit
 frustrating.
 
 What did you do exactly?  This sounds like a nice and really simple
work
 around.
 
 

-- 
He who pursues learning will increase every day;
He who pursues The Eternal will decrease every day.
He will decrease and continue to decrease,
Till he comes at non-action;
By non-action everything can be done.

 Lao-Tzu (fl. B.C. 600)
 Chinese Philosopher - Founder of Taoism




PropertyUtils handling multiple getter methods

2000-12-27 Thread Chandan Kulkarni




I had a question about this part of 
PropertyUtils.java.



   
public static PropertyDescriptor getPropertyDescriptor(Object 
bean, 
   String name)

snipped

 PropertyDescriptor descriptors[] = 
getPropertyDescriptors(bean); if (descriptors == 
null)  return 
(null); for (int i = 0; i  descriptors.length; 
i++) {  if 
(name.equals(descriptors[i].getName())) 
  return 
(descriptors[i]); }

The method getPropertyDescriptor 

calls 
  
getPropertyDescriptors(bean)
and iterates through them to get a match on the 
name.

Incase the Bean class contains
  ArrayList items;

It requires to have 2 getItems methods
1) ArrayList getItems() - to be used when 
you use the 
   
logic:iterate name="Beanname" property="items"  
2) It also requires an indexed getter
  Item getItem(int 
index)
 to handle the form input fields within the 
iterate tag.

If you find the wrong descriptor first, you get a 
NoSuchMethodException
I proposegetPropertyDescriptor take another parameter 
(which says whether its an  Indexed
property we are looking for) or create another
getIndexedPropertyDescriptor.

I'll probably do that to handle nested, indexed properties to 
get logic:iterate to work...

 -Chandan.



Example app - ApplicationResources.properties not found?

2000-12-27 Thread HT Levine

ok, I'm getting warmer... I deployed the .war that came with the struts0.5
release.  The ApplicationResources.properties file is in the .war file, in
the same path as the example files.  Where did I go wrong. 

btw: is there a better way to go through the archives besides the
list-server commands?  I requested some threads, but they came to me
attached in a way that my mailreader (outlook) could not understand?  thanks

here's my stack trace:

Wed Dec 27 12:08:17 PST 2000:E WebAppServletContext-struts-example
action: Cannot load application resources
bundle org.apache.struts.example.ApplicationResources
java.util.MissingResourceException: Can't find bundle for base name
org.apache.struts.example.ApplicationResource
s, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(Unknown
Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at
org.apache.struts.util.MessageResources.init(MessageResources.java:102)
at
org.apache.struts.util.MessageResources.getMessageResources(MessageResources
.java:579)
at
org.apache.struts.action.ActionServlet.initApplication(ActionServlet.java:49
4)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:289)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java
:457)
at
weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.ja
va:415)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
a:404)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
a:325)
at
weblogic.servlet.internal.ServletContextImpl.preloadServlet(ServletContextIm
pl.java:736)
at
weblogic.servlet.internal.ServletContextImpl.preloadServlets(ServletContextI
mpl.java:710)
at
weblogic.t3.srvr.HttpServer.initServletContexts(HttpServer.java:607)
at weblogic.t3.srvr.HttpServer.start(HttpServer.java:418)
at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:1312)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:827)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)



RE: Example app - ApplicationResources.properties not found?

2000-12-27 Thread HT Levine

Never mind, I got this.  I assumed the .war deployment would put this in my
classpath for the ActionServlet but no dice.  I made sure it was in the
classpath and now I'm good to go. 

-Original Message-
From: HT Levine
To: '[EMAIL PROTECTED]'
Sent: 12/27/2000 12:17 PM
Subject: Example app - ApplicationResources.properties not found?  

ok, I'm getting warmer... I deployed the .war that came with the
struts0.5
release.  The ApplicationResources.properties file is in the .war file,
in
the same path as the example files.  Where did I go wrong. 

btw: is there a better way to go through the archives besides the
list-server commands?  I requested some threads, but they came to me
attached in a way that my mailreader (outlook) could not understand?
thanks

here's my stack trace:

Wed Dec 27 12:08:17 PST 2000:E WebAppServletContext-struts-example
action: Cannot load application resources
bundle org.apache.struts.example.ApplicationResources
java.util.MissingResourceException: Can't find bundle for base name
org.apache.struts.example.ApplicationResource
s, locale en_US
at
java.util.ResourceBundle.throwMissingResourceException(Unknown
Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at
org.apache.struts.util.MessageResources.init(MessageResources.java:102
)
at
org.apache.struts.util.MessageResources.getMessageResources(MessageResou
rces
.java:579)
at
org.apache.struts.action.ActionServlet.initApplication(ActionServlet.jav
a:49
4)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:289)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.
java
:457)
at
weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImp
l.ja
va:415)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl
.jav
a:404)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl
.jav
a:325)
at
weblogic.servlet.internal.ServletContextImpl.preloadServlet(ServletConte
xtIm
pl.java:736)
at
weblogic.servlet.internal.ServletContextImpl.preloadServlets(ServletCont
extI
mpl.java:710)
at
weblogic.t3.srvr.HttpServer.initServletContexts(HttpServer.java:607)
at weblogic.t3.srvr.HttpServer.start(HttpServer.java:418)
at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:1312)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:827)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)



My fix for Weblogic5.1 and struts example

2000-12-27 Thread HT Levine

Having suffered through this problem this morning, here is what I added to
my weblogic.properties file to successfully get the ActionServlet to
initialize at the startup of Weblogic.  this works like a charm and is way
better than rewriting code?  and browsing to a .do?   Thanks for the help
everyone gave me.

=  paste below into weblogic.properties ===

#setup struts control
weblogic.httpd.register.ActionServlet=org.apache.struts.action.ActionServlet
weblogic.system.startupClass.StartMyServlet=weblogic.servlet.utils.ServletSt
artup
weblogic.system.startupArgs.StartMyServlet=servlet=ActionServlet



Struts design question

2000-12-27 Thread Punyansky, Alex

Hi,

I'm going through Struts code trying to understand how this whole thing
works. I could figure out almost everything except one thing: Why do Action,
ActionForm and ActionMappings classes keep references to the ActionServlet?
Can anybody explain this?

Thanks

Alex




Re: Struts design question

2000-12-27 Thread Ted Husted

 Why do Action, ActionForm and ActionMappings classes keep references
to the ActionServlet?

So that they can access the many features available through the
servlet, like logging and (lately) a JBDC DataSource.

The ActionServlet is like a switchboard, and the references a way they
can dial "0" for the operator.

For more about how Struts works, there is a  "Walking Tour of the
Example Application" at 

 http://husted.com/about/struts/ 

along with a sample JBDC applicaton. 

*** REPLY SEPARATOR  ***

On 12/27/2000 at 6:41 PM Punyansky, Alex wrote:

Hi,

I'm going through Struts code trying to understand how this whole thing
works. I could figure out almost everything except one thing: Why do
Action,
ActionForm and ActionMappings classes keep references to the
ActionServlet?
Can anybody explain this?

Thanks

Alex






Re: Weblogic 510 struts

2000-12-27 Thread Wong Kok Wai

WLS 5.1 SP8 has fixed the load-on-startup problem.
The Struts example works fine except for the
ApplicationResources.properties file is not unjar from
the WAR and will cause a null pointer exception when
the bean:message is encountered. My workaround is to
add ApplicationResources.properties manually to the
correct path under the _tmp_war directory that WLS has
created and the Struts example works fine after this.

--- Andreas Doerr [EMAIL PROTECTED]
wrote:
 Hi Sharon,
 
 Please see the message "Re: Null Pointer Exception
 in Struts 0.5 example" by
 Alain Bienvenue. The basic problem is, that WLS 510
 does not honor the
 "load-on-startup" attribute. This means that
 ActionServlet will not be properly
 initialized.
 


__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/



Re: Missing resources attribute org.apache.struts.action.MESSAGE

2000-12-27 Thread Ted Husted

In trying to set-up Struts on a hosted machine running Apache and
Tomcat, I ran into 

 javax.servlet.ServletException: Missing resources attribute
org.apache.struts.action.MESSAGE

The configuration works fine under my standalone Apache. Besides what
is in the install file, do I need to do anything else under Apache for
it to find the message resource. 


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/