Hi, I'd go for approach #2. After all, they are different VIEWS of the same Model.
I've faced this situation in a couple of projects before, and in both cases buyer's and seller's views differed in the long run. The more complex your business rules / model gets, the higher is the chance for that happening. It may seem the right way to go at first (specially if the differences are insignificant), but after a few meetings with the corporate managers, you'll realize it was not such a smart move after all! :P My humble oppinion, Freddy. -----Mensaje original----- De: Leandro Melo [mailto:[EMAIL PROTECTED] Enviado el: viernes, 15 de octubre de 2004 3:30 Para: struts jakarta Asunto: Exposing ActionForm and MVC fields Hi, i'd like to hear some opinions. I got a b2b application. I'm facing a desing problem. This problems is associated basically to 2 themes: - MVC - Exposing AcfionForm fields. I got a page where the BUYER fills a form to buy an specific item. The steps are very simple. 1 - He sends a request for a quotation. 2 - After the quotation, he sends a request for an order. The point is... When the SELLER goes to make the quotation he's supposed to see a very similar page to the one the BUYER filled the information. This is obvious as the information is the same for both parts. So, should i implement the page for the SELLER: ======>>>>>>> APPROACH 1 - using the same exact page as the BUYER for the SELLER. Then i'd make the fields the BUYER filled disabled (or just make them labels) using some kind o scriptlet like this. <input .... <%= sellerVisibility %> .../> , where sellerVisibility would be something = "disabled=true" This approach seems nice to but i'd say that it's just not that cool!!! It doesn't look nice from an MVC point of view. I'll take the risk of having a lot of this kind of scripts in pages as the times goes by. I know that the Action (control layer) is actually responsible for setting the "sellerVisibility", what means that it's also not that bad from the MVC point of view. But any way, the major problem with this approah is that i use BeanUtils to copy data from the ActionForms to the VOs and vice-versa. So even with the fields disabled, i would take the risk of some smart guy cheatting and setting via javascript the fields he's not supposed to set. And as i copy the data with BeanUtils, my data will be changed when it's not supposed to do so. ========>>>>> APPROACH 2 - just create another page for the BUYER. This page would look exactly the same for the BUYER and the SELLER, but they'll be different pages. This way, i can build this other very similar page without exposing my ActionForma attributes. This approach seems to me allright from the MVC point of view. But the problem of this approach is that i'd start building some kind of redundant and duplicated code. Any opinions...???? Leandro. _______________________________________________________ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]