Servlets Section Index | Page 5
Can we use the constructor, instead of init(), to initialize servlet?
No you can't. It's the container who manages the lifecycle of the sevlet not you. Also, you must call super.init() for init() to work properly.
Does Jserv support the following methods from Servlet spec 2.2?
Does Jserv support the following methods from Servlet spec 2.2?
javax.servlet.http.HttpServletRequest: method getSession
javax.servlet.http.HttpSession: method setAttribute
javax.servlet.Serv...more
How do I run a servlet from command-line mode?
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
I have been trying to find a way not only to get the user certificate info - i.e. Authentication via DigitalID, but also to have a digest of the request, signed by the client (Web Browser Only - not the Applet/Application case) or something like that, so I can proove to a 3rd party that the user with the specific certificate has issued the specific request. Is it at all possible?
That's an interesting question. I'm pretty sure the answer is "no," at least not without hacking the server. The request *is* signed by the client, effectively, but (a) since it's SSL, what's si...more
Why is my servlet called twice from a JavaScript button?
Do you submit the form from the javascript? This can happen if you are calling the javascript function which does document.formName.submit() but the form itself also has an action attribute. There...more
How do i get the name of the file from a file upload form?
Using Jason Hunter's O'reilly Servlet package, if you pass some parameter as query String or hidden variable,then only by using Vectors I was getting parameters which was passed from the previous ...more
I put my JAR file inside WEB-INF/lib, but my classes are not getting found. However, when i unzipped classes into WEB-INF/classes/, it works. What's up?
Some old versions of Tomcat do not include WEB-INF/lib/*.jar in WebApp classpath. You may handle it updating to a newer version of tomcat or (as you did) unpacking jars into WEB-INF/classes/.
[G...more
In order to run Struts, do I need to install a servlet container such as Tomcat?
Yes, you must!
See the installation requirement for Struts:
http://jakarta.apache.org/struts/userGuide/installation.html
more
Request parameter. How to find whether a parameter exists in the request object?
Request parameter
How to find whether a parameter exists in the request object?
When I describe the servlet mapping in the web.xml file the url-pattern "/*" means "match all requests". Can I specify the url-pattern like "match all except *.jsp" ?
Unfortunately... I don't think you can do that.
[Alessandro A. Garbagnati, Feb 20, 2002 adds:
Since Tom's suggestion did not work, I'm afraid you need to put something in your servlet that will ...more
Can I have some simple code for my own connection pooling class?
public class ConnectionPool
{
private Connection _connection;
public ConnectionPool(Connection connection)
{
_connection = connection;
}
public synchronized Connection getC...more
How can a servlet refresh automatically if some new data has entered the database?
No easy way.
You can use a client-side Refresh or Server Push -- see
What is server push? How do I use it from a servlet?
You also have to figure out how to ask the database if something change...more
How can I send user authentication information while making URLConnection?
You'll want to use HttpURLConnection.setRequestProperty and set all the appropriate headers to to HTTP authorization.
-chris
Using WebLogic 6.1, why can't I load a servlet from a JAR file in my /WEB-INF/lib directory?
It looks like another bug in the weblogic servlet container part.
Can you take your web application and try it with a fully compliant servlet container (like Tomcat) and see if you have the same p...more
Why can't I upload image files using com.oreilly.servlet.multipart.FilePart?
It's probably a server bug. Make sure you are using the latest version of your servlet container, and check the bug reports. Also, try running your code on a different server (e.g. standalone To...more