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中文网2017-06-30 09:58:04
The address bar can only be obtained in JavaScript scripts, using window.location. Reference documentation:
https://developer.mozilla.org...
仅有的幸福2017-06-30 09:58:04
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.