Answer the question
In order to leave comments, you need to log in
Jetty-maven-plugin is a cool tool, or is it better (*****) not to use it!?
I looked about what a cool utility jetty-maven-plugin is . Built into the project as a maven plugin, launched and works, class.
I started trying various options for its usage, and then it started ..
(For ease of viewing in github Octotree .)
If you use jetty with servlets and mapping, use the @WebServlet annotation.
git sources . It seems that everything works and everything is fine, the mapping works, jsp pages open and the forward method inside the servlets works.
If you use jetty with servlets and mapping in web.xml git sources . And it seems to work too.
If you use jetty with servlets and mapping in web.xml and use @WebServlet mapping annotations here (and + use TwitterBootstrap + JSTL tags lib) git sources .
That mapping works through (firstServlet) web.xml. And mapping via @WebServlet (@WebServlet(urlPatterns = {"/forwardServlet"})) doesn't work.
If you add mapping lines to web.xml, on ForwardServlet, the server won't start at all.
+ Plus, JSTL seems to work, separate *.tag blocks are loaded into the jsp page, but specifying ${pageContext.request.contextPath} in the link does not work (it should transform it into contextPath, which is specified in the application settings).
Okay i.e. at the same time, it’s even impossible to combine mapping of one and the other, as for an example in Jetty (especially since after downloading the javacodegeeks book, I found confirmation that you can’t use them at the same time in Jetty. And in TomCat everything was fine., and connecting a bunch of everything, everything works ( I used IDEA Ultimate by connecting TomCat through it) git sources - yes, by connecting the jetty-maven-plugin there, and trying to run through it, of course, did not work.).
Clearly, mappings in Jetty don't work like that, of course, that's fine.
Reading that little book with javacodegeeks in it, there are links to the source codes of the examples given in it.
Went through all the examples. We connect our jetty-maven-plugin, and use the mapping through @WebServlet, and strictly no xml at all (logback.xml does not count),git sources .
We throw our servlets on top of this example project, there is also JSTL and + BootStrap.
Starts (but contextPath works for some reason, only after restart i.e. kill it, and on new mvn jetty:run ).
Go to the page that contains JSTL and Bootstrap .. everything works and everything is fine.
We throw web.xml into WEB-INF, and edit the welcome-file to bootstrap.jsp _ (which is not much different from index.jsp).
As a result, only links to jsp pages work, and ${contextPath}, mapping to servlets magically stops working .. BUT as soon as we delete our web.xml (or transfer it to a folder where it should not be.), it will be loaded first index.jsp and everything works again!
Well, how to use it, so that you can use web.xml?
Or is it better to try other variations of embedded servos, less buggy, what options do you use?
(Spring Boot - yes, I know, it's not bad, but what are the other options?
Like a jetty-maven-plugin, but without its glitches.
Play Framework - no good, long story, in general, it's not the Java Way.)
Or I'm just jetty-maven- plugin, am I cooking wrong? (If so, what is the reference example of a jetty project, and where can I look at it?)
Answer the question
In order to leave comments, you need to log in
Before scolding jetty, compare your servlets with Apache Tomcat. Maybe you put on the sides there?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question