Server-Side Development Section Index | Page 3
How can you logout a user (invalidate his Session) when a user directly closes his browser window?
Short answer: you can't. Fortunately, sessions expire automatically after a period of time; check your servlet engine documentation to see how to set this timeout period.
I felt that there should...more
How do I use the DLLs from Tomcat to Servlet-enable Microsoft IIS?
Look at the Tomcat IIS How to file located at the address :
http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/tomcat-iis-howto.html
(or
http://jakarta.apache.org/cvsweb/index.cgi/jakarta-t...more
Is there any way in JSP to set focus on an input field in a HTML form using JSP code, and not JavaScript?
No, there isn't. Remember, JSP is strictly a server-side technology, which is responsible
for generating dynamic content in HTML, DHTML or XML format. Setting focus on
specific input elements wi...more
While I am still making changes to a servlet code, how can I make a servlet reload every time I test it?
It depends on the web server you are using to test your servlet. For instance, with Tomcat, you would replace the WAR file and the server notices the change and loads the new servlet on the next r...more
How can you copy a JavaScript variable to a JSP session variable without using cookies?
How can you copy a JavaScript variable to a JSP session variable without using cookies?
I am trying to store the value of a SELECT object in a session variable so it can be accessed in other JSP's...more
What are the Servlet equivalents to all the CGI environment variables?
The following CGI environment variables, and their descriptions, were taken from the CGI
specification, at http://hoohoo.ncsa.uiuc.edu/cgi/env.html.
Please see http://java.sun.com/products/servle...more
What is JNDI?
The Java Naming and Directory Interface (JNDI) is an application programming interface (API) for accessing different kinds of naming and directory services. JNDI is not specific to a particular n...more
How do I download a (binary, text, executable) file from a servlet or JSP?
Solution 1: Just use HTTP! This has nothing to do with servlets per se. Make sure the file is on your web server. Then you can either embed a link for your user to click, as
<a href="run...more
How do I open and redirect to a popup window from a servlet? (Under certain circumstances I want my servlet to bust out of the frames and redirect to another servlet or page.)
You can't do this directly but it is easy to do indirectly using JavaScript.
Essentially you return a page that has as its onLoad event code that opens a page and gets your new data.
Your servle...more
What is a stateful session bean?
A stateful session bean is an enterprise bean (EJB component) that acts as a server-side extension of the client that uses it. The stateful session bean is created by a client and will work for o...more
How do I perform browser redirection from a JSP page?
You can use the response implicit object to redirect the browser to a different resource, as:
response.sendRedirect("http://www.foo.com/path/error.html");
You can also physically alter
the Loc...more
How do I use comments within a JSP page?
You can use "JSP-style" comments to selectively block out code while debugging
or simply to comment your scriptlets. JSP comments are not visible at the client.
For example:
<%-- the script...more
Can a JSP page process HTML FORM data?
Yes. However, unlike servlets, you are not required to implement HTTP-protocol specific
methods like doGet() or doPost() within your JSP page. You can obtain the data for the
FORM input elements...more
How do I upload a file to my servlet or JSP?
On the client side, the client's browser must support form-based
upload. Most modern browsers do, but there's no guarantee. For
example,
<FORM ENCTYPE='multipart/form-data'
method='POST' ...more
How do I create an image (GIF, JPEG, etc.) on the fly from a servlet?
To create an image or do image processing from Java, there are several
packages and classes available. See the Purple Servlet References for a list.
Once you have an image file in your servlet...more