4

I'm working on a project using JSF 1.2 deploying a portlet to WebSphere Portal Server 6.1 on top of WAS 7. For various contractual/political reasons, we're stuck with JSF 1.2.

However. we are using Spring beans throughout our application in order to get AoP logging.

It is somewhat annoying that we can't use JSF 2.0. In particular, view scope would be ideal for our app. It will be a high usage site and keeping all the page beans in session scope is wasteful and I'm sure will cause raised eyebrows from our non-functional testing team later on.

It occurred to me that I could emulate View Scope by using Spring's custom scope and a custom JSF component that simply maintains a map of active beans set by the Spring scope and attaching this component on our pages. Together with a custom variable resolver that can find beans in this map, we should be able to emulate view scope

(Our journey is only four pages, but each page has a few postbacks to the same page)

How does this approach sound? I want to be sure I'm not somehow shooting myself in the foot before I present this to my project colleagues and dash off and start ripping apart the bean code we've already written.

Steve Atkinson
  • 1,219
  • 2
  • 12
  • 30

1 Answers1

4

Not sure about Spring, but for JSF 1.2 managed beans, the Tomahawk's <t:saveState> was the way to let a JSF 1.2 request scoped bean behave (almost) exactly like JSF 2.0 view scoped bean. Almost, because the destroying of the view and the state saving is a bit more efficient in JSF 2.x. But the effect is ultimately the same.

All you need to do is referencing the bean by that tag elsewhere in the view:

<t:saveState value="#{bean}" />
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • It sounds like t:savestate does exactly what I'm proposing, but again, for political reasons, we're stuck with vanilla JSF :( IBM have told us that they will "only officially support vanilla JSF 1.2 on portal 6.1/was 7 although JSF2 should work" - our managers have taken that to mean "thou shalt only use JSF 1.2 and no 3rd party libraries") - but we are using Spring in the next tier down from the xhtml presentation. – Steve Atkinson May 25 '12 at 20:14
  • So even no JSF 1.2 component libraries? Well, Tomahawk is open source, you may want to look around and/or "borrow" the source of `` (after having figured the license issues...). – BalusC May 25 '12 at 20:15