Questions tagged [servlets]

Servlet is a Java application programming interface (API) running on the server machine which can intercept the requests made by the client and can generate/send a response accordingly.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
11 views

How to get multiple values of same key "roles" using request.getPart("roles") in java from FormData request body? [duplicate]

I have a multipart/form-data request that has a field "roles" that can have multiple values. And I want to read all the values in my java server-side code. This is how my request looks like ...
Vidit Pawar's user avatar
0 votes
0 answers
21 views

How can I create and select a servlet in IntelliJ IDEA? [duplicate]

How can I create and select a servlet in IntelliJ IDEA? I'm creating a Jakarta EE project, clicking on Java, and creating a new file, but I can't find the option to create a servlet. I can create it ...
Vũ Trần's user avatar
0 votes
0 answers
30 views

@Inject does not seem to work in my @WebServlet, the dependency is null

This is my servlet code. I'm using java ee and servlet to save my information. I used dependency injection. when I press button to run the servlet I have the error: Cannot invoke "appuser.model....
F.M's user avatar
  • 487
0 votes
1 answer
51 views

Safe way to get the current HttpSession in Spring 3+

In Spring 2+ I used to retrieve the javax.servlet.http.HttpSession via autowired constructor without any bean declaration: @Service class UserService @Autowired constructor( private val ...
marcin's user avatar
  • 11
-1 votes
1 answer
43 views

Receive http requests in Java desktop application [closed]

I have a Java desktop application (jdk8, but I can upgrade no problem) that runs in a loop and communicates to other devices via SocketChannel. There is also a backend for a web application made with ...
Hans GD's user avatar
  • 52
-1 votes
0 answers
57 views

JSTL code not working ? Java Servlet with JSTL code not executing?

In JSP Class only otherwise condition is executing. Why ${not empty userObj} condition is not executing ? Servlet Class Code: /*In this code I set Attributes in `userObj` for us is not `null` and `...
Coding Warrior's user avatar
-1 votes
0 answers
28 views

Java servlet fails to fetch data from 3rd party web servers

I'm having a problem with a Java servlet that that fetches 3rd-party web content. My website gathers weather data from 3rd-party web servers. For 3rd-party web servers that support CORS, I just fetch ...
John's user avatar
  • 1,633
-1 votes
0 answers
26 views

I am using Tomcat 8.5.96 and I cannot connect JDBC to my database with Tomcat. My Tomcat local server doesn't see my MySQL database problem [duplicate]

enter image description here My Tomcat local server doesn't see my MySQL database problem... <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> Connection c = ...
Dương Đức's user avatar
0 votes
0 answers
38 views

How to integrate OTP authentication into existing JSecurity Login?

I have a pure JavaEE application (EJB Jars and Web Archive) The WAR according Java EE security defines the j_security_check action for login forms (FORM Based Authentication) If userId and password ...
Shaikh's user avatar
  • 11
0 votes
0 answers
109 views

ServletResponse Redirect show application server address in 302 response

Why does a "hidden" 302 response is sent after a redirect showing my application server ip address and its port, (see the image above) This is considered as a sensitive information by the ...
Hani Z.'s user avatar
  • 61
-2 votes
1 answer
59 views

Docker Tomcat Container giving 404 while running servlet

I am getting this error when I run my Docker container built using my application's war file: HTTP Status 404 – Not Found Description The origin server did not find a current representation for the ...
KP Singh's user avatar
  • 344
0 votes
1 answer
50 views

In eclipse when I try to create a Servlet by implementing the Servlet interface then the annotation method does not create the correct link on running

import java.io.IOException; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet....
user20470572's user avatar
-1 votes
1 answer
140 views

Can't access variables in imported .java classes in .jsp file

I have a problem with importing a class into a .jsp file. When I try to import the program keeps working, but I can't access the variables. I am trying to import the GameServlet.java class into game....
guralover36's user avatar
-2 votes
0 answers
10 views

Passing Data From Spring GlobalFilter to Controller

New to spring and trying to replicate some of the functionality we have on our current TomCat Server with filters. On the legacy java code I check each request for a valid user specific JWT in a ...
Tri Dave's user avatar
-1 votes
0 answers
29 views

HTTPServletResponse - How to Set Header before redirect?

I have a java based struts application & need to redirect from a java class to an external domain. So, I am redirecting as below, which works fine. httpServletResponse.sendRedirect(EXTERNAL_URL); ...
Tanuj Kathuria's user avatar
-1 votes
0 answers
18 views

JSP can't find SERVLET when I use <a> [duplicate]

Please I need help, I have a JSP file. In the menuvar I put an that must call the servlet, but I'm getting the famous HTTP404 Not Found. I will share my code. enter image description here JSP: `This ...
Stuart Calle's user avatar
0 votes
1 answer
47 views

Empty Object in doGet Java Servlet [duplicate]

I'm using a method to that get some informations from a database and return an Object with that data. When I use this method on a Servlet doGet the Object comes empty. When I do the same thing on a ...
Drogo's user avatar
  • 1
-1 votes
0 answers
53 views

HTTP Status 404 – Not Found - Java Servlets [duplicate]

My error: Type Status Report Message The requested resource [/Ebook-App/register] is not available Description The origin server did not find a current representation for the target resource or is ...
Vlad's user avatar
  • 1
0 votes
1 answer
47 views

Pac4j Editing Configuration of a Client Based on UI

I am Using Pac4j 5.0X with Java 8 Jee Project which is maven based. For reference:: https://github.com/pac4j/jee-pac4j-demo/tree/5.0.x In this ,I am using Webservlet for editing the Config changees @...
rithvik 's user avatar
0 votes
1 answer
43 views

Problem with Tomcat Servlet startup using @WebServlet annotations [duplicate]

Good morning. I have a problem with my servlet startup. Could you please help me? I am using Tomcat 9.0.82 Coretto 11.0.17.8.1 Windows 10 19045.3570 I have a compiled WAR archive with the following ...
xplox's user avatar
  • 1
-1 votes
0 answers
20 views

Error:Message The requested resource [/Project1/EOCheck] is not available

Goal of project: Accept a number from user on html page > call servlet that calculates if number is odd or even and then display if number is odd or even. Error: Message The requested resource [/...
KSR's user avatar
  • 7
0 votes
0 answers
19 views

Addressing Compatibility Issues with Apache Commons FileUpload in Java 17: Transitioning from javax.servlet to jakarta.servlet [duplicate]

`During the migration of our codebase from Java 11 to Java 17, we encountered compatibility issues with the Apache Commons FileUpload library (version 1.4). The problem arises because the library's ...
Dipak's user avatar
  • 11
-1 votes
0 answers
25 views

javax.ws.rs.core.Response.readEntity returning MismatchedInputException

I'm trying to read the response from an API. But I'm getting this error: Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type [package].ResponseDTO '...
sublimelaconic's user avatar
0 votes
1 answer
26 views

Restarting the server in the JEE applications [duplicate]

I'm working in a project as web project with JEE in intellig. When modifying a code in a servlett the changes doesn't made. I may resart the server if i want to see the changes . This is unconfortable ...
abdou's user avatar
  • 3
-1 votes
1 answer
70 views

why doesn't onclick function work when I add it dynamically?

I am adding an html tag to the page <div id="asd" > <button id="gaga" onclick="onClick()"></button> <script type="text/...
heumn's user avatar
  • 1
0 votes
1 answer
16 views

Web Content file not getting created under project, instead WEB-INF getting created under webapp under src>main

I created a new dynamic web project in latest version of eclipse. Instead of creating ProjectName > Web Content > web inf, its creating src > webapp > web-inf. Has something changed ...
Kay Es's user avatar
  • 3
-1 votes
0 answers
20 views

value of color is not calling for the servlet from the jsp? [duplicate]

The value of color from jsp which is checked doesnot passed the value to the servlet. The jsp has retrieve the color from the database and if the database color is matched with the jsp then it will ...
Dipen Nembang's user avatar
0 votes
1 answer
34 views

how to fetch data from servlet in file html [duplicate]

i know with JSP file i can use scriplet like this: <% String errorMessage = (String)request.getAttribute("errorMessage"); %> <% if (errorMessage != null) { %> <h1><%=...
Omar Khelifi's user avatar
0 votes
0 answers
24 views

Unable to access new File("webapp/WEB-INF/classes/hibernate.cfg.xml") in a servlet environment [duplicate]

I am creating a hibernate project and I have problems creating a sessionFactory in a servlet. I'm using Glassfish 7.0.82 and JDK 20. I have a HibernateUtil class import org.hibernate.SessionFactory; ...
Massdey's user avatar
  • 19
0 votes
0 answers
27 views

Not able to build proper junit-5 test case for Aem servlet which returns json response

I wrote the below Aem servlet regestired with path type which returns json response: SampleDataServlet.java package com.myproject.core.servlets; import java.io.IOException; import java.io.InputStream; ...
Kiran Y's user avatar
0 votes
1 answer
42 views

Wildfly returns 405 for all preflight requests

I have a web application deployed on Widfly (27.0.1), and a VueJS client that tries to call a REST endpoint in this application. Because I was getting this error (Access to XMLHttpRequest at 'http://...
georgebax's user avatar
  • 115
0 votes
1 answer
37 views

Change Request URI spring [duplicate]

I want to implement a custom filter to change the URI from https://host123/app/users to https://host123/abc/users. In this case, /app and /abc are two separate spring applications running the same ...
azure_geek's user avatar
0 votes
0 answers
29 views

transfer of an HttpSession with some non-Serializable attributes between cluster nodes

Let's assume that an HttpSession, that contains a mix of non-Serializable attributes and Serializable ones (that will actually serialize properly), needs to be transferred between cluster nodes. Does ...
morgwai's user avatar
  • 2,591
0 votes
0 answers
11 views

tomcat shows 404 error, database mvn and resource not connecting [duplicate]

i am mainly getting a http 404 error , which is the following HTTP Status 404 – Not Found Type Status Report Message The requested resource [/shopping-cart/LoginSrv] is not available Description The ...
Madhuri Ruttala's user avatar
0 votes
1 answer
32 views

Why does my Angular service request not reach Java servlet?

guys: I am new to Angular. Our team is rewriting the front end with Angular 16.1.8, and keep Java (open JDK 1.8) as back end programming language. I need to implement a log class in Angular so we can ...
lxiscas's user avatar
  • 151
0 votes
0 answers
18 views

kannel sms delivery receipt url how to consume in java

I am new to kannel, I am able to send sms successfully by calling kannel sendSms get url.I want to get delivery report, as suggested to use callback dlr-ulr, i have included in url.But not able to ...
Naresh V's user avatar
  • 101
0 votes
0 answers
41 views

java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver error in servlet [duplicate]

enter image description herei am developing a java ee web application by using java, servlet,mysql database version(8.0.31), jdbc driver version (8.2.0) all ways error in my program java.lang....
T GNANESWAR's user avatar
1 vote
1 answer
44 views

Servlet request.getServletPath [duplicate]

I am new to Servlet and I am trying to learn but I am facing a problem. I have a servlet class and I want to do CRUD operation. I want each Operation redirected to a specific method. But I had a ...
Ryan Salah's user avatar
0 votes
0 answers
72 views

Same ClientID required on Subscription

How to start two subscription topics with same clientID in tomcat setup. Currently, I have started topic with different clientID on two servers and getting two messages which is correct behavior Topic ...
user17745726's user avatar
1 vote
0 answers
212 views

Eclipse web.xml "Referenced file contains errors"

"<?xml version="1.0" encoding="UTF-8"?>" In this I'm getting error in this line Description Resource Path Location Type Referenced file contains errors (...
Akash Mandal's user avatar
1 vote
0 answers
216 views

Eclipse web.xml "The error was detected when validating the file jakartaee_10.xsd"

Referenced file contains errors (jar:file:/C:/Program Files/eclipse/plugins/org.eclipse.jst.standard.schemas_1.2.500.v202302261818.jar!/dtdsAndSchemas/jakartaee_10.xsd) was the error thrown when ...
Varan Erranki's user avatar
0 votes
0 answers
26 views

java.lang.NoSuchMethodError javax.servlet.ServletContext.getVirtualServerName() Error from Tomcat 9 | method is present is servlet-api.jar [duplicate]

I am deploying my Java application (servlets) on Tomcat 9 on Windows. While deploying. I get the below error from Tomcat. The build file is of type WAR. Caused by: org.apache.catalina....
Shivam Sharma's user avatar
0 votes
0 answers
40 views

AEM DefaultGetServlet is getting called when I set my servlet to a SlingAllMethodsServlet

I have an AEM Servlet that accepts GET requests and I am trying to update it to accepts POSTs as well, but when I update the servlet to accept both it starts calling the Default sling servlet instead. ...
jmona789's user avatar
  • 2,741
0 votes
0 answers
65 views

IntelliJ IDEA 2023.2.2 to create the Servlet class, but the Name and package cannot be defined in the New Servlet, as shown in the figure

I have used IntelliJ IDEA 2023.2.2 to create a new web project, and added Tomcat Servlet-api.jar package, click the src file, select 【new】--> [servlet] JAVAEE TYPE appears; Entity Name; The Class ...
rrr11's user avatar
  • 11
0 votes
0 answers
40 views

I am getting an error while connecting jdbc with mysql server inside a servlet project file [duplicate]

Using eclipse i was trying to connect with mysql inside a servlet program but i am getting same error again and again even though i have set the classpath for mysql connector this is the error i am ...
Akshay's user avatar
  • 1
0 votes
0 answers
39 views

Servlet not receiving call from $.ajax

I want to send some data from a JSP to Java in order to execute a query from Java. I'm running the server through Tomcat. I've added the servlet to web.xml like this: <servlet> <...
Ivan Penev's user avatar
0 votes
0 answers
42 views

POST to an AEM servlet returns a Content modified message instead of the data

I have an AEM Servlet that currently accepts GET requests and returns some search results based on a query. I am trying to change the servlet to accept POST requests as well as GET requests. I made a ...
jmona789's user avatar
  • 2,741
0 votes
0 answers
34 views

How can I create bean with request scope based in non web context?

Context:- I have a spring boot application in which there is a filter, interceptor, controllers and then there is a service, we have a bean which is request based in which we set information related ...
Aakash Miglani's user avatar
0 votes
0 answers
32 views

stackoverflowerror when try to run web application [duplicate]

this is my servlet for user profile in web app. i made it /users/* pattern so every user would have it's own url. @WebServlet(name = "Account",urlPatterns = "/users/*") public ...
Nathan Ikazuyir's user avatar
0 votes
1 answer
37 views

Getting HttpServletRequestFilterable response in doPost

I'm using [Mailgun webhooks][1] to send an email and the following servlet to capture the postback. public class MyServlet extends HttpServlet { @Override public void doGet(HttpServletRequest ...
Tan's user avatar
  • 1,459

1
2 3 4 5
666