I’ve been starting doing some Java and JSP and now, I’m stuck. I’m not happy with having all static HTML’s in the root-folder. If I would pack those into a separate folder. At the moment, I see two options: configure it in the web.xml, but that only works for the servlets afaik. Configuring Tomcat on the other hand might be an option, but it would break the internal logic, even if it worked.
Is there a correct way for organizing the files and not having that reflected in the URL?
When you speak about static pages something like say header and footer.
You can place them under any subfolder say inside jsp/static/(subcontent) or depending on the type of your file you can group them even further.
Now the usage, since because you are with plain jsp and servlet the only option that I think makes sense for static content is that include them whereever required with include directive like:
or forward the request to them with
Understanding that this is a pain, if the navigation needs to be changed you will have to change your code, then more advanced web framework like Struts, JSF, e.t.c makes sense, as navigation rules can be changed very easily without changing code (unless the flow causes model to change or any different scenario).
Along with navigation rules these framework also specify page building configuration like tiles in Struts, templates in JSF e.t.c