Tagged Questions
202
votes
5answers
41k views
How do servlets work? Instantiation, session variables and multithreading
Suppose, I have a webserver which holds numerous servlets. For information passing among those servlets I am getting the servlet context and setting session variables. Now, if 2 or more users send ...
171
votes
6answers
68k views
What is the difference between JSF, Servlet and JSP?
Is JSP = Servlet? And JSF = Pre-build UI based JSP (like asp.net web control)?
125
votes
4answers
24k views
Design Patterns web based applications
I am designing a simple web based application. I am new to this web based domain.I needed your advice regarding the design patterns like how responsibility should be distributed among Servlets, ...
124
votes
3answers
93k views
How to upload files to server using JSP/Servlet?
How can I parse an uploaded file using Apache Common FileUpload? I tried this:
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List ...
94
votes
9answers
17k views
Java web development, what skills do I need? [closed]
I want to learn, at least at a basic level, how to build Java web applications (coming from a .NET background).
Meaning, I would like to be able to build, deploy a simple CMS type application from ...
81
votes
10answers
63k views
Maven dependency for Servlet 3.0 API?
How can I tell Maven 2 to load the Servlet 3.0 API?
I tried:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
...
67
votes
12answers
53k views
Servlet for serving static content
I deploy a webapp on two different containers (Tomcat and Jetty), but their default servlets for serving the static content have a different way of handling the URL structure I want to use (details).
...
65
votes
7answers
87k 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?
64
votes
5answers
31k 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 ...
64
votes
3answers
33k views
Tomcat VS Jetty [closed]
I'm wondering about the downsides of each servers in respect to a production environement. Did anyone have big problems with one of the features? Performance, etc. I also quicky took a look at the new ...
51
votes
12answers
90k views
What does the servlet <load-on-startup> value of 0 (zero) signify
I am getting a bit confused here. In our application we are having a few servlets defined. Here is the excerpt from the web.xml for one of the servlets:
<servlet>
...
46
votes
7answers
31k views
HttpServletRequest to complete URL
I have an HttpServletRequest object.
How do I get the complete and exact URL that caused this call to arrive at my servlet?
Or at least as accurately as possible, as there are perhaps things that ...
43
votes
3answers
72k views
How do you develop Java Servlets using Eclipse?
I would like to program Java servlets using Eclipse and I plan on deploying them using Tomcat. I think I can build the projects using Ant which is bundled with Eclipse. I have the standard Eclipse ...
43
votes
5answers
45k views
How do you remove a Cookie in a Java Servlet
How do you remove a cookie in a Java servlet?
I tried this:
http://www.jguru.com/faq/view.jsp?EID=42225
EDIT: The following now works successfully it appears to be the combination of:
...
42
votes
3answers
51k views
JSF - get managed bean by name
I'm trying to write a custom servlet (for AJAX/JSON) in which I would like to reference my @ManagedBeans by name. I'm hoping to map:
http://host/app/myBean/myProperty
to:
...