How should I use label technology? Use the EL, Logic and Hanva tag libraries to complete complex background processing functions

xiaoxiao2021-03-05  23

The address JSTL tag is a product that Sun takes the lead in cooperation with the Apache community, but unfortunately from one appearance is an outdated technology. Sun's Software Architects seems to lack the ability to consider technical orientation from customers, compared with Microsoft. For labeling technology, its purpose is to make rookie in the rookie to write JSP, or make general programmers write JSP more convenient, better management? Obviously, the stupid architect of Sun did not want to understand this truth (the more you see how much its documentation, the more I feel that the guy is a big fool), and the talents of thousands of genius engineers are quenched.

Everyone already knows that the purpose of JSP is to make programmers more easily written simple servlets, complex multi-function servlets are not easy to implement with JSP. JSP wants to let the rookie write the Java dynamic page, this is not as good as ASP / PHP. The underlying business logic in JSP is not easy to organize, not only at the code management, it is very inefficient. This is the reason for developing Javabean and label technology; while JSTL, its basic customer logic is actually to help users spread the underlying code on JSP! ? Including a database connection? ! So this thing is a new technology that realizes backward goals, facing the market demand, a shot.

The only thing is a little value is its loop logic, which is still very useful. However, it is only one that can be implemented. In fact, a few label libraries in the Struts are a bit value, beans can also, other HTMLs are provided by pure and formBean as the core MVC envision framework. Even so, in terms of practicality, Strutslib is still much more practical than Sun.

The Struts label library does not have a good ground to the data object, which is the shortcomings, the Hanva tag is to supplement this shortcomings. Combined with the Struts's Logic library, using the HANVA tag can reach the declaration and reception variables in JSP, you can achieve multiple logic, you can directly obtain a persistent non-inoperative data object, processing and output - a program is roughly Only these things do. Special things have been specially handled, and the label is completely used to call the underlying service daemon program to complete the most of the features, it is already possible.

The following forum sample delete program is a function that can handle any deletion of table data that implements the Hanvadao interface specification, including synchronization processing of its related data records. It receives an object type (ent), and id, determines whether this object (row record) exists, then determines whether its SourceID and ID are consistent (is the primary sticker or followed), if it is the primary post, put it from Sticking together, otherwise I only delete the current post, then return to the original call, if an error, turn to the error information.

<% - if the record is inherited The logic is logical, which is identified as an IDent name -%> <% - Judging whether Sourcid and ID are consistent -%> <% - Take all the primary buses, the collection is theobjs -%> <% - iterative collection content, single name is theobj -%> <% - Delete the object -%> <% - single batch, clear the object -%> The tag ends, according to NEXTO to the caller, such a small code actually plays a C role in an MVC. If you need to output breakpoints, you can call Hanva: Log to output real-time content to the log log. A more complex function is completed. The whole process is actually just one or two database access. If you are multiple buses, you need to get its string, which is possible for the second time. Note Tags, you can enter a condition, you can also enter the fields option, get an ArrayList string (without synchronization requirements, you don't need a vector). If it is not to turn it, it can replace HANVA: List, it is also more convenient. No need to set a DAO.List object before you need to first set it.

I think this is the true usage of label technology: Help programmers clearly and clearly call the background handler in the interface, facilitate the establishment of object-oriented business logic, which is convenient to hide the logic of the non-expression layer; rather than getting a page More complex, more difficult to understand the code is more new.

Relatively, Tags file label technology looks more realistic. As JSP is convenient to write simple servlets, the tags tag file is convenient to see the Class, which is easy to see, Write labels like Write Jspjavalet; obviously, it is the simplest SimpleTagsupport variant, only it has one Individual content. Also, the coding technology that best uses the Class class structure is not implemented here. JSP Development Associations seem to be passionate about providing some local convenience measures in a local unique place, often ignoring a larger requirement: all programs are completed using a single standard paradix as much as possible in project development. Use a small technology model is local convenient, but it is more managed to manage a technique, or the programmer must learn a technique that is only partially effective. This logic error begins with Sunjava's technology development from J2EE, it seems to be its invalidation. In the author, it is better to do with a small actions, it is better to have a small range of convenient measures, and there is an capable customer to achieve better. Improve Microsoft to shoot the arrogant (also non-mainstream customers), will be the reason why Sun's technology final failure.

转载请注明原文地址:https://www.9cbs.com/read-32401.html

New Post(0)