java - How to get the address bar in velocity?
伊谢尔伦
伊谢尔伦 2017-06-30 09:56:04
0
2
1162

Like the title~~~

I have tried several methods on the Internet but all reported null pointers

code show as below

 <tool>
    <key>link</key>
    <scope>request</scope>
    <class>org.apache.velocity.tools.view.tools.LinkTool</class>
</tool>
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
洪涛

The address bar can only be obtained in JavaScript scripts, using window.location. Reference documentation:
https://developer.mozilla.org...

仅有的幸福

As @fabricated belief said, you can use window.location to get the address bar (client-side method) on the web page.

To obtain the address bar from the server side, use request.getRequestURL(), and the content after ? needs to be obtained from request.getQueryString(), and the content after # cannot be obtained.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template