servlets

How do I get Scala to run as a servlet under Tomcat?

I'm trying to build a basic servlet with scala, but I can't seem to figure out how to get it running under tomcat. I think my scala class is okay, and I included all the libs in scala-2.6.x-final-blah.tgz to my tomcat lib directory, but I still get the odd, generic error below. Can anyone tell me what's going on? javax.servlet.ServletE...

Controller's life-cycle in Spring MVC

What is the lifecycle of a Controller in Spring MVC? When is the controller created, when destroyed? Is it shared among multiple threads? Can it be in use simultaneously by more than one request. ...

apache james, jsp servlet

I am trying to make a mail application through apache james, but I could not really get all the things, please give suggestions how to use it. MOreover, I could not figure it how to use jsp and servlet for james. Please help. ...

Scala and Tomcat -> NoClassDefFound Stringbuilder?

Hi, when I run my scala application under tomcat, I am unable to do basic string concatenation, and I get an error stating that no class definition was found for StringBuilder. I'm running under windows 7 (development) and ubuntu (production), and I don't believe that java 1.4.x JDK or JRE has ever been insalled on either system. Any id...

Transmit value between servlets

Hi, I've written a html form to retrieve password and user name from users: <form action="prueba-registro" method=get enctype=multipart/form-data> <h3> User information </h3> User name: <INPUT TYPE=TEXT NAME="realname"><BR> Password: <INPUT TYPE=PASSWORD NAME="mypassword"> <P><INPUT TYPE=SUBMIT VALUE="Register"> </form> This informati...

How to approach shifting a Java Swing app to a Servlet ?

I want to use the Model-View-Controller template while writing my Web App. The problem is, the Model part of the code has already been written in Swing. The Model code also must require the container to call its main method before any interaction with its servlets. So is there a way for me to specify the location of the main method in th...

TomCat 6: can welcome page be inside WEB-INF?

I'm following this example to get Spring up & running: http://static.springsource.org/docs/Spring-MVC-step-by-step/part2.html What they do is move all .jsp files inside the WEB-INF, to stop users accessing them directly... so far so good. However the servlet has a welcome page of index.jsp, and when this is moved inside the WEB-INF dir ...

Multipart Form Submit Directly to an URL

Hi, We've a web-based application wherein there is an option for Users to upload documents / files into our database. Before uploading any document / file, we want to send the file for free online virus scanning offered by few websites like http://virusscan.jotti.org/en, get the scan status from them. Only if the response status is O...

How can I manually load a Java session using a JSESSIONID?

I have a servlet which handles a multipart form post. The post is actually being made by a Flash file upload component embedded in the page. In some browsers, the Flash-generated POST doesn't include the JSESSIONID which is making it impossible for me to load certain information from the session during the post. The flash upload compon...

Why use an MVC framework when Servlets, JSPs and a lightweight DAO layer will work?

I'm finding it difficult to embrace a Java MVC framework, when it looks as if Servlets, JSPs and a lightweight DAO will do just about everything you need it to do in order to decouple the controllers/views/models. For PHP I can see the necessity since there are no built in constructs like servlets, but do Java MVC frameworks really give ...

Reliable data serving

How can i make sure my file serving is reliable and scalable? How many parallel request it can handle? I am thinking beyond the hardware capability and band width. i am following http://stackoverflow.com/questions/55709/streaming-large-files-in-a-java-servlet ...

how to display incorrect pwd on the same login page

After checking the database the incorrect password should be displayed on the same login page. I have used servlet and forwarded that to the login page but i couldn't add the message "incorrect password". RequestDispatcher rd = getServletContext().getRequestDispatcher("/register.jsp"); if(dbpwd.equals(null)) { pw.println("Not a ...

Weird java.io.IOException: Server returned HTTP response code: 503 for URL

I am writing a servlet jsp under Glassfish to download a file from a website, do some processing and display the result in webpage. When I deploy the servlet, it gave me: java.io.IOException: Server returned HTTP response code: 503 for URL: www.websitename.com error. I check the status code 503 out and it turns out to be a server ove...

What is a lightweight, fast, java servlet container?

I have been writing a pure java web server specifically customized for a website I'm making. I've grown tired of reinventing the wheel though, and am now investigating moving over to java servlets. Basically I just want to run server side java code while leveraging the servlet technology to avoid writing http protocol specific code. I...

Why use the ServletContext object in a web-app containing servlets and "worker" threads in Java

Hi, I currently have a web-app where I have Servlets reading and writing to the ServletContext attributes and I have "working" Threads (Daemon threads) which get initialized on startup and currently hold as a member the ServletContext object. For a couple of reasons I'm thinking of moving to "implement Runnable" instead and I'm kind of s...

Error while running Servlet?

I have the servlet name ExampleServlet.java which have only init method with HttpServletRequest and HttpServletResponse parameters. I will forward the request to another servlet named ForwardedServlet.java which will display some text on the web page. But when i am trying to execute the ExampleServlet http://localhost:8080/Sample/Example...

Java servlet and authentication

Hi all, I have a small application with 3-4 servlets and a basic module that provide me authentication like: public class Authentication { public boolean isUserAuthenticated(){ .... } } Is there a way to check the authentication using my class BEFORE every other servlet calls, without have to add code in each of them? I'...

Servlet concurrency/synchronization in Tomcat?

Is there a recommended way to synchronize Tomcat Servlet instances that happen to be competing for the same resource (like a file, or a database like MongoDB that isn't ACID)? I'm familiar with thread synchronization to ensure two Java threads don't access the same Java object concurrently, but not with objects that have an existence ou...

How to use some configuration file for JEE servlet?

I need to access some files on servers from servlet. They have different paths on my development machine and on the deployment server. I would like to put some config file (with paths) somewhere (like shared dir in capistrano deployment) so application could read it. Or maybe set some property on the application server or anything like t...

Servlets-JSP: How to put a delete-modify button for every row of HTML table!

I'm trying to add to every row of a HTML table a "delete" and a "modify" button. If I use this method, the value of the "id" is alawys the value of id from the first row, even if I pressed the button from the rows 2-n. <% if (listx.size() > 0) { int j = 0; for (int i = 0; i < listx.size(); i++) { ...