jsp how to get base url cleanly without javascript
问题 I'm trying to get the base url (for example: https://stackoverflow.com/) without using javascript. But there seem to be a lot of ways to split it off from https://stackoverflow.com/questions/ask so I was wondering what the cleanest way was (or if there's a preferred method). jstl functions would probably do the trick, but I'd like it to be as dynamically as possible, so I wouldn't have to change it if the /questions/ part was to change to let's say /question/. ${pageContext.request.scheme}://