A "switch case" tag - Maybe Tedd knows???

Ted Husted

The Struts taglibs are not designed for this sort of thing. The idea is that in a Model 2 MVC application, you would put the equivalent of the switch into the ActionForm itself so you don't have to go to such lengths. You would also not generally use a HTTP parameter, but a property from the ActionForm. (The bean properties like "parameter" are handy for transitioning from Model 1 to Model 2, but personally I would get away from them ASAP.)

So, there should be a ActionForm property that would be populated (automatically) by the controller. A helper property could then look at the property and output whatever it is you need here.

In a Model 2/MVC application, the pages should be glofified mail-merge jobs. If you feel the need for a swtich statement or anything like that, you are drifting back toward a Model 1 application.

Of course, you *can* write Model 1 applications with Struts, but it's not something I've ever done myself =:0)

As mentioned, the new JSTL taglib does have many features appropriate for Model 1 applications. If you are making use of the JSTL, see also the new EL taglib in Struts beta 3 and the nightly build.

HTH, Ted.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact