1 2 3 4 5 > >>   Sort: Date

Session Tracking without Cookies
How can I enable session tracking for JSP pages if the browser has disabled cookies? We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session tracking ...
2007-04-03, 7851👍, 0💬

Entering Comments in JSP Pages
What are the two kinds of comments in JSP and what's the difference between them? <%-- JSP Comment --%> <!-- HTML Comment --> HTML comments are visible on the client side. But JSP comments are not visible on the client side.
2007-04-03, 7729👍, 0💬

. How can a servlet refresh automatically if some new data has entered the database?
. How can a servlet refresh automatically if some new data has entered the database? You can use a client-side Refresh or Server Push.
2013-07-11, 7625👍, 0💬

JSP Tags vs. JavaBeans
What is difference between custom JSP tags and JavaBeans? Custom JSP tag is a tag you defined. You define how a tag, its attributes and its body are interpreted, and then group your tags into collections called tag libraries that can be used in any number of JSP files. To use custom JSP tags, you ne...
2007-04-03, 7573👍, 0💬

Using scriptlet to Initialize JavaBean
How do I use a scriptlet to initialize a newly instantiated bean? A jsp:useBean action may optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to init...
2007-04-03, 7007👍, 0💬

init() vs. Constructor
Can we use the constructor, instead of init(), to initialize servlet? Yes , of course you can use the constructor instead of init(). There's nothing to stop you. But you shouldn't. The original reason for init() was that ancient versions of Java couldn't dynamically invoke constructors with argument...
2007-04-03, 6855👍, 0💬

include Directive vs. jsp:include Action
What is the difference between include directive & jsp:include action? Difference between include directive and jsp:include action: provides the benifits of automatic recompliation,smaller class size ,since the code corresponding to the included page is not present in the servlet for every inclu...
2007-04-03, 6735👍, 0💬

Passing Control from One JSP Page to Another
How do you pass control from one JSP page to another? Use the following ways to pass control of a request from one servlet to another or one jsp to another. The RequestDispatcher object's forward method to pass the control. The response.sendRedirect method
2024-02-05, 6499👍, 2💬

💬 2023-12-20 Bhara: Nice

Server Push and Refresh
How can a servlet refresh automatically if some new data has entered the database? You can use a client-side Refresh or Server Push.
2007-04-03, 6476👍, 0💬

Thread Safe JSP Pages
How can I implement a thread-safe JSP page? You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" %> within your JSP page.
2007-04-03, 6391👍, 0💬

Using ServletOutputStream Object in JSP Pages
Can you make use of a ServletOutputStream object from within a JSP page? No. You are supposed to make use of only a JSPWriter object (given to you in the form of the implicit object out) for replying to clients. A JSPWriter can be viewed as a buffered version of the stream object returned by respons...
2007-04-03, 5478👍, 0💬

Overriding JSP Server Generated Servlet Subclass
How do I have the JSP-generated servlet subclass be my own custom servlet class, instead of the default? One should be very careful when having JSP pages extend custom servlet classes as opposed to the default one generated by the JSP engine. In doing so, you may lose out on any advanced optimizatio...
2007-04-03, 5428👍, 0💬

What is JSP
What is a JSP and what is it used for? Java Server Pages (JSP) is a platform independent presentation layer technology that comes with SUN's J2EE platform. JSPs are normal HTML pages with Java code pieces embedded in them. JSP pages are saved to *.jsp files. A JSP compiler is used in the background ...
2007-04-03, 5413👍, 0💬

Deleting Cookies in JSP Pages
How do you delete a Cookie within a JSP? Cookie mycook = new Cookie("name","value"); response.addCookie(mycook); Cookie killmycook = new Cookie("mycook","value"); killmycook.setMaxAge(0); killmycook.setPath("/"); killmycook.addCookie(killmycoo k);
2007-04-03, 5381👍, 0💬

JComponent and Component
Why does JComponent have add() and remove() methods but Component does not? Because JComponent is a subclass of Container, and can contain other components and jcomponents.
2007-04-03, 5381👍, 0💬

Stoping JSP Execution in the Middle of a JSP Page
Can I stop JSP execution while in the midst of processing a request? Yes. Preemptive termination of request processing on an error condition is a good way to maximize the throughput of a high-volume JSP engine. The trick (asuming Java is your scripting language) is to use the return statement when y...
2007-04-03, 5357👍, 0💬

Missing JSP and SSI Includes
How do I mix JSP and SSI #include? If you're just including raw HTML, use the #include directive as usual inside your .jsp file. <!--#include file="data.inc"-->
2007-04-03, 5317👍, 0💬

Preventing the Creation of Sessions in JSP Pages
How do you prevent the Creation of a Session in a JSP Page and why? By default, a JSP page will automatically create a session for the request if one does not exist. However, sessions consume resources and if it is not necessary to maintain a session, one should not be created. For example, a market...
2007-04-03, 5302👍, 0💬

Finally Clause Execution
The code in a finally clause will never fail to execute, right? Not really. Using System.exit(1); in try block will not allow finally code to execute.
2007-04-03, 5299👍, 0💬

Preventing JSP Pages Being Cached by Browsers
How do I prevent the output of my JSP or Servlet pages from being cached by the browser? You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser. Just execute the following scriptlet at the beginning of your J...
2007-04-03, 5270👍, 0💬

Java Bean Class with 100 Fields
How to write a bean class, when you have 100 fields and each have three sub fields.
2007-04-26, 5261👍, 0💬

What Is JSP Technology
What is JSP technology? Java Server Page is a standard Java extension that is defined on top of the servlet Extensions. The goal of JSP is the simplified creation and management of dynamic Web pages. JSPs are secure, platform-independent, and best of all, make use of Java as a server-side scripting ...
2007-04-03, 5260👍, 0💬

Setting Session Timeout Period
Is there a way I can set the inactivity lease period on a per-session basis? Typically, a default inactivity lease period for all sessions is set within your JSPengine admin screen or associated properties file. However, if your JSP engine supports the Servlet 2.1 API, you can manage the inactivity ...
2007-04-03, 5258👍, 0💬

SingleThreadModel Deprecated
In the Servlet 2.4 specification SingleThreadModel has been deprecated, why? Because it is not practical to have such model. Whether you set isThreadSafe to true or false, you should take care of concurrent client requests to the JSP page by synchronizing access to any shared objects defined at the ...
2007-04-03, 5229👍, 0💬

1 2 3 4 5 > >>   Sort: Date