proper procedure for adding other beans into request under bP ?

Rick Reumann <[email protected]>
Newsgroups gmane.comp.java.mvc.devel
Message-ID <[email protected]>
(Vic if this isn't a good place to post these questions just let me
know. Figured maybe someone else could chime in saving you some of the
work, but if this isn't the right forum for this stuff just let me
know).

Anyway, I'm looking at the latest bP at basicportal.sf.net, and I'm
wondering how you'd accomplish the following common scenario.

You want to set up a JSP form with a FormBean in request scope but you
also want to use some other Beans on the page to create some option
lists. Imagine the example... of a Tax form (UserTaxBean) where one of
the fields in the UserTaxBean is "taxExemptionType" and you need to
provide on the form a list of taxExemptionTypes which have an ID and the
Name of the Exemption. 

Under the bP framework it looks like you'd call your UserTaxAct which
would extend BaseAct. 

Looking at ContentAct from bP it has the dispatch method


public String onDisplayExec(ActEvent ae) throws Exception {
  ae.setBean(new ContentBean());
  return super.onDisplayExec(ae);
}


Now if I wanted to use a similar method in UserTaxAct where would I set
up the other beans that would need to be on the form to create the
options (in other words where would I set up the TaxExemptionBean
or a generic OptionsBean into scope ). Would I have to do:

public String onDisplayExec(ActEvent ae) throws Exception {
  
  BaseBean tbean = new TaxExemptionBean();
  tbean.populate();
  HttpReuest req = ae.getReq();
  req.setAttribute( "taxTypes", tbean );

  ae.setBean(new UserTaxBean());
  return super.onDisplayExec(ae);
}

I'm sure there is a more elegant solution but I'm a bit stumped on the
best way to handle this under the framework. 

Thanks,

-- 
Rick Reumann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.