Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Subject: RE: Inheritance within form beans

Subject: RE: Inheritance within form beans

2007-10-02       - By Kothari, Kailash

 Back
Thaks Rick.

This will give me an instance of the parent bean OR the child bean.

What I need is a child bean pre populated with data from the parent
bean.

Note that we cannot get an instance of the parent bean and downcast it
to an instance of a child bean like -
child bean = ((child bean)(instance of parent bean));

Since java does not allow such downcasting.

Would appreciate anything to help me move along !

-- --Original Message-- --
From: Rick Reumann [mailto:rick.reumann@(protected)]
Sent: Monday, October 01, 2007 5:57 PM
To: Struts Users Mailing List
Subject: Re: Inheritance within form beans

On 10/1/07, Kothari, Kailash <Kailash_Kothari@(protected)> wrote:
> What I also need is that, when a child form bean is instantiated by
> Struts, I want Struts to check if there is an instance of the parent
> form bean in the session and if so, pre populate that data from the
> parent to the child form bean.

Assuming Struts 1.x...

I can't recall the exact syntax of how the forms are stored in the
session but I know it invovles the  ActionMapping name in the
StrutsConfig, so you could try:

(YourForm)session.getAttribute(yourActionMappingName);

(remember you could have different session scoped instances of the same
type of ActionForm in the session - the key is the action mapping name
they are tied to.)


-- --Original Message-- --
From: Kothari, Kailash [mailto:Kailash_Kothari@(protected)]
Sent: Monday, October 01, 2007 5:31 PM
To: user@(protected)
Subject: Inheritance within form beans

Hello,

I have an interesting Struts design requirement and Im a little lost,
would really appreciate help !

I have multiple form beans in my application and a lot of them share
data.

Instead of duplicating the common attributes in each form bean, I am
opting for an more elegant approach, i.e. encapsulating the common data
in a parent form bean and then building child form beans that extend the
form.

So that's fine.

What I also need is that, when a child form bean is instantiated by
Struts, I want Struts to check if there is an instance of the parent
form bean in the session and if so, pre populate that data from the
parent to the child form bean.

Of course I could copy that data manually, but the parent form bean is a
legacy class and has grown beyond proportion - hundreds of attributes
and contained objects.

Thanks !
Kailash.

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.