JFinal implements pseudo static

JFinal is an extremely fast WEB + ORM framework based on the Java language. Its core design goals are rapid development, less code, easy learning, powerful functions, light weight, easy expansion, and Restful. With all the advantages of the Java language, it also has the development efficiency of dynamic languages ​​such as ruby, python, and php! Save more time for you to spend with lovers, family and friends :)

The JFinal framework can implement pseudo-static, which needs to be set in configHandler. JFinal can use Handler to completely customize routing rules. Currently, the routing rules adopted by JFinal take into account the considerations of simplicity, efficiency and usability.

JFinal的configHandler:

Set in configHandler:

    @Override
    public void configHandler(Handlers me) {
        
        // Pseudo-static, the suffix name of the request 
        me.add( new FakeStaticHandler(".html" ));
         // Get the project path 
        me.add( new ContextPathHandler("ctx" ));
        
    }

Then add .html to the normal request

for example:

             <li>
                <a href="casepage">
                    <p>业务案例</p>
                    Case
                </a>
            </li>

Change it to:

             <li>
                <a href="casepage.html">
                    <p>业务案例</p>
                    Case
                </a>
            </li>

Then you need to solve the problem of passing parameters and taking out parameters in the background:

You can refer to the documentation: 

Using this method, our department implements pseudo-static parameter transfer.

Here is an example:

When accessing the address culture, pass the parameter 123

access

get parameters

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324692652&siteId=291194637