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

How to understand the Ajax and Apusic JSF of transition technology

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

How to understand the Ajax and Apusic JSF of transition technology? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

In Java EE 5.0, the next generation specification of J2EE, JSF (Java Server Faces) technology has been put in a very important position. The J2EE community tries to unify the development mode and method of Web application through JSF.

Compared with the traditional JSP/Servlet-based development model, JSF can bring many benefits, such as:

Rich customizable UI components of ◆

Good event response mechanism of ◆

◆ expression language (Expression Language)

Automatic conversion and Verification of ◆ form data

◆ MVC-based framework model and so on.

But at the same time, we have to see that there are some defects and deficiencies in the common JSF engines in the industry (not the limitations of the JSF technology model itself, but some problems caused by the conventional implementation mechanism), and these shortcomings may have a negative impact on JSF to become the mainstream development technology of Web applications in the future, including:

The runtime performance of ◆ 's conventional JSF implementation mechanism is not very ideal.

◆ lacks good tool support

As a member of the JCP organization, how does Kingdee middleware think about JSF technology? Do you plan to fully support JSF? And through what kind of solutions to overcome the above shortcomings?

JSF and Ajax

When it comes to Web development technology, we have to mention Ajax. This is a popular concept in the whole IT world at present. I don't think it's necessary to explain what Ajax is here, but we can have a basic understanding of Ajax.

Ajax is actually a new bottle of old wine technology, its advantage is that through JavaScript and DHTML, provides an asynchronous programming model, so that our Web application to bring a better man-machine experience to customers. However, the level of problem solving of Ajax is very low; in other words, its methods and means of solving problems are difficult to form a highly abstract framework-level solution, while JSF is a scalable framework-level solution.

In fact, I think Ajax is a transitional technology, and I believe it will be replaced by a new technology in the next one or two years. Whether it is Microsoft's XAML, Mozilla's XUL, or any possible RIA standard, the whole industry is actually waiting and seeing. But no matter what technology is used, JSF can adapt, and for JSF to adapt to a new technology is just to change a Render Kit. For example, if you want to achieve the chart function (Chart) in the web page, MSIE has VML,Gecko and Opera have SVG, but on the server side, you can simply judge the browser type and choose a Render Kit to generate different markup to complete the same function. This is a task that is difficult to accomplish with conventional JSP technology.

Apusic JSF: JSF engine made by Chinese

1. Container-level Ajax support

At present, the idea of JSF and Ajax is probably not the only Kingdee middleware, but many third-party JSF and Ajax implementations provide a component library and an additional Servlet or Filter to handle Ajax requests, while we handle Ajax requests directly by the JSF container. We will determine whether this is a normal HTTP request or an Ajax request based on the type of request. If it is a regular HTTP request, run the JSP page to generate the page document (and we will embed the JavaScript code necessary for Ajax in the generated page document, mentioned later) If the request is an Ajax request, the server decodes the request parameters normally and executes all the stages in the JSF except the page output phase, then it will generate a component tree of JSF, traverse the component tree, find out the changed data, and package the data into an Ajax response, and the client will update the modified data, or even change the appearance of the page.

In the JSF specification, the Render Kit used in the JSF page output phase is replaceable, the default HTML_BASIC Render Kit output is the standard HTML syntax, does not contain any JavaScript code, the Apusic JSF engine implements an AJAX Render Kit, you can embed JavaScript code in the HTML document to achieve the Ajax feature, while replacing Render Kit only needs to modify the configuration file.

So what are the benefits of this?

two。 Improve the performance of JSF and bring better man-machine experience.

The common practice of state maintenance in conventional JSF containers is based on Session or based on request delivery, which means that all states need to be passed back and forth every time the client and server respond, which will undoubtedly have a great negative impact on the running performance of the system, which makes developers mistakenly think that JSF is a heavyweight technical model.

Through the Ajax feature of Apusic JSF, we can only package the changed data into Ajax requests and send them to the server, and the server will only package the changed data into Ajax responses, thus greatly improving the efficiency of the system. Moreover, the traditional JSF request response will refresh the entire page, while Apusic JSF will only update the changed client components, thus bringing customers a better man-machine experience.

3. Simplify the development of Ajax

In the past, to write Ajax applications to write a lot of JavaScript code, development, debugging, maintenance of these Script scripts are very cumbersome, if you use Apusic JSF technology, you no longer need to write any JavaScript code, the engine has helped you generate this code. All standard components of Apusic JSF support Ajax, and some third-party components may not support Ajax themselves, but you can immediately convert this third-party component to Ajax Enabled using a tag called. For example, Apache myfaces's Tomahawk project provides a Tree component, which itself does not support Ajax. Every time a Tree node is pressed, the entire page will be refreshed. After using the tag, only the Tree part will be refreshed, not the rest of the page. Of course, a better way is to provide a Tree component that inherently supports AJAX to reduce the transmission of redundant data.

Apusic JSF also provides a tag that accepts events triggered when an Ajax request is sent and completed. The default implementation is to display a HTML fragment before sending an Ajax request and another HTML fragment after the Ajax request is completed. These HTML fragments can contain text and pictures. A more advanced use is to set the onstart and onstop attributes of the tag and execute a piece of JavaScript code to achieve a more complex effect when the Ajax request is started and completed.

In addition, we have implemented a tag that calls a method of the server-side Java object in RPC.

4. Other characteristics

The use of Apusic JSF also includes some other differentiated features, including the skin-changing function of the control, the control's support for multiple browsers such as IE, Mozilla (Firefox), Opera, and powerful layout functions.

What is shown in is a completely HTML, CSS, and JavaScript-based interface generated through Apusic JSF, which is almost exactly the same as a real window system, including moving position, changing the stacking order, and modal dialogs, but in fact they are all "fake" windows. In addition, it should be emphasized that the CSS layout is completely adopted here, which avoids the old layout method which depends on HTML Table nesting, thus making our program more maintainable.

We found that through Apusic JSF, the implementation of the above UI interface is not complex, only through a few simple lines of code, we can complete the complex UI interface.

Apusic JSF also supports the skinning function of the control. Taking the above interface as an example, we can look at the Mac OS-style interface style, as shown in figure 2.

Support for development tools: Apusic Studio

In the JSF specification, there is a saying: "JSF is designed to be tooled". In other words, the JSF specification has placed great emphasis on tool support from the beginning of its design. Fortunately, the current development tools that support JSF are also gradually enriched, including Oracle JDeveloper, Sun Java Studio Creator, and so on. Kingdee middleware also provides an integrated development environment based on Eclipse: Apusic Studio. Through this tool, it can bring good support to the development of JSF, including syntax highlighting, code assistance, breakpoint debugging, visual design and so on.

This is the answer to the question about how to understand the Ajax and Apusic JSF of the transition technology. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

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