Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Code reuse with different backing beans?

Thread view: 
kal - 06 Nov 2006 23:16 GMT
I am a JSF programmer, inheriting a project from someone else.

We have a lot of duplicated code in several places, where the only
difference is a different managed bean.

There are over 10 pages where you could cut and paste page A into page
B, and search and replace the bean (that is probably what someone did).

I am wondering what is the right way to handle this?

My coworker said she wanted me to write a custom tag that would serve
the purpose of the duplicated code, we would just give a different
bean.

I thought that was overkill.

I was just wondering what is the "correct" way to handle this issue?

Thanks

Kal
Robert Mark Bram - 06 Nov 2006 23:54 GMT
Hi Kal,

> There are over 10 pages where you could cut and paste page A into page
> B, and search and replace the bean (that is probably what someone did).
>
> I am wondering what is the right way to handle this?

Perhaps a JSPF (JSP fragment) file could be used to hold the 'common
jsp'?

Rob
:)
Daniel Pitts - 07 Nov 2006 00:33 GMT
> Hi Kal,
>
[quoted text clipped - 5 lines]
> Perhaps a JSPF (JSP fragment) file could be used to hold the 'common
> jsp'?
Keep in mind, he's using Java Server Faces, which isn't exactly the
same as JSP, AFAIK.

> Rob
> :)

Although, I think JSF does use something similar to EL, so you could
PROBABLY use the same JSF fragment with different backing beans.  I'm
not sure how to do this, but I should expect it is possible.  I know it
is possible in JSP's.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.