Code reuse with different backing beans?

K

kal

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
 
R

Robert Mark Bram

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
:)
 
D

Daniel Pitts

Robert said:
Hi Kal,


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.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,228
Latest member
MikeMichal

Latest Threads

Top