servlets

Servlets: forwarding to a resource in a different webapp

I'm trying to construct a java web app along modular principles, with some common resources (JSPs, mainly) in one WAR, and some custom resources in another. This means JSPs scattered across different WARs. Now JavaEE frowns upon this sort of shenanigans, and wants you to put everything in one place. My current workaround to this is to h...

How to parse multipart/mixed content from JSP to servlets

Hi, I'm sending multipart/mixed content message from JSP to servlets but when I used ServletFileUpload.isMultipartContent(request); method to check if the request is Multipart or not, I'm getting the output as "false". This is how content type header of my message is looking like: multipart/mixed; boundary="----=_Part_26_2...

Table changes depending on dropdown list values with servlet

What I want to realize is the following: In a JSP x I have a 3 dropdownlists and a button called edit when user click this button a table dynamically should be displayed. Now this table is modified correponding the values in those 3 dropdownlists. So it can be 3 cols or 4 cols or even 6 cols, it depends on the selected values. So what I...

Error Controller with java servlets

How to make a ErrorController, like the ErrorController in the Zend Framework for PHP, with servlets in java? Now I have this <servlet> <display-name>ErrorController</display-name> <servlet-name>ErrorController</servlet-name> <servlet-class>project.controller.ErrorController</servlet-class> </servlet> <...

Java EE 6: JSF vs Servlet + JSP. Should I bother learning JSF?

I am trying to get familiar with Java EE 6 by reading http://java.sun.com/javaee/6/docs/tutorial/doc/gexaf.html. I am a bit confused about the use of JSF. Usually, the way I develop my Web App would be, Servlet would act like a controller and JSP would act like a View in an MVC model. So Does JSF try to replace this structure? Below are ...

How long do you keep session cookies around for?

Hi, I'm implementing a web app, which uses sessions. I'm using GWT and app engine as my client/server, but I don't think they're doing anything really different than I would do with PHP and apache etc. When a user logs into my web app, I am using HttpSession to start a session for them. I get the session id like this: // From my login...

How to enable attachment using Apache File upload

I am using Apache commons File upload API to Store the file from JSP to servlets in temp directory, but I don't know what should I do next to send the email as an attachment using javamail API. How can I retrieve those files which is written in temp directory using Apache Fileupload API to send them as attachment to mail Server. How wi...

Why servlet halt a moment in concurrent request.

I use Axis for webservice service. when more than 8 concurrent , there are some request halt randomly for about 30 seconds. I debug by log in every line and found from my code: public class foo{ void bar(){ a(); log.debug('exit from a'); } void a(){ log.debug('exit a'); } th...

Is this a legitimate implementation of a 'remember me' function for my web app?

Hi, I'm trying to add a "remember me" feature to my web app to let a user stay logged in between browser restarts. I think I got the bulk of it. I'm using google app engine for the backend which lets me use java servlets. Here is some pseudo-code to demo: public class MyServlet { public void handleRequest() { if (getThreadL...

how to get the result query one by one in jsp and mysql

I am trying to implement as Online Mock exam in JSP, but I have a problem to get the questions one by one, it get connceted for the first time, and show me the first question and answers, but when I click on "next" again, it still show me the first question, I think by clicking on "next" it start querying again. please help me. this is ...

Java Servlets - How do I detect if a user is from a mobile device?

Java Servlets - How do I detect if a user is from a mobile device? I'm using the TinyMCE javascript editor, and it doesn't work on the iphone. How can I detect if the user is coming from a mobile device? ...

How to Load external Div that has a dynamic content using ajax and jsp/servlets ?

I need to use ajax feature to load an external div element (an external jsp file) into the current page. That JSP page contains a dynamic content - e.g. content that is based on values received from the current session. I solved this problem somehow, but I'm in doubt because I think that my solution is bad , or maybe there is bette...

How to make a reference to a normal java class from GWT server side

I am building my project using GWT plugin for Eclipse Galileo. When I was done with RPC between the server and client, I tried to make a reference in the GWT project to a normal Java class in non-GWT project, but everytime when I create an object of this class I get a ClassNotFoundException. I did the buildpath for the GWT project, but i...

ByteArrayOutputStream to PrintWriter (Java Servlet)

Writing generated PDF (ByteArrayOutputStream) in a Servlet to PrintWriter. I am desperately looking for a way to write a generated PDF file to the response PrintWriter. Since a Filter up the hierarchy chain has already called response.getWriter() I can't get response.getOutputStream(). I do have a ByteArrayOutputStream where I generat...

file read and return a byte array

dear all, i want to read a mp3 file using java and want to download it in jsp,i want to return byte array or i can only return one byte at a time?.please suggest ...

Google App Engine how to get an object from the servlet ?

I have the following class objects in Google App Engine's dadastore, I can see them from the "Datastore Viewer " : import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey;...

Recommend JSP Quiz Tutorials

Hi Everyone, I need to make a quiz that uses JSP and servlets but I can't find any tutorials online which can help me create my own one. If there are any can someone recommend me some, I have tried Google and nothing reasonable has come up. Thanks. ...

How to catch non exist requested URL in Java servlet ?

My objects are stored online in two different places : <1> On my nmjava.com site, where I can put them in a directory called "Dir_My_App/Dir_ABC/" <2> On Google App Engine datastore When my Java app runs it checks both places for the objects, I designed the app so that it tries to get an object from a Url, it doesn't care whether it's...

How to use a filter in Java to change an incoming servlet request url ?

How to use a filter to change an incoming request url : From : "http://nm-java.appspot.com/Check_License/Dir_My_App/Dir_ABC/My_Obj_123" To : "http://nm-java.appspot.com/Check_License?Contact_Id=My_Obj_123" ? Frank Edit : According to BalusC's steps below, I came up with the following lines : import java.io.IOException; import jav...

How to implement custom JSF component for drawing chart?

I want to create a component which can be used like: <mc:chart data="#{bean.data}" width="200" height="300" /> where #{bean.data} returns a collection of some objects or chart model object or something else what can be represented as a chart (to put it simple, let's assume it returns a collection of integers). I want this component t...