533
votes
23answers
68k views

How to avoid Java Code in JSP-Files?

I'm new to Java EE and I know that something like the following three lines <%= x+1 %> <%= request.getParameter("name") %> <%! counter++; %> is an oldschool way of coding and in ...
215
votes
7answers
87k 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)?
143
votes
5answers
115k 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" ...
108
votes
4answers
61k views

.war vs .ear file

What is the difference between a .war and .ear file?
102
votes
18answers
61k views

Choosing a Java Web Framework now? [closed]

we are in the planning stage of migrating a large website which is built on a custom developed mvc framework to a java based web framework which provides built-in support for ajax, rich media content, ...
98
votes
10answers
77k 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> ...
91
votes
9answers
31k views

Would you, at present date, use JBoss or Glassfish (or another) as Java EE server for a new project? [closed]

If you started a new Java EE project today which is to be finished in about a year, which application server would you choose and why? Part of your answer should include your arguments for your ...
90
votes
8answers
114k views

Getting the Current Working Directory in Java

I want to access my current working directory using String current = new java.io.File( "." ).getCanonicalPath(); System.out.println("Current dir:"+current); String currentDir = ...
73
votes
6answers
78k views

Spring - How to call a method after bean initialization is complete?

I have a use case where I need to call a (non-static) method in the bean only-once at the ApplicationContext load up. Is it ok, if I use MethodInvokingFactoryBean for this? Or we have a some better ...
70
votes
12answers
59k 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
16answers
29k views

Java EE 6 vs. Spring 3 stack [closed]

I'm starting a new project now. I have to choose technologies. I need something light, so no EJB or Seam. On the other hand I need JPA (Hibernate or alternative) and JSF with IceFaces. Do you think ...
62
votes
12answers
104k 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> ...
61
votes
3answers
44k views

What's the difference between JPA and Hibernate?

I understand that JPA 2 is a specification and Hibernate is a tool for ORM. Also, I understand that Hibernate has more features than JPA 2. But from a practical point of view, what really is the ...
59
votes
9answers
5k views

Benefit of Polymorphism [closed]

When I started to look for the benefits of polymorphism, I found with this question here. But here I was unable to find my answer. Let me tell what I want to find. Here I have some classes: class ...
58
votes
6answers
56k views

Java - How to change context root of a dynamic web project in eclipse

I have developed a dynamic web project in eclipse. Now I can access it through my browser using the following url: http://localhost:8080/MyDynamicWebApp Now I want to change the access url to ...

15 30 50 per page