P
P
P_Alexander2018-01-12 22:58:40
Java
P_Alexander, 2018-01-12 22:58:40

How to setup entry point in webapp?

Worth TomCat 9 I write in the latest IntelliJ IDEA wrote a couple of servlets everything works but not as it should! In the web.xml file, I registered a wellcome file

<welcome-file-list>
        <welcome-file>/index.jsp</welcome-file>
    </welcome-file-list>

There is also a servlet in web.xml
<servlet>
        <servlet-name>WarmStar</servlet-name>
        <servlet-class>warmStar.WarmStar</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>WarmStar</servlet-name>
        <url-pattern>/warmStar</url-pattern>
    </servlet-mapping>

When index.jsp is launched, it also works out the url in the browser like this - localhost: 8085 I need the url to be like this at the first start - localhost: 8085 / warmStar so that it would be right away. That is, it turns out that the servlet would immediately start working, which displayed this index.jsp page to me. I tried to change the url pattern to an empty one in the servlet mapping or just put a slash, the servlet executes index.jsp, but the url path in the browser remains like this localhost :8085 In a arc in a servlet I'm doing a forward on index.jsp And yes, it's worth saying that this is my first application, I'm sorry if I wrote nonsense. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2018-01-17
@P_Alexander

The web application itself (at least its web part) does nothing at startup.
All the magic starts with an http request.
In order for Idea to open the correct url:
Run/debug configuration->Tomcat Server->Server->Open Browser
-Check After launch
-Set url
Original instructions:
https://www.jetbrains.com/help/idea/run- debug conf...

A
Alexey Kopendakov, 2018-01-14
@alex_kag

So who's stopping you from changing /index.jsp to the right path? You mean replace /index.jsp with /warmStar ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question