servlets

How to design servlets to send request to servers to obtain pages and to parse it to retrieve images

Using servlets I need to send request to predefined urls and the pages obtained must be parsed to determine the image tag and the keywords associated with the image and thus receive the links of the image or obtain the images. ...

JSP/Servlets trigger a SQL update

Hello, I have a small window holding an IRC client that opens up when the user logs into a jsp page. I'm trying to figure out a way for an SQL update statement to be called once the pop up window has been closed. Anyone have any ideas on how I could go about doing this? Thanks ~ Kyle G ...

Recommendations for migrating a legacy web app to a modern framework.

Hello all, I am currently doing some work for a company that runs a legacy web app built on Java Servlets (the system pre-dates JSP's, although they now use them when building new pages). The code base is a big jumbled mess as its around 10 years of building on top of an out of date framework. They have very little consistency in the co...

Easy way to get started with JSF?

Does anyone know of a good way to get started with JSF for a servlets/JSP person? I'm interested but not sure where to start! Thanks, ...

Singleton servlet?

If I declare a singleton servlet like public static class SomeServlet extends HttpServlet {..... It gives the error indicating that modifier static not allowed here in NetBeans. Please let me know how to create a singleton servlet which allows only one client at a time to execute. Thanks in Advance, Mahes ...

Deployment of Web Application to a Running Tomcat

Hello, I would like to collect some best-practices on deployment of a web-application to a running Tomcat. Not long ago I had to describe the deployment process of our web-application and the process appeared rather confusing. Say, we have an application in a WAR file (foo.war) correctly configured and not requiring additional configura...

is there a way to share a single variable by all servlet classes in java

hi, i need to know whether there is a way to change the value of a single variable by two servlet classes. in one servlet i need to make a variable =true and in another servlet i need to make the variable =false ...

Generating a Faces Context manually

I have two systems I'm trying to integrate. One is built on raw servlets, the new one is build on JSF with IceFaces. I'm trying to facilitate cross-system sign on. The idea is that I have a button in the old system that POSTs the appropriate information to the new site and logs them on. Well, ideally, I'd like to use just a regular old...

java servlet

When I try to use javax.servlet.http.*; an error package does not exist is thrown. Should I want to reinstall java or it occurs due to some other problem. I'm using j2sdk 1.4.0 & Tomcat 6.0. Thanks & Regards ...

How to execute a function immediately after authentication

My question is this: With a web application, after performing a login authentication for a protected resource, how can I run some sort of function (in this case, I want to run a function to initialize some user-dependent session-scope variables) BEFORE the web-app redirects to the protected resource. I am programming a web application ...

Flow of struts

Can anyone tell me the control flow of struts. Which program will be called first? ...

Is it safe to inject an EJB into a servlet as an instance variable?

We all know that in the web tier there is the possibility that only a single instance of a given Servlet exists which services multiple requests. This can lead to threading issues in instance variables. My question is, is it safe to inject an EJB using the @EJB annotation into a servlet as an instance variable? My initial instinct woul...

How to properly handle error logs?

I tried to do several searches before posting this question. If this is a duplicate, please let me know and I will delete it. My question revolves around the proper way to handle errors produced through our web application. We currently log everything through log4j. If an error happens, it just says "An error has occurred. The IT Depart...

How to indicate web app startup servlet?

Possible Duplicate: How to set a Servlet to run as the Homepage in Java? I'm writing a web app for Oracle App Server using Java. In web.xml, I specify the startup page with welcome-file-list welcome-file index.jsp /welcome-file /welcome-file-list (all that is in xml) so that if the user browses to my site like this,...

Running Java on a Web Server

I have written a standalone Java application that I've packaged into a jar file that takes in some command line arguments, does some hardcore computations, and then writes out the result to a file along with some output to the default output stream pointing to where the file with the results are. I now want to create a website around th...

Problem with JSP servlet and Ajax

I have a JSP with a Javascript tree control and I want the user to be able to hide or show this tree at the touch of a button and for this change of state to be carried through to other pages visited, i.e. if on page A, the user hides the tree, then on page B, the tree should remain hidden and so on until the user decides to show the tre...

sendRedirect or request Dispatch is more efficient?

SendRedirect or requestdispatch ?Which should be more preferred?Which is more efficient? ...

Spring Controller destroy method?

Does Spring's Controller have any sort of destroy/cleanup method? I couldn't find anything in the JavaDocs for Controller and AbstractController. I'm looking for the equivalent of javax.servlet.Servlet's destroy() method. The reason for this is that I'm starting a thread in my Spring controller. I want the thread to terminate whenever t...

Does Acegi/Spring security support getUserPrincipal()?

I need to interface an existing application with Acegi/Spring security. In order to get started I am looking for one simple piece of information: in this context, will HttpServletRequest.getUserPrincipal() called from my application properly return the username obtained through Spring (as opposed to using Spring-specific objects)? I hav...

How to create a URL in a servlet?

Hi, i want to know how to generate a url in a servlet. I have a login servlet, and every time that add a user i want to gen. a url for each user profile. Can anyone help me please? ...