You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Fletcher, Ken" <ke...@trs.state.tx.us> on 2001/09/04 22:53:30 UTC

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. 

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".

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: Connection Pool

Posted by Ted Husted <hu...@apache.org>.
http://jakarta.apache.org/struts/userGuide/building_model.html#databases

java_san wrote:
> 
> Dear All,
> 
> 1. Can someone let me know the steps involved in setting up a connection
> pool in struts config files?
> 
> 2. Also a small snippet of code on how to use it from a action servlet. Is
> it as easy as getting  a ref. to a connection pool using JNDI.
> 
> Your help is highly appreciated.
> 
> Sanjay

Connection Pool

Posted by java_san <ja...@yahoo.com>.
Dear All,

1. Can someone let me know the steps involved in setting up a connection
pool in struts config files?

2. Also a small snippet of code on how to use it from a action servlet. Is
it as easy as getting  a ref. to a connection pool using JNDI.

Your help is highly appreciated.

Sanjay


Re: problem with struts and EJB

Posted by Ted Husted <hu...@apache.org>.
Matt Ho wrote:
> 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.

See 

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg08070.html


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/

RE: problem with struts and EJB

Posted by Matt Ho <ma...@xtreme.com>.
> 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:ken.fletcher@trs.state.tx.us]
> Sent: Tuesday, September 04, 2001 1:54 PM
> To: 'struts-user@jakarta.apache.org'
> 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