Servlets Section Index | Page 7
In order to find the proper URL to which to submit forms, I need to manually set the context name in every URL.
In order to find the proper URL to which to submit forms, I need to manually set the context name in every URL, using somthing like: <form action="<%=pageContext.getServletContext()%>/doT...more
You need to turn on Servlet Reloading on your Tomcat. [While the below works, for Tomcat 4 another answer is simply to add the attribute reloadable="true" to the Context element for that webapp. ...more
You must get the init-param from servlet and load it into the bean, either defining a set method or passing it into the constructor. The init-param tag is for init parameters for the servlets and ...more
It is not mandatory for JSPs to be registered in the web.xml but it is sometimes done; the <servlet-class> tag being replaced by the <jsp-file> tag (and others remaining the same). e...more
I've recently installed j2sdk1.4.1, having previously been developing in jdk1.2.1 and my old code is not compiling as it can't find packages javax.servlet.* and javax.servlet.http.*. How can I fix this?
The package javax.servlet is not in the standard J2SE libraries. It's included in j2ee.jar or servlet.jar. You can find these by downloading J2EE or Tomcat respectively. (Tomcat is probably w...more
Usually the word "distributed" refers to the system being composed of physically separate parts where different logic is performed in different places. A typical distributed web application is su...more
Maintaining database state across session I have a servlet, which when called from a web page calls a PL/SQL procedure that updates certain records in the database. After which the servlet redirect...more
There is no standard way for this. If you've studied the infrastructure for SMS (or MMS) messaging, you would've noticed that there needs to be a gateway for sending the SMS (or MMS). The API with...more
Variables declared in methods are never shared, whether these methods are static or not... [However, session variables are shared, and instance variables *may* be shared (or may not, which means ...more
How can an HttpSessionListener comunicate directly to an user web browser that his session has been destroyed by server web.xml "timeout" parameter?
It can't. The request-response nature of the HTTP protocol prevents us from sending "push" data to the browser. When the HttpSessionListener.sessionDestroyed() method is called by the container,...more
Is this when the user aborts the process by clicking the browser's stop button, or navigating to another link? At what point in the process is this exception thrown, when the servlet attempts to s...more
As specified by the documentation, this method returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. The authentica...more
Additional info: I'd like to organize my webapps in subdirectories of the tomcat/webapps/ directory. I have right now a setup like: /tomcat/webapps/<client>/application The problem that I ...more
Once you install your servlet inside a servlet container like Tomcat, you can fetch the results of the servlet by using a command-line tool like wget or curl (or write your own HTTP client -- it'...more