All Questions

575
votes
12answers
427249 views

How to upload files to server using JSP/Servlet?

How can I upload files to server using JSP/Servlet? I tried this: <form action="upload" method="post"> <input type="text" name="description" /> <input type="file" name="file" /...
44
votes
1answers
50536 views

Servlet returns "HTTP Status 404 The requested resource (/servlet) is not available"

I have an HTML form in a JSP file in my WebContent/jsps folder. I have a servlet class servlet.java in my default package in src folder. In my web.xml it is mapped as /servlet. I have tried several U...
273
votes
7answers
249310 views

How to use Servlets and Ajax?

I'm very new to web apps and Servlets and I have the following question: Whenever I print something inside the servlet and call it by the webbrowser, it returns a new page containing that text. Is th...
927
votes
6answers
236619 views

How do servlets work? Instantiation, sessions, shared variables and multithreading

Suppose, I have a webserver which holds numerous servlets. For information passing among those servlets I am setting session and instance variables. Now, if 2 or more users send request to this serve...
47
votes
3answers
15365 views

Why does Spring MVC respond with a 404 and report "No mapping found for HTTP request with URI [...] in DispatcherServlet"?

I'm writing a Spring MVC application, deployed on Tomcat. See the following minimal, complete, and verifiable example: public class Application extends AbstractAnnotationConfigDispatcherServletInitia...
268
votes
13answers
530731 views

How do I import the javax.servlet API in my Eclipse project?

I want to develop with Servlets in Eclipse, but it says that the package javax.servlet cannot be resolved. How can I add javax.servlet package to my Eclipse project?
99
votes
2answers
98203 views

Recommended way to save uploaded files in a servlet application

I read here that one should not save the file in the server anyway as it is not portable, transactional and requires external parameters. However, given that I need a tmp solution for tomcat (7) and t...
38
votes
5answers
47668 views

Show JDBC ResultSet in HTML in JSP page using MVC and DAO pattern

I'm implementing MVC using JSP and JDBC. I have imported a database class file to my JSP file and I would like to show the data of a DB table. I don't know how I should return the ResultSet from the J...
176
votes
5answers
200273 views

Where to place and how to read configuration resource files in servlet based application?

In my web application I have to send email to set of predefined users like finance@xyz.com, so I wish to add that to a .properties file and access it when required. Is this a correct procedure, if so ...
22
votes
4answers
65978 views

How to retrieve and display images from a database in a JSP page?

How can I retrieve and display images from a database in a JSP page?

Previous Next