Recently made a small Java Web site, here is a brief introduction to some of the techniques used in the project.
1.jquery.js--Official website http://jquery.com/
Development of the front end is bound to use JS, to the efficient use of JS, how to get less jquery?
The following is a simple comparison of the native JS and jquery syntax, I believe you can appreciate the power of jquery:
1). Get to an Element object with ID--jquery powerful selector JSvar obj = Document.getelemnetbyid ("id" c6>); Jquery var obj = $ ("#ID");
2). Execute a function after the page is loaded
JSwindow.onload=function () {...} ;
Jquery: $ (function () {...});
jquery can be a great convenience for project development, so mastering jquery is also a very necessary skill.
2.wdatepicker.js--Official website: http://www.my97.net/dp/demo/index.htm
The project is often used to allow users to enter the time of the place, it is recommended to use time space to allow users to choose the time, and it is not recommended for users to fill, so here is a control to pick up time, the following posted:
in the following squares of the small box, you can choose the month, year, and date, and even choose a few points, you can limit the user to select a date before the not selectable to after ... function is very comprehensive, can be quite powerful, but also an essential tool, and the official release of the source code, you may go to the official website to Learn more detailed information .
Of course, there are many other excellent time controls, to be explored by everyone.
3. Apache POI (blockbuster debut)--official website: https://poi.apache.org/
The first two say is a front-end tool, and this poi for the server side, this is not small, is an Apache open source project, can be very flexible to read the contents of the Excel document, and even can
with Java code generates specific Excel files, can handle word, PPT, Visio ... The following is a simple demonstration of the core code for generating an Excel file:
//Create a Workbook objectWorkbook WB =NewHssfworkbook (); //Create a new sheet in workbookSheet Sheet = Wb.createsheet ("New Sheet"); //to create a new rowRow row = Sheet.createrow (( Short) 2); //set values for each column at onceRow.createcell (0). Setcellvalue (1.1); Row.createcell (1). Setcellvalue (NewDate ()); Row.createcell (2). Setcellvalue (Calendar.getinstance ()); Row.createcell (3). Setcellvalue ("a string"); Row.createcell (4). Setcellvalue (true); Row.createcell (5). Setcelltype (Cell.cell_type_error); //writes workbook information to a fileFileOutputStream fileout =NewFileOutputStream ("Workbook.xls"); Wb.write (fileout); Fileout.close ();
This is also a small example of the official, more detailed usage, you can go to the official website to see the detailed documents, you can also find some tutorials on the internet, a lot of tutorials.
4.datatables.js--Official website: https://www.datatables.net/
Project to have a list of words, there must be pagination, paging everyone to listen to a think that is the back end of the matter, the front-end is only responsible for requesting a few pages, the backend in the processing, but encountered a small amount of data, and the front-end requirements are more flexible, you can consider datatables this tool.
A DataTable can help you page through the data in the previous paragraph, for example: that is, 100 elements in the JS control page are displayed as 10 pages, and you automatically arrange the styles, generate page numbers, bring your own search,
sorting function, and what you do, just fill the table with data. The following stickers are:
You may have used it, madly in love with it, but remember, this only applies to small data, front-end requirements are flexible, for a large number of records list, this is not very applicable.
5.Apache Commons Components--official website:http://commons.apache.org/
For background development, there are many high-frequency operation, Apache development of Commons can bring great convenience for our development, this project has a lot of components, commonly used have lang, Logging, Math ...
For example: Determine if a string is null and "", compared with the stringutils of Java and coomons Lang:
1 if Null | | Str.length = = 0) {...} /* Java */
2 if(Stringutils.isempty (str)) {...} /* StringUtils * /
Another example is Javaio save the file, Java and ioutils write this separately.
1 /*Java*/ 2InputStream in =NewURL ("http://commons.apache.org"). OpenStream ();3 Try {4InputStreamReader InR =NewInputStreamReader (in);5BufferedReader buf =NewBufferedReader (InR);6 String Line;7 while(line = Buf.readline ())! =NULL ) {8 System.out.println (line);9 }Ten}finally { One in.close (); A }
- - /*ioutils*/ theInputStream in =NewURL ("http://commons.apache.org"). OpenStream (); - Try { - System.out.println (Ioutils.tostring (in)); -}finally { + ioutils.closequietly (in);20}
is not very convenient, this is used to do the project is extremely convenient, but as a personal practice, should try to avoid excessive reliance on these third-party tools.
Technology first introduced here, the above technology, I have been around, I just here to tell you what technology can bring convenience or solutions to the project, the specific operation of the use of the Internet, there are countless tutorials, I do not have to write down. So, know this, everyone go to learn it. Thanks for watching.
In addition: Do a few projects of small experience, you can see, discuss the discussion, here put another blog address: http://www.cnblogs.com/WreckBear/p/5093864.html
Project Technical Summary