Questions tagged [servlets]

10508 questions
0

votes
0

answer
17

Views

How to pass list from jsp to servlet

How to pass list from jsp to servlet? actually, I want to add the dianomic field in my JSP and insert it through a servlet.
Tutan Ghosh
1

votes
3

answer
40

Views

How can i send mail to more then one recipient

I have a HTML form where i have a form where user can enter more then one mail id,so i don't know how can i send mail to more then one person I am successfully sending mail to one user,but here i am stuck in how to send for more then one recipient What i am done This is my EmailUntility class publi...
vivek singh
1

votes
1

answer
23

Views

multiple url mapping for same servlet URL produce error

I am trying to map multiple url pattern to same servlet and I have been writing like this. MyWebService /MyWebService /ReadWebService from my local tomcat I was able to run without issues and I can even make calls on my local host and get the result from both urls. However, when I tried to deploy th...
logger
0

votes
0

answer
3

Views

Need to retrieve rows from database

I'm trying to retrieve row by row from the database. Here I'm having 2 inputs from a user and use those 2 in 'where' condition of the query. But my code doesn't work properly. Someone, please help me with this! I'm using eclipse oxygen and mysql workbench Statements.java: public class Statements { p...
1

votes
2

answer
28

Views

How to fetch default value from an input into a servlet?

I have an input type which has a default value. I want to fetch its value inside of a servlet. So, which method will work in this case? I tried using request.getParameter('FLC1'), but that didn't work as well. Following is the input code:- Thank you
1

votes
1

answer
30

Views

Tomcat throws java.lang.IndexOutOfBoundsException

I am running a simple web project.In one of my servlet i get the user's parameters from the form and run getIf method of my UserDao class which returns all the users from the database that match some kind of a condition. Here is the code of the getIf code: @Override public synchronized List getIf(Us...
Barracuda
1

votes
3

answer
1.5k

Views

Ajax - getting separate lines of data

i would like to ask if it is possible in ajax technology (working with servlets) to get not the whole data from responseText but line by line. i mean when putting in servlet lines of text using println method (response object) i would like to get every seperate line on the client side (for displayin...
michal
4

votes
2

answer
122

Views

servlet abort multipart form data submission after validation fail

I have one jsp page which allows the user to submit a multipart form data to the servlet. This multipart form has Order Id field and another field for uploading a video of 1GB. Now at the server, I perform validation on Order Id to check if order Id is valid or not, If order id is invalid I just ret...
ashish pandey
1

votes
2

answer
2.2k

Views

servlet context and singleton object

I have seen an example of Singleton class object where it has a map containing user-id and password retrieved from database. This will help not to hit DB everytime during user login. Now i am thinking, can't this be done through ServletContext attribute. Basically on both the cases we will have appl...
Jayy
1

votes
3

answer
987

Views

Global MySQL connection or one connection for each request?

I have several servlets working on a Tomcat server. Now I let them create db connections for each request and close them after use. This may lead to huge overhead for establishing/closing connections. What about using a single connection manager servlet to share a global connection among all servlet...
NSF
1

votes
1

answer
151

Views

camel rest servlet 404 instead of 405

Using the sample code from Camel in github in 1 I am getting 404 instead of 405. This is a summary of the code in 1 rest('/provider').description('Provider rest service').consumes('application/json').produces('application/json').get('/{id}').description('Find provider by id').outType(Provider.class)...
Bill
1

votes
0

answer
262

Views

How can i modify parameterMap values using HttpServletRequestWrapper ?

I have a web application designed to play the role of a search engine. Its backend is developed in Java and its frontend in angularJS. I have the following class named PrettyFacesWrappedRequest that i found on the following link with some explanations : link here public class PrettyFacesWrappedReque...
B.Othman
1

votes
1

answer
726

Views

Changing Java EE 6 app's servlet version from 2.5 to 3.0 critical?

We have a Java EE 6 application for which I realized we still have the Servlet version set to 2.5 (Java EE 5) instead of 3.0 (Java EE 6) in web.xml: After: Someone then complained that this might have side effects and must be considered a critical change (e.g. for testing/preproduction). Question(s)...
Kawu
1

votes
0

answer
58

Views

Java runtime parameter in web.xml

Is there a way to reference a Java runtime parameter (e.g. -Dfoo=bar) in a servlet container's web.xml? E.g., in a Spring context config, I can do systemProperties['foo']}. Can I do something similar in web.xml? In case you're curious, I am trying to parameterize the security level: contextConfigLoc...
amphibient
1

votes
2

answer
347

Views

How to dynamically add and remove servlets within a servlet context in Jetty 9.4.x?

I would like to add and remove servlets within a servlet context dynamically. I know how to add multiple servlet contexts dynamically using a ContextHandlerCollection. However, I need to do the same with multiple servlets within a context. Is it possible to add further servlets, once a servlet conte...
Martin
1

votes
1

answer
350

Views

How to insert the values of a radio button and checkbox to my database with jsp? [duplicate]

This question already has an answer here: How to transfer data from JSP to servlet when submitting HTML form 4 answers i'm having some troubles with my code and i don't know how to continue. What i have is a web page that shows a list of tweet previously searched by the user. Now what i want is to...
Fernando
1

votes
0

answer
202

Views

Servlet Exception without web.xml

I have ExeptionServlet that catches the exceptions and displays the information what I need. I point out in web.xml javax.servlet.ServletException /exception java.io.IOException /exception How to do without web.xml and Spring?
GoodWin
1

votes
1

answer
112

Views

Start servlet container (Jersey Jax RS) from command line

I'm packaging an open source application as Jar (command line only) and War. I'd like to include a middle ground option, which is to run from command line as a server (for folks who aren't familir with Java, Servlets, Tomcat etc.) Is there a nice way of doing this? Ideally I don't want to write and...
nwb
1

votes
0

answer
69

Views

Error locating DispatcherServlet , no lib directory created using STS IDE

I am using STS for the first time, and using STS created a maven based web-application; using Spring MVC framework. It makes directory structure like below: I have configured Apache tomcat withing STS. When I start tomcat withing STS (and this web application getting deployed to tomcat); while tryin...
CuriousMind
1

votes
1

answer
102

Views

Dispatcher with 2 more servlet [duplicate]

This question already has an answer here: How do I execute multiple servlets in sequence? 2 answers I have a servlet named 'a.java' and I want to send data from a servlet to a jsp and another servlet. I have the following code: request.setAttribute('1',result); RequestDispatcher d1 = request.getRe...
Vanes Carrer
1

votes
1

answer
48

Views

Forwarding from servlet to JSP cause HTTP 404

I have seem some question similar like mine(like this one), but none of them solved my question. So I'll post one. My JSP website structure is like this: /subpage/funcA.jsp /main.jsp My main page contains all necessary js and css definitions, subpages don't have those defines. So If I'm going to dis...
user6309529
1

votes
0

answer
26

Views

Convention for hosting both client and service code on a single instance

Earlier we used to host client and service code on separate instances, let's say client code which consists of html, css, js is hosted on a S3 bucket while we'd launch a java based Beanstalk environment. Now I've to ship both of them together to be hosted on a single machine, what's the industry sta...
App2015
1

votes
0

answer
450

Views

Jersey Tomcat CDI dependencies explanation needed

After much trial and error, I was able to create a Jersey application with DI enabled. This is what I have in the pom.xml file: org.glassfish.jersey jersey-bom 2.26 pom import org.glassfish.jersey.inject jersey-hk2 org.glassfish.jersey.containers jersey-container-servlet org.glassfish.jersey.core je...
Jan Bodnar
1

votes
1

answer
635

Views

How can I create Servlet project with maven in Intellij Idea?

I have created a maven project in Intellij Idea. I also added jetty's maven dependency to pom file. What should I do then to create servlet project? Should I create webapp\WEB-INF\web.xml folder in main\java manually? or there is some maven plugins which I must add to Pom.xml file and after clickin...
Badamchi Davoud
1

votes
1

answer
302

Views

Java Guice with servlets Exception in thread “main” java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions

I'm trying to configure Guice with Google App Engine, but I get this problem when I start the server (with 'gradle appengineRun'): Exception in thread 'main' java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions at com.google.inject.servlet.ServletModule.configure(ServletMod...
Ábel Farkas
1

votes
0

answer
187

Views

HTML5 Video Not Working in JBOSS EAP 7.1.0

Problem Definition I have a simple web app with html5 video on index page. When i try to deploy this web application on jboss eap 7.1.0 in stand alone mode it does not display video. But when i run the same web app on tomcat it runs perfectly fine and display video in browser. Googled Solution I hav...
Abhay Choksi
1

votes
0

answer
112

Views

unable to start Pivotal tc server in Spring Tools Suite

i'm using Spring tools suite to develop a web app, but when i want to run the app, i encounter a problem with the server 'Pivotal tc server' and this is the error java.lang.Error: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]] at org.apache.catalina.star...
Abdel Jelil Zaghouani
1

votes
1

answer
93

Views

how does ${pageContext.request.contextPath} work locally and remotely?

how does ${pageContext.request.contextPath} work locally and remotely ? Here's a link! And a reference-style link to a panda. References don't have to be numbers.
sangv
1

votes
0

answer
398

Views

What's the relationship between ContainerRequestContext and HttpServletRequest? How are they linked in JAX-RS?

JAX-RS filters take ContainerRequestContext as parameters when filtering requests, but in the actual service controller, most examples I've seen get their context in the form of an HttpServletRequest like private HttpServletRequest httpServletRequest; @Context public void setHttpServletRequest(Http...
StolenKitten
1

votes
0

answer
30

Views

How to know the domain:port of a web application on ServletContextListener contextInitialized method?

I need to know the domain:port of a web application made with JSP and jersey on a tomcat server. I need to know it when the application starts, that is on ServletContextListener contextInitialized() method. There is a way to obtain it? Thank you so much
NullPointerException
1

votes
1

answer
97

Views

Result vue.js to text input html

I'm using scan QR code from web camera. instascan In index.html call function app.js(instascan/docs/..) But I can't use result value in tag {{scan.content}} to tag input type text for send to java servlet. {{ scan.content }} I'm must to
Pom Pattanachai
1

votes
1

answer
57

Views

this.start() doesn't run threat online server

I have the code below. When I run it on a local server (windows 10 & Tomcat 8.0.47 ) it all works fine, also on a second computer (ubuntu & Tomcat 8.5) itn runs wothout problems, As soon as I deploy it on an external server (Digital ocean, Linux 4.4.0-112-generic, Tomcat 8.5.27) it doesn't seem to...
Tim DJ
1

votes
0

answer
384

Views

UserRepresentation can not be extracted from Keycloak UserRepresentation (HTTP 404 Not Found Exception)

I am very new to Keycloak usage. Based on the documentation I started playing around with Keycloak API. I am getting Http 404 not found exception when i use the API userResource.toRepresentation() to get the details about the specific user. import org.keycloak.admin.client.Keycloak; import org.keycl...
Zaks M
1

votes
0

answer
39

Views

Java HttpServletRequest.getRequestURL() don't deliver the calling url

I have a problem to get the calling URL, For example, I call 'www.xyz.de/abc', the urlrewite.xml change it to 'www.xyz.de/test.jsp' to call the correct JSP. In the bean, I want to get the calling URL 'www.xyz.de/abc' Here's my code: HttpServletRequest httpServletRequest = (HttpServletRequest) Faces...
user9419705
1

votes
0

answer
48

Views

Cant send data from servlets to jsp

Im doing tutorial but it seem to be old or something or im blind. Anyway i cant send java object to be displayed in JSP. Im using request attribute. Maybe i do something wrong?? my servlet package devcastzone.javaee.serwlety; import java.io.IOException; import java.io.OutputStream; import javax.serv...
Kamczi
1

votes
0

answer
278

Views

How to configure embedded tomcat to find @WebServlet in jar

I have a simple hello world application with embedded tomcat v.8.5.28 It works fine when I explicitly add servlet and mapping: public static void main(String[] args) throws Exception { Tomcat server = new Tomcat(); server.setPort(8080); Context context = server.addContext('', Paths.get('.').toAbsolu...
Kirill
1

votes
0

answer
59

Views

Data is not being stored in the database using Java Servlets, Postgres and JS

Register Java Servlet import java.io.IOException; import java.io.PrintWriter; import java.util.stream.Collectors; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servl...
dkandpala
1

votes
0

answer
41

Views

servlet getting null values when i retrieve values from jsp form

this is my jsp page.where im displaying a form and sending the values to another servlet page to insert the data into mysql database.im using post method to send all values.servlet name is updateVehicle2 Modify Vehicle Modify Vehicle Enter Vehicle name: Enter Vehicle model: Enter Vehicle ID: Select...
user7282779
1

votes
2

answer
30

Views

How can I return the name and value of a drop down in Java Web?

I have an HTML page named Order that includes a drop-down: Napoletana Margherita Sardiniana Pollo Dolce Funghi Patate Con Aglio Romana Gamberetti Capri La Mexicana Pomodori Secchi Proscuitto Con Pomodori Siciliana Palermo Pesto I want to get the name and value of the option so I can pass it to a Ser...
Roman Roshchuk
1

votes
0

answer
18

Views

inactiveInterval invalidation in servlet

In my java EE project i'm trying to make it so, that if a user is inactive for more than 60 minutes the session will invalidate. but i'm not sure in which servlet/jsp to put my session.setMaxInactiveInterval(3600); if(session.getMaxInactiveInterval() > 3600){ session.invalidate(); request.getRequest...
MasterTolboll

View additional questions