I have an old JSP project for which I use eclipse as the ide.
Once everything is configured and I test that it works, I want it to start in another path other than the default path that Eclipse launches.
when I launch the project, it runs in http://localhost:8080/miapp/
. But I want that when executing, the same is executed inhttp://localhost:8080/miapp/menu/mijsp.jsp
As a bonus, I want to pass parameters to it so that it looks like this:http://localhost:8080/miapp/menu/mijsp.jsp?param1=aaa?param2=bbb
When I run it, and type the path by hand it goes to that page, so the project works.
The folder structure of my project is like this:
I suppose that I have to modify something in the Deployment Descriptor, but for a change I can't find anything that tells me what to modify or how...
Extra bonus: if someone knows how to modify the route so that where it says myapp they can change it, they get an extra coffee...
I start with the extra bonus:
Tomcat by default uses the name of the war file as the name of the application. When deploying from eclipse you have to tell the IDE to use another name, which means changing the "context" from
miapp
to something else:Now the other question:
How to use
/menu
instead of/
? Well, basically redirecting : move the jsp file that you want to load to the directory/menu
and in the root you can put an index.jsp file that forwards the browser to where you want:One catch is that if you want to use parameters here, they won't be passed to the destination.
Therefore, you could do a
forward
, making both URLs equivalent (in this case, the client is not sent to a new URL, but one JSP delegates to another: