Is tight coupling between the model and the UI avoidable when using RichFaces?
I am using RichFaces with seam and EJB3. 开发者_StackOverflow社区Specifically I am using the rich:tree component. The problem I am worried about is the tight coupling between the UI and my EJB3 session bean. In order to make the tree view work, I was forced to include the Richfaces jar files in my EJB3 project. Is this a bad thing?
The method below is called when a node is selected in the RichFaces tree component. Adding this method to my session bean was what caused me to need to include the RichFaces jars.
public void processSelection(NodeSelectedEvent event) {
HtmlTree tree = (HtmlTree) event.getComponent();
selectedNode = (String) tree.getRowData();
}
Am I doing this all wrong, or is this not really a problem to worry about?
I'd suggest:
- getting the
HtmlTree
in a managed bean and parse its data, transforming it to a usable data-structure with no UI-elements. - pass that data to the EJB.
精彩评论