[JBoss Seam] - how to conditionally render a row of dataTable
by ellenzhao
A column of a h:dataTable can be conditionally rendered. But is there any way to conditionally render a row of a dataTable? This can be useful, for example, for reducing communication between database and app server.
In my application, each entity has a flag column with values like "creating", "created", "updating", "updated",...etc in the database. There is an extremely heavy weight stateless session bean called "dataStore" which has static fields for holding List allFoo, List allBar ....etc, this has proven working very well as data cache. Although my entities seldom get updated or deleted, I am thinking how can I still use this caching approach if I need to implement update or delete. It's of course easy to change the flags in the CRUD flag columns. But then, there is a need for conditionally rendering a row. It would be nice to only render rows with "created" or "updated" flag in the dataTable to the end user. If only there's something like:
| <h:dataTable value="#{fooManager.fooList}" var="foo" rowRendered="#{foo.crudStatus eq 'created' or foo.crudStatus eq 'updated'}">
| </h:dataTable>
|
Is there any exisiting lib can do this? If not, how about implement it as a Seam feature?
Regards,
Ellen
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075566#4075566
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075566
18Â years, 10Â months
[JBoss Seam] - Re: how to catch unhandled exception in the conversation bea
by ellenzhao
I'm going to try this:
| @Name("foodManager")
| @Scope(COVERSATION)
| @Stateful
| public class FoodManagerImpl extends AppControllerImpl implements FoodManager, Serializable {
|
| @In(required = false)
| private IllegalPriceException ipe;
| ...
|
| /* List<Exception> errors and UseCaseStack useCases are protected fields in the AppControllerImpl class and they are heavily used in the RHS of "rendered= ..." rules in the view codes. This way, the rendering of every field of an entity can be controlled using these conditions in the view code. This way, the reusability of entity class and its view code is maximized. The view of a use case is simply composed of one or more entity views. */
|
| @Override
| public void tryFinishUpdateAFood(){
| boolean noInputError = true;
| if (this.ipe != null) {
| noInputError = false;
| this.errors.add(this.ipe);
| }
|
| if .....
|
| if (noInputError) this.finishUpdateAFood();
| }
|
| private void finishUpdateAFood(){
| Conversation.instance().end();
| this.useCases.removeUseCase(UseCase.updateAFood);
| this.food.setStatus(CRUDStatus.UPDATED.getSymbolInDB());
| }
| }
|
|
fingers crossed hoping the exceptions can be injected to the manager bean....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075558#4075558
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075558
18Â years, 10Â months