servlets

Hibernate and Servlets

Hi all I'm developing a web-app and I want to retrieve data from the database and send them to the homepage.I thought to set the servlet as my welcome page,retrieve my data from the database,redirect to the homepage and pass my data as parameters.Any better ideas? ...

Problems with deploying GWT with RPC to tomcat (web.xml problem probably)

Hello! My gwt app that uses mysql database runs normaly in eclipse when debugging. When i run it on tomcat, it displays correctly but when i click on a button that makes a RPC (executes servlet and contacts the database) i get an error. I checked my tomcat log and i see 404 error when clicking on a button: 0:0:0:0:0:0:0:1 - - [22/Jul/2...

servlet communicate with J2me Project?

i am working with Eclipse to develop a application in J2ME.In This application i am using a servlet called HitServlet and a J2me Class HitMIDlet. I want to run this project using Eclipse.But i do not what is the directory structure and how i make directory structure. I am alredy configure J2ME plugin and Tomcat in my eclipse. But i do n...

J2me with Eclipse?

I have two classes one is J2me class HitMIDlet and a servlet HitServlet i want to send request to servlet using J2me class.How i will mange these these two classes using Eclipse .? ...

Java Filters Performance Question

I have two questions. The first is do Filters add a lot of overhead to request. We have a filter and it is set to run on the URL pattern /*. This means it also runs on all the image request. I think that this is not good for performance, but my co-workers think that it doesn't matter if the filter runs 5 or 6 times per request becaus...

Logging Tomcat6 on Ubuntu

Im using ubuntu and tomcat6 for my server. When im calling a servlet or a jsp page, the "logger" (System.out.println()) logs into the syslog of the server /var/log/syslog. How can i change this, that the server will write in a own log file like the catalina.out? The problem is that there are no line breaks in my syslog (i used \n in th...

How to retrieve the name of checkbox in servlet if I provide dynamic names?

When I provide a dynamic name of checkbox inside a for loop like <input type="checkbox" name="<%=i%>" /> How can I retrieve the value in servlet? ...

I cannot deploy a basic html file in apache tomcat...

I am making a small website as my first project. I have finalized to use Java Servlets and JSP for my Server-side scripting. I am learning it from O'Reilly's HeadFirst Servlets and JSP. I decided to use Apache-Tomcat as my web server and container. I downloaded it. I even have jdk 1.6 update 21. I unzipped apache in C: It is running suc...

What is the right java unit test library for http?

Hello all, I am developing a servlet application, I was using JWebUnit, to check all the basic responses, but now I have to start using other HTTP methods different to GET(POST,PUT and DELETE). So, I found HttpUnit, it looks that have support for what I need, POST and PUT methods are available there and I guess I can walk around the DE...

Spring: how do I inject an HttpServletRequest into a request-scoped bean ?

I'm trying to set up a request-scoped bean in Spring. I've successfully set it up so the bean is created once per request. Now, it needs to access the HttpServletRequest object. Since the bean is created once per request, I figure the container can easily inject the request object in my bean. How can I do that ? ...

how do i deploy mobicents to glassfish v3

is anyone using Mobicents with Glassfish in place of JBoss? how do i deploy mobicents to glassfish v3? ...

How to set date field in HTML form and how can i retrieve the date in servlets?

Hi, I need to set a date field in my html form. After submitting the form the request goes to the servlet and tha data will be stored in database. In servlets how can i retrieve the date field? Please help me. -renu ...

javascript dialogbox without opening page

I have to display dialog box from servlet but without opening new window. Below is code PrintWriter printWriter =response.getWriter(); String s ="<HTML><HEAD><TITLE>JavaScript Example</TITLE>"+ "<SCRIPT LANGUAGE=JavaScript>"+ "alert('File Uploaded');"+ "</SCRIPT>"+ "</HEAD>"+ "</HTML>"; printWriter.print(s); This code open d...

How to avoid HeadlessException in thread?

I have tried to open a dialog box in Servlet & it opens fine. But then I tried to achieve same thing in my thread's run method. It gaved me following error: java.awt.HeadlessException at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159) at java.awt.Window.<init>(Window.java:431) at java.awt.Frame.<init>(Frame.java...

Java - Finding whether Cookies Disabled or not

HI, Is there any way I can find whether the cookies are disabled or not on the client browser. I have seen some posts saying to find using redirect URL, but there is no code how to do that . Can anyone please help me with a sample code to check this. Please note that I want this to be done using Java only (no javascript please) Than...

Convenient way to parse incoming multipart/form-data parameters in a Servlet

Is there any convenient way to read and parse data from incoming request. E.g client initiate post request URLConnection connection = new URL(url).openConnection(); connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); PrintWriter writer = null; try { OutputStream ...

Java Servlets command line processing

I have a command line and i want to convert this into a servlet request in a bash script.How can i do this? For example: >>Command arguments the http servlet request shud be : http://localhost:8080/webshell?op="command"&amp;args="arguments" ...

Genarate HTML from JSP

The basic servlet jsp setup I'm familiar with .... RequestDispatcher dispatcher = request.getRequestDispatcher(resourceA.jsp); dispatcher.forward(request, response); The problem is, in addition to sending the reply back to the browser (resourceA.jsp), I need to create a second HTML output from resourceB.jsp, witch in turn will be ema...

Java:how to pass value from class/bean to servlet

hi, i am new to java, i'm having problem passing value from a class/bean (which are stored in arraylist) to servlet. any idea how can i achieve that? below is my code. package myarraylist; public class fypjdbClass { String timezone; String location; public String getTimezone() { return timezone; } public void setTimezone(String t...

Handling the browser 'Back' button in jsp.

Hi all, I have a jsp search page (Search.jsp) and a result page (Result.jsp), both of them can choose search criteria. and then passed the parameters to a java controller file (Controller.java) to build a query string and performs query searching. The query string and searched results will be passed to Result.jsp for displaying. Curren...