495
votes
23answers
63k 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 ...
197
votes
7answers
80k 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)?
134
votes
4answers
108k 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" ...
99
votes
18answers
59k 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, ...
99
votes
4answers
57k views

.war vs .ear file

What is the difference between a .war and .ear file?
90
votes
9answers
29k 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 ...
89
votes
10answers
72k 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> ...
76
votes
8answers
100k 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 = ...
70
votes
12answers
57k 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). ...
69
votes
6answers
73k 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 ...
62
votes
16answers
28k 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
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 ...
57
votes
12answers
99k 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> ...
56
votes
6answers
53k 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 ...
53
votes
3answers
37k views

Why does JPA have a @Transient annotation?

Java has the transientkeyword. Why does JPA have @Transient instead of simply using the already existing java keyword?

15 30 50 per page