AppFUSE Learning Notes - Components & Tools

xiaoxiao2021-03-06  44

Using a large number of third-party components is the main characteristics of AppFuse, let's take a look at what components he use. 1. Displaytag: Self-feel is the largest component of the encoded amount in Appfuse, I specialize in articles using DisplayTag, http://blog.9cbs.net/clearwater21cn/archive/2005/02/21/296316.aspx I don't say it here. 2. JSTL: JSP Standard Tag Library is a Custom Action, or a Custom Tags (custom label), which is built on the JSP, similar to the tags in the HTML syntax. JSTL provides tools and processes such as cyclic, conditions, database access, XML processing, internationalization (I18n), etc. This system mainly uses JSTL core tag library and formatted tag label implementation dynamic web pages and international support. 3. Sitemesh: Used to establish a composite view. Designed to improve the maintenanceability and reuse of the page. SiteMesh Apply Decorator Mode, intercept request and response with Filter, combine the page component head, content, banner as a complete view, which is convenient to establish composite view mode. 4. Struts Menu: AppFuse author Write the web menu framework for applications based on JSP and Struts. Use it to build a tree menu via an XML definition and a JSP tag. 5. Oscache: OSCache is a cache technology for a web application layer in the OpenSymphony organization. Through the output of the cache page, it can be significantly improved system operating performance. And can improve the stability of the system. 6. URLREWRITE: Address transform technology, you can transform the URL in your application into a custom style. 7. ACEGI: 1.8 Add to new components, subprojects belong to Spring. It provides secure and authentication security services using Spring, including the use of bean context, interceptors, and interface-oriented interface. Therefore, the ACEGI security system can easily apply to complex security requirements. AppFuse uses it to achieve user authentication and authorization management. 8. Quartz: There is no use of this component in Appfuse, but I think it provides the features that are used very often, and it is very good, so it will take it. Quartz is a framework for realizing task timing dispatch. It provides an easy-to-use interface that implements the interface of the dispatchable task, and implements powerful task schedules (can run independently, can be deployed as EJB in the container, itself Support Cluster, etc.), which is provided by Spring.

AppFuse also provides us with or introduces a lot of tools to greatly speed up our development speed. If you can use these tools well, we can only give POJO of a table, which can automatically generate all the data tables corresponding to the POJO, which typically require, delete, change, check the function of the model layer, control layer. Viewing the layer file, almost no longer modify all basic operations for this table. 1. Appgen Appfuse gives us a tool with code generated by xdoclet, let's take a look at how it is used. POJO (Plain Old Java Object) represents an object view of an entity stored in a persistent memory (such as a database). It is mapped to data in the memory via HBM.xml configuration file. First of all, you need to have Pojo of this table, put in src / Dao / ORG / AppFUse / Model. Enter the extras / appgen path under the console, type ant -dmodel.name = xxx -dmodel.name.lowercase = xxx, the first XXX writes your Pojo class name, the second XXX writes this object The name at lowercase. When building buildful when the console occurs, the code is generated. Code under the Extras / Appgen / Build / Gen folder, including Java source code (DAO, Service, Action), unit test, JSP, resource file, XML configuration file, source data, etc., the directory structure is consistent with the original item, you only Drag the needed directory to the corresponding project root directory, of course, some code is to modify on the existing file, mainly the attribute file and XML file, then you need you to put new code Manually transfer to the original file. Appgen can also save this trouble, just add an install in the previous paragraph, namely ant install -dmodel.name = xxx -dmodel.name.lowercase = xxx, appgen will directly generate the code to your project In order to modify the existing file. At this time, it is best to back up the code first.

2. XDoclet Note Appgen generated files lack HBM.XML and ACTION FORM Bean, do we have to write it yourself? no. Check the build.xml file will find that there is no HBM.XML, FORMBEAN, even Web.xml, struts-config.xml, validation.xml, and Validation.xml, no even Web.xml, struts-config.xml, validation.xml. These files are When we perform Ant Setup, build.xml is automatically generated using XDoclet. Even databases and tables, the data in the table can also be automatically generated. Mystery is in Pojo. View user.java Pojo You will find that in addition to Java code, there are many comments, there are @Hibernate started, @ Struts started, these are the XDOctlet tag. We roughly explain: @ struts.form: Used to generate form bean, write @ struts.form incrude-all = "true" extends = "baseform", meaning in the Pojo in Form Bean must have, and the generated form bean file should inherit Baseform. If you do not want to generate the formBean contains all properties of POJO, you can fill in the comment before the relevant property GET method, which means that this property is generated in the FormBean. So what if we want to add some Pojo in Formbean? Open the metadata / web folder, you can see an xdoclet-userform.java file, which is User.java to generate newly joined code when generating form bean, we can also create our own code to add code in Formbean to a xdoclet The -pojofrom.java file is fine. @ Struts.validator: Used to generate a validation.xml file. The most commonly used @ struts.validator type = "required" means that it is necessary to have a required verification in the form. Of course, the premise is that this attribute is also in the FormBean. Validation has a configuration is a custom verified rule, represented using regular expressions. There is a file Validation-Global.xml in metadata / web, there is a configuration of a zip code. @Hibernate: This is more complicated to generate hbm.xml files. In fact, the content is basically consistent with HBM.xml, so if you write hbm.xml, this will also write. Beginners can first build a table, use the tool to generate hbm.xml, and then write this tag according to the generated HBM.xml content. Once the label is written, you can generate hbm.xml, build.xml can also be automatically built in the database. @ Struts.Action / @ Struts.Action-Forward: Pojo Can't generate struts-config.xml, this tag is to write in the action. If you use Appgen to generate an action, you will see @ Struts.Action is already written, the role of this tag is to generate the map code in Struts-Config.xml, which is the same as struts-config.xml, is actually Migrate the configuration in XML into the action.

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

New Post(0)