RE: Velocity-Tools / Struts

2002-02-19 Thread Matt Ho

We've been using Struts/Velocity for some time now and we find it to be
an extremely well matched combination.  One of the main advantages of
Velocity is that the syntax is incredibly easy.  I can explain it to a
designer who has never seen it before and expect them to be useful
within an hour.

One of the nicest things it enforces is the separation of presentation
layer and business logic.  It removes the desire to "fix" problems but
just putting a small change into the JSP via scriptlets.  It also makes
the code a _lot_ more readable which also reduces the development time.


> i have been looking at velocity periodically for a few months now, and
> although i understand what it is trying to do (define a clearer
separation
> between controller and view) i felt that its big disadvantage was that
it
> introduced another language/syntax for a developer/designer to learn.
In
> view of this i decided to stay with struts, and occasionally resort to
> using
> java scriptlets in my applications !-)

--
Matt Ho
Principal
Indigo Egg, Inc.
Providing VoiceXML Professional Services




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Losing ActionForwards

2001-10-01 Thread Matt Ho

I seem to have run into a problem with Struts 1.0 and ActionForwards.  
I have an action that has a relatively large number of ActionForwards 
(32 of them) that seems to work ok initially.  However, after a few 
minutes I get to the point where some random ActionForward stops working
I get a blank page.  Specifically, I get


HTTP/1.0 200 OK
Server: Resin/2.0.1
Content-Type: text/xml
Date: Mon, 01 Oct 2001 11:56:49 GMT

Any idea what might be going on?  That's really not very reassuring to
see that happen.

My environment:

* Windows 2000 Professional
* Resin 2.0.1 (as standalone)
* Java 1.3.1

--
Matt Ho
Principal
Indigo Egg, Inc.
Providing VoiceXML Professional Services






RE: problem with struts and EJB

2001-09-04 Thread Matt Ho

> Since this bean looks similar to an ActionForm, and we hope to use
> ActionForms for data validation, and I don't want to have to move data
> between similar beans, I decided that my bean could extend ActionForm.
> When
> I do this and invoke the getBean() method, I get a CORBA MARSHAL
exception
> -
> "Unable to read value from underlying bridge: minor code: 1398079699".

Consider using a ValueObject rather than an ActionForm to pass data
between the presentation layer and the business logic layer.  Having
your EJB implementation tied so closely to struts is probably not what
you want.  

If your action form is called PersonForm, create a ValueObject called
PersonVO and a methods in PersonForm called setPersonVO and getPersonVO.
It's a little more work up front, but the long term benefit is worth it
IMHO.

Has there ever been talk of making ActionForm an interface rather than a
class?  I'd much rather declare

public class PersonForm extends PersonVO 
implements ActionForm
{
    ...
}

than what I've described above.

--
matt ho
indigo egg, inc.
providing VoiceXML professional services
http://www.indigoegg.com/


> -Original Message-
> From: Fletcher, Ken [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 04, 2001 1:54 PM
> To: '[EMAIL PROTECTED]'
> Subject: problem with struts and EJB
> 
> I am having a bit of trouble with struts and an EJB (entity bean).
> Instead
> of having getters and setters for each attribute in my entity bean, I
pass
> a
> javabean that has the same attributes and the getters and setters for
the
> attributes.  So, for example, let's say I have an entity bean with two
> attributes, firstName and lastName.  I have no getFirstName() or
> getLastName() method in the entity bean.  What I do have is a
getBean()
> method that returns a bean (not an entity bean) with firstName and
> lastName.
> This bean has the getters and setters in it.
> 
> 
> The ActionForm is the problem because when I use the same bean and
don't
> extend ActionForm it works OK.  My guess is, that although ActionForm
is
> serializable, some attribute in it is not.
> 
> Any help with this would be greatly appreciated.
> 
> Ken Fletcher
> Teacher Retirement System of Texas




RE: Question about iterate tag

2001-03-01 Thread Matt Ho

> I did try this way but it still does not work. Since
> supplier.value is of type SupplierBean, do I have to specify that
> anywhere?

I believe you want the bean to be SupplierBean rather than Supplier.  Your
request



seems like it would get translated into

out.print( String.valueOf(supplier.getValue().seq_nbr) );

or something akin to that which is Not At All what you're looking for.

M
> --
>  type="com.motorola.mms.msqc.beans.UserBean"/>
>
> 
>
> 
>
> 
>  scope="page"/>
> 
>  scope="page"/>
> 
>
> 
>
> 
> -
> but this code which I am trying to replace with tags works:
>
>  type="com.motorola.mms.msqc.beans.UserBean"/>
>
> 
> <%
>   Hashtable hashTable = (Hashtable) user.getSuppliers();
>   for (Enumeration e = hashTable.elements(); e.hasMoreElements(); )
>   {
>  SupplierBean supplier = (SupplierBean) e.nextElement();
> %>
> 
> supplier.getCode() %>
> <%= supplier.getName() %>
> <%= supplier.getCountryName() %>
> 
>
> <% } %>
> 
>
> -Original Message-
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 28, 2001 11:30 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Question about iterate tag
>
>
> Shamdasani Nimmi-ANS004 wrote:
>
> > Hi,
> >
> > Could someone please tell me what I am doing wrong below:
> >
> > user is a bean in session scope in my JSP and its
> getSuppliers() method returns a hashtable where keys are
> Suppliers Ids and elements are Supplier beans.
> >
> >  id="supplier" type="com.motorola.mms.msqc.beans.SupplierBean">
> >
> > 
> > 
> > 
> >  scope="page" />
> > 
> >
> > 
> >
>
> When you iterate over a Hashtable (or any other implementation of
> the Map interface), the object get for the "id" variable is
> actually an implementation of
> the "Map.Entry" class, not the class of the value of the bean.
> From this "Map.Entry" instance, however, you can easily get to
> the real information:
>
> 
>
> This works because a MapEntry has two properties -- key and value
> -- so we are using the nested property syntax to effectively call
> getValue().getSeq_nbr().
>
> >
> > Thanks in advance.
> >
> > -Nimmi
>
> Craig
>