In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you what the idea of making JSF table components is, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article, without saying much, follow the editor to have a look.
I doubt using pure JSF to do the same table component, I believe that JSF can be used in the development platform, and JSF is based on Servlet technology, how can it not be implemented? Do it in three days! I have always believed that technology lies in the people who use it, not in the technology itself.
Download the JSF Table component
Look at the picture first:
And look at the corresponding JSF tags.
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:cby="http:/www.lifesting.com/jsf"> < ui:composition template="/tpl.xhtml"> < ui:define name="pageTitle">Table display
< /ui:define> < ui:define name="pageHeader">Country
< /ui:define> < ui:define name="body"> < h:form> < h:panelGrid columns="1"> < h:message for="mytable" /> < /h:panelGrid> < cby:rns text="页面设置" tableFor="mytable" /> < cby:filter text="过滤策略" tableFor="mytable" /> < cby:delete tableFor="mytable" /> < cby:table id="mytable" var="rec" checkable="true" idField="code" bean="Country"> < cby:column field="name" sortable="true" filterable="true" width="200" value="名称"> < h:outputText value="#{rec.wrapped.name}"> < /h:outputText> < /cby:column> < cby:column field="region" sortable="true" filterable="false" width="100" value="区域"> < h:outputText value="#{rec.wrapped.region}"> < /h:outputText> < /cby:column> < cby:column field="surfaceArea" sortable="false" filterable="true" width="150" value="表面积"> < h:outputText value="#{rec.wrapped.surfaceArea}"> < /h:outputText> < /cby:column> < cby:column field="population" sortable="true" filterable="true" width="100" value="人口"> < h:outputText value="#{rec.wrapped.population}"> < /h:outputText> < /cby:column> < cby:ds /> < /cby:table> < /h:form> < /ui:define> < /ui:composition> < /html>Because the development platform ultimately takes BO as the core, this table component acquires data by setting bean and then through Hibernate.
This JSF table component in addition to the use of JSF + Facelet, there is no other page technology, simple code, no abstraction, and there are comments, beginners can refer to.
The main functions of the JSF table component are:
1 set the filterable attribute (true/false) of column to filter data (currently implemented as left matching, for example, enter Sa, which starts with Sa)
2 paging navigation
3 set the sortable property (true/false) of column to sort a column forward / reverse
4 change the page record size. The default is 20 entries per page.
5 set the checkable property of table to true, and the table will have one more column to select.
6 you can delete records that have been checked in batches.
This component only considers function, not beauty. If you think you can use it, change its html property setting.
Installation:
1 attachment is a Maven project and must have maven installed.
2 install MySQL database, start MySQL, run
Create database world
3 find the world.sql under the project, assuming the path is / a/b/c/world.sql, and use the source command of MySQL
Use world
Source / a/b/c/world.sql
4 modify the user name / password of the MySQL database in hibernate.cfg.xml under the project.
5 execute mvn jetty:run startup
6. You can see the effect by typing http://localhost:8080/jsftry/ in the browser.
About debugging:
1 download an Eclipse JEE version
2 execute mvn eclipse:clean eclipse:eclipse-DdownloadSources=true-Dwtpversion=1.5 under the project directory
3 import this project in eclipse workspace
Although I haven't used Java at work for a long time, I still think Java is really productive. JSF,Hibernate,Maven,Eclipse is better than the other.
The above is the idea of making JSF table components, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.