servlets

File not found when browsing

I have one problem that is to upload file. It is working perfectly on my computer but fails when deploying to a server. The system is to browse the file, then the system will zip it before uploading it to the server. When a client browse a file, the server will generate an error that the file is not found. Here is my code: try { ...

Running multiple versions of a servlet web application parallel

I want to run multiple versions (like myapp2.1, myapp2.2 ...) of several Java Servlet based web applications parallel. One possibility could be to deploy each version to a separate servlet context (which should have its own class loader?!). But I think it will be hard to manage and won't be flexible, since an application is a quite larg...

State of the art Java web framework for RESTful GUI apps?

Yes, I know, the old question of the best web framework ... but let me explain. I'm looking for Java Servlet based web framework that allowes RESTful interaktion and is also suitable to build web GUIs. What I want: REST support with http content negotiation and nice URL mapping data conversion from request params to domain object (an...

How to create Session in Java?

Hi, I am creating a CAPTCHA input using SimpleCaptcha, and did validation of the Captcha input. I am created a captcha input with the following codes. HTML Code: <form action="submit_proceed.do" method="post"> <img src="captchaImg" /><input type="text" name="captcha" value=""><br /> <input type="submit" value="Submit" name="submit" />...

issue in property file

I want to load the property file when tomcat is starting.so I'm using servletContextListener to do that and i can get values of property file to my web application. But i want to keep the same value after changing the property file once log into web application.But when i change the value of property file and log into system again it cha...

can sessions be periodically recycled depending on server load?

With servlets/jsp, can sessions be recycled by the web container (say tomcat), depending on how much traffic a site is getting? Update By recycled I mean, the tomcat container will wipe it out since it is running out of memory or busy trying to server requests for another website on the same server This happens with IIS and .net ...

Grant public access to one GAE servlet but use authentication for all other resources?

Hello, for an online bug report web application, I need to find a way how any user can submit a bug report (using HTTP POST) to a Servlet in a Google App Engine application, while all other Servlets (the application admin interface) are protected so that they grant access only to users which have logged in with their Google account. The...

Java Front Controller

Hi, I'm thinking of implementing Front Controller in my J2EE application. Could you please suggest the same with few links (with source code examples) & any standards to follow? Best regards ...

How do servlets work?

I write couples of servlet program, however I dont think I fully understand how servlet run. So here is couples question that I have: All the code I wrote about Servlet only run on Netbeans with apache tomcat run behind. When I run my html file that make request to the servlet, it usually give error saying that it could not find the s...

How to generate unique string using jsp?

I need to verify the email. I want to do it by generating a unique string and making a link of it for users to click on it in the mail. I dont know how to generate it using Java. There are md5, sha1 etc functions in php to generate the string using any unique value like email. Is there same function provided in jsp? Advice please. ...

How to begin with Java Server Side technologies?

I have good knowledge of PHP. But I also want to learn technologies like JSP. I have installed Apache Tomcat 6.0 and Eclipse JEE. I was looking for JSP tutorials on Google and found that there are several things like JSP, Servlets, Struts, EJB, JSF, etc. I have heard a lot about Struts and JSF that they are very good. I want to know ...

how can i do sessions in java if some one disables cookies in my browser?

Hi, I like to know if someone disables the cookies in my browser then cookies dont work for my browser then how can I do sessions in java. I am writing servlets for server side programming. Then how does my sessions work? How does it recognize the user? As JSESSION ID is stored in cookies... ...

How can I do sessions URL is very long I cannot append JSESSIONID=389729387392.What is the solution for this?

Hi I got the answer for If I disabled the cookies then using URL ReDirect I can pass the JSESSIONID but my URL is already very long as I use the GET method it has constraint. Then how should I use my sessions.I want my application to be very security intensive. This is one of the question asked to my friend in GOOGLE interview. ...

What are some strategies to manage number of sessions and eliminate unneeded sessions in java?

What are some strategies to manage number of sessions and eliminate unneeded sessions? Or How do I get to know that sessions are no longer needed? ...

Java Servlets: File download breaks when user navigates away from page

I have a servlet that allows users to download (potentially large) zip files from a web page. If the user clicks on a link to download a zip file, code similar to the following is executed in the servlet: response.setContentType("application/zip"); response.setHeader("Content-disposition", "attachment; filename=foo.zip"); response.setH...

Intercepting all request of one WEBAPP using JEE

I have a WEB Application deployed in Tomcat. I would like to intercept all the incoming requests - get or post and perform some task. I want to intercept calls from servlet, from JSP pages etc. So I created one web.xml file which looks like this one - <servlet> <description></description> <display-name>Transformer</display-nam...

Diagnosing 404 error issue with servlet (Eclipse and Glassfish 3)

I am in the process of writing a Java web app and am having issues getting my servlet to work properly. This is from my web.xml file: <servlet> <description>Called to process any forms on the website</description> <display-name>Form Processing Servlet</display-name> <servlet-name>FormAction</servlet-name> <servlet-cla...

Why cant the container just use the IP address of the client? It is part of the request only .

Hi I like to know why can not the container just use IP address of the client to recongize the client. As IP address is unique. Still does it need to create JSESSIONID? ...

How to Change init-parameters at Runtime?

If I modify the XML to change the value of init parameter I see the changes only when web-app is redeployed. My question is cant I get around this by setting the values at run time.Is there any API that allow me to change the values dynamically. ...

DD elements, <context-param> and <init-param> both use the getInitParameter() method.

DD elements <context-param> and <init-param> both can be retrieved by the getInitParameter() method, in the servlet code. Now the question is, how does it differentiate <context-param> and <init-param>? ...