write in front
The blog project introduced this time can be said to be a bit alternative, because most of the technologies it uses are not mainstream technologies, from front-end to back-end framework to database selection. Of course, sparrows are small but complete. The application of technology needs to learn to be flexible. In the process of learning, everyone can compare the learning and find the advantages and disadvantages compared with the mainstream framework technology, so as to deepen your understanding of the application of a project or framework, and build a framework and study for you in the future. Framing ideas are all good.
Tale official profile
Blog Tale uses the lightweight mvc framework Blade development, the default theme uses a beautiful pinghsu .
######characteristic
- Simple design and beautiful interface
- Markdown article published
- Custom Article Links
- Support for multiple themes
- Plug-in extension support
- Support Emoji expressions
- Support NetEase cloud music playback
- Support for attachments and database backups
- Simple deployment, does not depend on Tomcat
- No database needed, Sqlite embedded
######Tale project git https://git.oschina.net/biezhi/tale/ ######Tale project wiki https://github.com/otale/tale/wiki ##### #Tale demo address https://tale.biezhi.me/
Introduction to Blade MVC Framework
Blade draws on the design of many excellent mvc frameworks. It is a convenient and easy-to-use framework for Java developers to get started quickly. You can use it to quickly develop various applications such as API, Web and back-end services. It provides a lot of functions, built-in ioc, rest routing, view rendering, json return, unified configuration, aop, non-orm jdbc operation and so on. The framework provides many external extension interfaces to support developers to use their favorites, such as template engines.
For the principle of the blade mvc framework, you still need to read the official documentation yourself.
######characteristic
- Lightweight. Don't depend on more libraries, get rid of SSH's bloated, modular design, and it's lighter to use!
- Modularity (you can choose which components to use)
- Restful style routing interface
- No Orm (Active Record way to play database operation)
- Template engine support
- Non-web development and publishing
######Blade MVC framework git address https://github.com/biezhi/blade ######Blade MVC framework official documentation http://bladejava.com/ ######Blade MVC framework Official api documentation http://bladejava.com/apidocs/
jetbrick-template template technology
jetbrick-template is a new generation Java template engine with high performance and high scalability. It is suitable for dynamic HTML page output or code generation, and can replace templates such as JSP pages or Velocity. Instructions are similar to Velocity, expressions are consistent with Java, easy to learn and use.
######Official template rendering process example template userList.html
#define(List<UserInfo> userlist)
<table>
<tr>
<td>序号</td>
<td>姓名</td>
<td>邮箱</td>
</tr>
#for (UserInfo user : userlist)
<tr>
<td>${for.index}</td>
<td>${user.name}</td>
<td>${user.email}</td>
</tr>
#end
</table>
process:
- Create a custom configured JetEngine object. It is recommended to use the singleton pattern to create.
- Obtain a template object JetTemplate according to the template path.
- Create a Map<String, Object> object and add your data objects.
- Prepare an object to be output, OutputStream or Writer.
- Render the template based on your data objects and get the output.
Code:
// 创建一个默认的 JetEngine
JetEngine engine = JetEngine.create();
// 获取一个模板对象
JetTemplate template = engine.getTemplate("/sample.jetx");
// 创建 context 对象
Map<String, Object> context = new HashMap<String, Object>();
context.put("user", user);
context.put("books", books);
// 渲染模板
StringWriter writer = new StringWriter();
template.render(context, writer);
// 打印结果
System.out.println(writer.toString());
######jetbrick-template template git address http://git.oschina.net/sub/jetbrick-template ######jetbrick-template official document address http://subchen.github.io/jetbrick -template/2x/overview.html
SQLite
SQLite is an open source embedded relational database that implements a self-contained, zero-configuration, transaction-enabled SQL database engine. It is characterized by being highly portable, easy to use, compact, efficient and reliable.
The sql syntax of sqlite3 is basically the same as that of mysql.
After running the Tale project and installing it, there will be a SQLtite database file tale.db in the root directory of the project, which is the database file of the project. Viewing the database is also simple. Switch to the root path of the project and open the command line . Enter sqlite3 tale.db , which is equivalent to mysql's use database. According to the syntax of sqlite3, you can use sql statement to operate.
In the figure.table is like show tables
write at the end
If you have only used jsp as a view, you may not be particularly familiar with template technology. It is recommended to first understand the mainstream template technology Velocity and then compare with this project.
Finally, welcome to pay attention to my WeChat public account java-mindmap , more java mind maps and project information for you to learn, one will be updated every three to four days, taking you into the world of memory brain maps.
Follow the official account and reply to "mind map" to download the source xmind map immediately.