0

web.xml url mapping

asked 2019-07-03 19:14:35 +0800

ahmeduka gravatar image ahmeduka
1

hellow guys

problem description: i have file in application root:

userrights.zhtml

and to go to page userrights.zhtml i have to put in url: ..:8080/app/userrights.zhtml but how to change that to url like this: ..:8080/app/userrights (without file extention)

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-07-04 10:20:58 +0800

cor3000 gravatar image cor3000
4596 2 7
ZK Team

updated 2019-07-04 10:21:38 +0800

Not a 100% solution, but the simplest thing servlet containers offer is the <welcome-file-list>

As mentioned in our example web.xml just add index.zhtml

<welcome-file-list>
    <welcome-file>index.zul</welcome-file>
    <welcome-file>index.zhtml</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
</welcome-file-list>

Instead of just the file userrights.zhtml you can then create a folder with an index.zhtml inside, e.g. /userrights/index.zhtml

then you can access this file from the URL ..:8080/app/userrights

Maybe that's already enough, and doesn't require additional configuration/code. However if you need custom forwarding rules, you can always implement a servlet filter and forward requests as needed. Or add forwarding rules to your webserver, such as nginx or apache httpd.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2019-07-03 19:14:35 +0800

Seen: 6 times

Last updated: Jul 04

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More