Questions tagged [Java servlets] (101)

0
answer

Why @RequestHeader is not getting added to the header in a filter?

Why am I not getting the value in the method parameter, @RequestHeader ("Custom-Header"), although getting it in @RequestHeader Map<String, String> headers? Initially, the request arrives at the server without the "Custom-Header", I add it in your filter. After that the request goes to method, but for some reason spr...
Noemy85 asked April 16th 20 at 10:40
2
answers

How to test servlet?

I have a servlet public class ConformPay extends HttpServlet { private static final Logger LOGGER = Logger.getLogger(ConformPay.class); private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String confirm...
lisette_Roberts84 asked April 9th 20 at 10:48
1
answer

How to give data in tomcat?

learn the basics of java ee (servlets, jdbc). For practice I use tomcat. Created a simple client - I send him text data, catch them on tomcat without problems. Trying to send a response and... do not know how to do it! At the docks on the HttpServletResponse is simply not find any similar to what I want method. I am suffer...
jocelyn asked April 8th 20 at 10:00
0
answer

How to perform Logout Servlet?

How to perform logout in the servlet, so that after logout it was impossible to return "Back" button of browser? At the moment the servlet for logout looks like this: // Logout @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session ...
damaris_Dougla asked April 7th 20 at 15:42
0
answer

How to write the servlet path, so you don't have to repeat the name of the WAR file?

Good day! After "deploy" varnika on Tomcat project is opened with this URL: localhost:8080/MyWebApp and localhost:8080 opens the welcome page of Tomcat. QUESTION: When I create a servlet and put this path web.xml I would like to set the path approximately /secondpage and NOT had to include the name varnika in the URL , for...
trevor_Hauck63 asked April 2nd 20 at 16:28
1
answer

How to run servlet in Tomact without the IDE?

Good evening. Started to learn Java servlets Downloaded raspokoval Tomcat in the webapps folder, created a folder helloworld In the web-inf folder create a class classes/HelloWorld.java and compiled using cmd javac -cp ../../lib/servlet-api.jar HelloWorld.java here is the content of the file import javax.servlet.ServletExce...
gregoria asked April 2nd 20 at 16:01
1
answer

Tomcat Servlets?

Did I understand correctly from the article in the wiki, under the servlet refers to the java class which inherits from HttpServlet? In this case, when they say that Tomcat is a container mean that it stores all servlets within themselves and manages their lifecycle( As Spring and Bina) ?
Garnett.Schuppe asked April 1st 20 at 17:33
1
answer

When you run the servlet on Tomcat Intelligi error Error running 'Tomcat 9.0.27': port out of range:-1?

Error running 'Tomcat 9.0.27': Unable to open debugger port (127.0.0.1:57537): java.net.SocketException "socket closed" what to do?
dorian_Schad asked March 31st 20 at 20:08
1
answer

How to know the size of the response body in a Java Servlet Filter?

How to know response size (bytes) after passing through the filters chain? Code of filter:MyFilter.class@WebFilter(mapping includes={"/*"}) public class MyFilter implements Filter { private final Logger logger = Logger.getLogger(getClass().getSimpleName()); @Override public void init(FilterConfig filterConfig) throws Ser...
Trever22 asked March 30th 20 at 01:11
0
answer

I do not understand how it works?

Actually there are files in C:\Users\User\Desktop\Tropic-Island\Tropic-Island\Java\apache_tomcat\apache-tomcat-8.5.23\webapps\ROOT edit.jsp,index2.jsp notfound.jsp,create.jsp I go to localhost:8080/index2.jsp here are its contents <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html> ...
Jamison_Harb asked March 29th 20 at 23:15