Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the learning experience of JSF+Seam framework?

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces you to JSF+Seam framework learning experience is what, the content is very detailed, interested friends can refer to, I hope to help you.

My current project front-end is using JSF+Seam framework, the project is now coming to an end, I want to give you some experience, so that we use JSF, less detours.

1. Exception handling problems: Please add Seam framework for JSF, see Seam framework-seamless integration of JSF, a total of three parts, which tells you how to use Seam in servlet container with spring, Seam does not have to be under ejb3 and jboss can be used. Because using JSF alone her exception handling function is very simple, tracking can not see where you want to see, very inconvenient for development, you can only open the log to see the problem, and Seam in the phase-listener after the addition of different life cycles of JSF have been enhanced, even if not using any of Seam's features, she can also output all exception stacks without reservation.

2.css problem: if you want to use JSF in your project, css is too important, many people who just started using JSF are not very used to JSF based on block structure development pages, because JSF makes you pay attention to the structure of content presentation, not the style of content presentation, which is completely in line with the original intention of w3 development html, we use

< td>

To do page layout, in fact, is the wrong way for a long time, if you can understand how to use CSS layout in JSF, JSF is not suitable for complex page design this sentence is self-defeating.

3. Careful use of the dataTable component. DataTables are the most commonly used page components, but I'm relentless in saying that the implementation of JSF's dataTable component is simply too much. It's the bane of JSF development. There was no convenient solution to the row style display problem, no solution to the fallback button risk problem, no elegant way for dataScroll and dataTable components to do database paging, no phantom of data submission, and a lot of my development time was spent merging dataTable with other component blocks. JSF 1.2 adds support for jstl's foreach tag via unified el, though I haven't used it yet, but I think it could be a powerful addition to data list development.

4. It is recommended to combine JSF model beans and background business beans into one, so that the data encapsulation of business beans can be completed at the same time when the front-end submission page is bound to the model, and it can be handled by the service layer in one go. The advantage of doing this is that we will find ways to complete the encapsulation of model beans to business beans in *** time, eliminating the dependence of the service layer on dto. This works because JSF's page binding mechanism helps.

5. Please consider using convert component more, for example, the list page has a radio block, the submit radio value is an int value, and then the presentation logic restores the business model corresponding to this radio value, which increases the burden of the presentation logic processing page data, and is not easy to manage. If you put this work in a custom convert, let convert display int value on the page, and find objects on the submission, then the page and service layer will block such work, and all you see is the entry and exit of objects.

6. I use myfaces, a component of my own, which is cross-page specifier parameters, very easy to use, just using JSF friends, you can see how to jump to the next page with it, but it is recommended to pass model objects, do not pass values, you use JSF because she is based on object design.

7. Be careful with sessions in JSF, JSF uses sessions too much, but I'm sure the presentation layer needs to be done in a state-based way, which simplifies development, and a stateless way leads to more disordered code. Not everyone is a master. Consider using Seam's conversation to handle this; her long sessions are particularly suited for business editing, and the default short sessions fill in the short-term data that JSF sometimes loses.

8. Problems with debugging JSF: Sometimes you use JSF and want to know at what stage your data has changed. You don't add JSF code to your project to debug. Please add a custom phaseListener. Inherit the phaseListener interface. You can jump out of your program settings at any stage to debug.

9. Pagination problems: Google search, there is a http://www.blogjava.net/steady/archive/2005/12/30/26013.aspx provides a way to paginate, I am using, this is the most likely way to put, ha ha, but note that she makes dataTable values directly use dataModel, she and Seam @dataModel is incompatible, so you can not use Seam @dataModel function, you need to use the get mode.

10. If you want to use an Ajax framework such as Ajax4JSF, you need to use facelet to make the page standard xhtml, remember, don't write a lot to find this problem.

11. If you use radio in the dataTable list page and you want to do some link operations on the list, be sure to add immediate= true to the operation, otherwise she won't let you go without selecting radio. And use selectBooleanRadio instead of selectOneRadio or selectManyRadio in the list. Checkboxes are the same.

12. For doGet mode please use Seam component.

13. If you import another page without facelet, the page you import will be rendered exactly as JSF components are rendered, and mixed html will not parse. In turn, try to mix JSF tags with html on the main page as much as possible. This makes development easier. Although JSF can be embarrassing sometimes, try having a render attribute for each html component. JSF 1.2 already outputs mixed html as an output component, which is compatible with JSF components, which is a good thing. With mixed html, I would say that you are concerned with the relationship between JSF components and models, and not necessarily that the pages have to be JSF component tags.

14. Don't believe that JSF is slow. Although JSF has experienced recursive traversal at every stage of tree component processing, believe that JSF is still fast. My current system is fast. If you are slow after using it, it is the project that has problems, not the framework.

About JSF+Seam framework learning experience is what to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report