if i want to modify init-parameter value in any of ServletContext or ServletConfig.
any want it to be updated after servlet is destroyed by container.
is there any wayout?
...
Hi,
I want to create a website over banking. I just wanna know what's more do I have to know to create website. Is the knowledge of servlet, JSP, HTML, CSS is enough to make a website? Or do I have to know Javascript as well?
Thanks in advance.
...
Hi,
could anyone please tell me the meaning of the word mapping in the following line:
When you define a servlet for a JSP,
you must also define mapping to the
JSP page.
Thanks in advance.
...
after commit of response as here redirect statement should give exception but it is not doing so if this redirect statemnet is in if block.but it does give exception in case it is out of if block.i have shown same statement(with marked stars ) at two places below.can u please tell me reason for it.
protected void doPost(HttpServletR...
For a background job which I would like to run in a J2EE container, I found the suggestion to create a startup servlet and use the Timer Service API to create a managed Timer (in the answers for What tools are there for timed batch processes in J2EE?).
To create a timer, I need a context which implements the timer API. (Example)
In th...
Hi,
I really don't understand why the following code in JSP is running fine, but as described in Head first book, it will show compile time error.
<html><body>
<jsp:useBean id="person" type="foo.Person" scope="request">
<jsp:setProperty name="person" property="name" value="Fred"/>
</jsp:useBean>
<jsp:getProperty name="person" prope...
Hi,
I am developing a web site which uses lot of images.I would like to make all images are to be stored in browser's cache till some specified time.Now it is stored in browser's cache.However if we refresh the page in browser it is making request to server for particular resource.Server responds with 304 code(NOT MODIFIED).I want to av...
Hi
In a servlet, is destroy() called before or after finalize()?
...
I'm running a web application in JBoss AS 5. I also have a servlet filter which intercepts all the requests to the server. Now, I want to redirect the users to the login page, if the session has expired. I need to do this 'isSessionExpired()' check in the filter and need to redirect the user accordingly. How do I do it?
Edit:
I'm setti...
I'm trying to use Servlets as a controller layer and JSPs as a view layer. Many of the examples/tutorials I've read suggest doing somehting like this:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// add something for the JSP to work on
request.setAttribute("key", "v...
I'm trying to build a Servlet that calls a JSP page similar to the following:
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException, ServletException {
req.getRequestDispatcher("/WEB-INF/main.jsp").forward(req, resp);
}
I need this Servlet to respond to the domain's root (eg: http://example.com/) so...
The question is self explanatory I guess. This is what I am doing:
Student student = Student.findStudent(s.getRegNumber(), (ClientSession)httpSesn);
findStudent() method returns me an object of the Student class. As you can see I am casting HttpSession object into a ClientSession. Is it advisable? Are their any hidden snags involved? ...
I have a servlet that looks something like this:
public class ExampleServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().println(request.getPathInfo());
}
}
with a web.xml mapping like:
<servlet>
<servlet-name>exampl...
I'm writing a Java servlet in Eclipse (to be hosted on Google App Engine) and need to process an XML document. What libraries are available that are easy to add to an Eclipse project and have good example code?
...
I'm having an issue using the Cookie class of the Servlet API 2.5 on Tomcat . I pull out the list of cookies from the HttpServletRequest object and iterate over them like so:
Cookie[] cookies = request.getCookies();
for(Cookie cookie : cookies) {
System.out.println("Name=" + cookie.getName() + " Domain=" + cookie.getDomain());
}
Ho...
To track user activity history on a web application, I am attempting to save some session data to a database when the session is invalidated. My initial approach was to store the data on a javabean with a session scope and have it dump its data to the database through the finalize method.
I figured this wouldn't be a perfect solution du...
I have the following servlet code
public void doPost(HttpServletRequest request, HttpServletResponse response){
Backup bup = new Backup();
bup.doBackup();
response.setContentType("text/html");
PrintWriter out;
try {
out = response.getWriter();
out.println("You backed up your data - well hopefully");
out.flush();
out.close()...
Hello all.
I have a Java web application that works a lot with file conventions.
I am using Tomcat 6 as my servlet container. When many requests are submitted, Tomcat becomes very memory hungry. I wonder how I can fine-tune tomcat to reduce the memory consumption.
I am also considering changing my servlet container.
What do you suggest? ...
Hi,
could anyone tell me how can I enable EL expression in JSP version 2.0? Every time I'm getting EL expression as an String literal in the JSP as an output.
Here's the DD which the container is using to sending request to servlet, and then servlet dispating request to JSP:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
...
Following what seem to be the standard way to perform transformations using translets;
see http://xml.apache.org/xalan-j/xsltc_usage.html#api;
We perform the following steps
Set the javax.xml.transform.TransformerFactory
system property as indicated...
Instantiate a TransformerFactory.
Instantiate a Transformer object either directly...