servlets

best way to remove a HttpServletRequest parameter in a controller/class?

I have a case where I need to redirect my HTTP request object to other controllers/classes for further processing. The problem is that in some controller, I would like to get better control on the parameters I'm forwarding to the next class: modify, edit, remove them. So, I would like to know if there is a good practice/pattern to achiev...

REST API with web application(JSP,Servlets)

I have one normal servlet and one jersey specific REST related servlet i.e.ServletContainer configured in web.xml. Case 1 - Url pattern for normal servlet is "/login" Url pattern for other REST servlet is "/" In this case all request will got REST servlet. Request for login also goes to tht Servlet only. Case 2 - If Url pattern for RES...

Getting Tomcat to reload a web app with a static context

I have a Host that doesn't automatically deploy all web apps. <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false"> But I do want the dreambear web app to automatically reload without a restart, for development purposes (hence this is on SO, no...

JSP Forward and calling servlets (Passing on 2 session variables)

Hi guys, I am trying to redirect a 'HTTPrequest' from a JSP page to a servlet (located in a package); passing on variables that are stored in a session object. I had the idea to use: <jsp:forward page"/servletName"> <jsp:param name="var1" value="<%=beanID.getVar1()%>" /> <jsp:param name="var2" value="<%=beanID.getVar2()%>" /> <...

Invoke method just before session expires

My webapp has users who login. There is a timeout. Before the session expires, I would like to execute a method to cleanup some locks. I've implemented a sessionListener but once I reach public void sessionDestroyed(HttpSessionEvent event) the session is already gone and I need some data from it, so I would like to execute a method (whi...

Servlet Filters and Threading?

I am building a webservice on Weblogic 10.3.3 and I am using a servlet filter to log the request to a database. I do not want the filter to slow down the call to the webservice. So I actually have 2 questions. 1) Does the filter, or can I make the filter do the logging on a separate thread? if so how? 2) is there a way I can dynamicall...

I want to get the real path of a file in java by using the request method getRealPath()but it is deprecated now i want an alternate to it

I want to get the real path of a file in java by using the request method getRealPath()but it is deprecated now i want an alternate to it i tried get servletcontext but it is not returning the whole path in jsp page when i m using application.getRealPath("/") it is giving whole path as D:/..... but in java servlet code i m not getting ...

Creating objects from request

I'm working on some user related tasks for a website. For cases when the person is registering or editing a user, they fill out a form and the request is handled in a servlet. At the moment, the servlet is taking all the request parameters and building a User object from them, like this: User toRegister = new User(request.getParameter("...

Singleton vs Single Thread

Normally Servlets are initiated just once and web container simple spawns a new thread for every user request. Let's say if I create my own web container from scratch and instead of Threads, I simply create Servlets as Singleton. Will I be missing anything here? I guess, in this case, the singleton can only service one user request at a ...

Javabeans with jsp:useBean. How do they work? I don't understand.

I have to get 2 numbers and an operation from a jsp file, using a java bean. After submitting the numbers, take them to a servlet from that Java Bean and return an result of them. Problem is that the java bean fields are never completed with the numbers wtitten in textboxes. So, I have, index.jsp's body: <html> <head> <meta http-equ...

Messaging: Lots of RemoteServices methods or Unique message builder/interpreter?

Hey guys, I'm using GWT to code a simple multiplayer board game. And while I was coding the question came up to my mind: At first I though my client could simply communicate with the server via RemoteServices calls, so if a client wanted to connect to a game he could do as follows: joinGame (String playerName, String gameName) And t...

Spring Security 3.0: How do I specify URLs to which a custom filter applies?

I am using Spring Security 3.0 with JSPs. I have created a RequireVerificationFilter that redirects unverified users to a "verify your email" page. I added the filter to the spring security filter stack in last place like so: Bean definition in my app-config.xml: <bean id="requireVerificationFilter" class="com.ebisent.web.RequireVeri...

Java as back-end platform. Good choice?

Hello, My company is about to start building the back-end for one of our new products. The idea is to build a layer that produces resources for every upper layer product (web site, mobile web site, mobile application), also, a significant part of it will be made available as an API for third party developers. You know, the typical start...

Which books are good for JSP, Servlets, Ajax and JSON ?

An introductory book will suffice because I need to know only about the basics. ...

Sending Multiple Dropdown selected values as Hidden Field using JQuery

I want to be able to send all the selected values from a dropdown box (which allows multiple selection) as a hidden field using JQuery. I was able to send/retrieve a single value on form submission. If anyone can share some code snippet, that would help. Thanks in Advance! ...

Servlet Flow on a Request via Ajax

Ext.Ajax.request({url:'DeleteAction',success: doneFunction,failure: errorFunction,params:{name:rname}}); The above code is my Ajax request which goes to DeleteAction Servelet. Can anyone let me know what happens next in the below code. When this file is called what is first thing getting called. What does the doGet and doPost method ...

I have a problem of null pointer Exception in servlet .

HI, all I have a problem of null pointer Exception in servlet . I have a form a.jsp with check box if I do not select this check box and submit form then null pointer exception is occur in a.servlet. How I Can handle this Exception code a.jsp <table border='0' width='50%' cellspacing='0' cellpadding='0' ><form name=form1 method=post ...

Servlet to handle both applet communication and http requests

Hi, I'm building a solution where a servlet on tomcat6 handles input from another machine by providing a jsp web page. I'd also like the same servlet to communicate with an applet on the same machine to show some results and perform a few tasks. I'm able to connect from the applet to the servlet using a URLConnection but when receving ...

How to trace session creation

greetings all i have an application which are made with Spring framework and deployed on apache,tomcat and i see on tomcat manager that there are many un-used sessions in the application and i want to trace when this session are created and who is creating them, how to do so ? ...

android servlet jsp communication

hello i have an android application that sends data to a server every 10 seconds. the server processes the data received and has to display that on a jsp page. for every set of data received from the client, the jsp in the server has to be refreshed. i am unable to accomplish the italicized part. i save the processed data by using req...