53
votes
2answers
42k 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 ...
105
votes
4answers
18k 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 ...
30
votes
5answers
13k 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 ...
25
votes
7answers
34k 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?
79
votes
3answers
13k 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, ...
95
votes
5answers
33k 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)?
66
votes
9answers
11k 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 ...
9
votes
3answers
4k views

Browser can't access/find relative resources like CSS, images and links when calling a Servlet which forwards to a JSP

I'm having trouble with loading CSS and images and creating links to other pages when I have a servlet forward to a JSP. Specifically, when I set my <welcome-file> to index.jsp, the CSS is being ...
18
votes
4answers
22k views

Populating child dropdownlists in JSP/Servlet

Suppose I am having three dropdownlist controls named dd1, dd2 and dd3. The value of each dropdownlist comes from database. dd3's value depends upon value of dd2 and dd2's value depends on value of ...
9
votes
7answers
7k views

XSS prevention in Java

How can I prevent XSS attacks in Java? Are there any good libraries for that?
6
votes
2answers
5k 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?
58
votes
12answers
41k 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). ...
7
votes
13answers
21k views

How to access static resources when using default servlet

Hi i have a problem i want to send all my request to one spring servlet <servlet> <servlet-name>home</servlet-name> ...
24
votes
2answers
34k 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: ...
6
votes
3answers
39k views

java.lang.IllegalStateException: Cannot forward after response has been committed

int noOfRows = Integer.parseInt(request.getParameter("noOfRows")); String chkboxVal = ""; // String FormatId=null; Vector vRow = new Vector(); Vector vRow1 = new Vector(); ...

1 2 3 4 5 52
15 30 50 per page