439
votes
22answers
53k 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 ...
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)?
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 ...
93
votes
18answers
55k 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, ...
92
votes
4answers
49k views
85
votes
9answers
27k 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 ...
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).
...
64
votes
6answers
65k 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 ...
63
votes
9answers
75k 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 = ...
59
votes
16answers
27k 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 ...
58
votes
9answers
4k 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 ...
52
votes
12answers
17k views
Hibernate, iBatis, Java EE or other Java ORM tool
We're in the process of planning a large, enterprise application. We're focusing our efforts on evaluating hibernate after experiencing the pains of J2EE.
It looks like the new Java EE API is ...
52
votes
6answers
46k 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
...
52
votes
2answers
28k views
What is the difference between Eclipse 3.7 and Eclipse 4.1?
I see there are two main distributions of Eclipse going on - One is on 3.6, 3.7, 3.8 path and the other is 4.0, 4.1 path(http://www.eclipse.org/e4/).
I don't have clarity on what is the difference ...