<< < 1 2 3 4 5 >   Sort: Rank

Serialized JavaBean
Can a JSP page instantiate a serialized bean? No problem! The useBean action specifies the beanName attribute, which can be used for indicating a serialized bean. A couple of important points to note. Although you would have to name your serialized file like "filename.ser", you only indicate "filena...
2007-04-03, 5120👍, 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💬

Servlet Communicates with JSP Pages
How does a servlet communicate with a JSP page? The following code snippet shows how a servlet instantiates a bean and initializes it with FORM data posted by a browser. The bean is then placed into the request, and the call is then forwarded to the JSP page, Bean1.jsp, by means of a request dispatc...
2007-04-03, 5214👍, 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💬

Referencing "this" variable in JSP Pages
Is there a way to reference the "this" variable within a JSP page? Yes, there is. Under JSP 1.0, the page implicit object is equivalent to "this", and returns a reference to the servlet generated by the JSP page.
2007-04-03, 5178👍, 0💬

Processing HTML Form Date
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 via the request implicit object within a scriptlet or expression a...
2007-04-03, 4912👍, 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💬

Declaring Methods within JSP Pages
How can I declare methods within my JSP page? You can declare methods for use within your JSP page as declarations. The methods can then be invoked within any other methods you declare, or within JSP scriptlets and expressions. Do note that you do not have direct access to any of the JSP implicit ob...
2007-04-03, 5034👍, 0💬

Sharing an HttpSession between JSP and EJB
Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB? You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable. This has to be consider as "passed-by-value", that mean...
2007-04-03, 4969👍, 0💬

Handling Run-Time Exceptions
How does JSP handle run-time exceptions? You can use the errorPage attribute of the page directive to have uncaught runtime exceptions automatically forwarded to an error processing page. For example: redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during requ...
2007-04-03, 5037👍, 0💬

Browser Redirect in JSP Pages
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:// interview.fyicenter.com/");
2007-04-03, 5021👍, 0💬

Overriding JSP Methods
What JSP lifecycle methods can I override? You cannot override the _jspService() method within a JSP page. You can however, override the jspInit() and jspDestroy() methods within a JSP page. jspInit() can be useful for allocating resources like database connections, network connections, and so forth...
2007-04-03, 5160👍, 0💬

Stoping Errors Displayed on JSP Pages
How do you restrict page errors display in the JSP page? You first set "Errorpage" attribute of PAGE directory to the name of the error page (ie Errorpage="error.jsp") in your jsp page. Then in the error jsp page set "isErrorpage=TRUE". When an error occur in your jsp page it will automatically call...
2007-04-03, 5118👍, 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💬

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💬

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 &lt;%@ page isThreadSafe="false" %&gt; within your JSP page.
2007-04-03, 6391👍, 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💬

Including Static Files
How do I include static files within a JSP page? Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also...
2007-04-03, 5072👍, 0💬

Stored Procedures in Database
What are stored procedures? How is it useful? A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and saves the database the effort of parsing and compiling sql statements everytime a query is run. Each database has its own stored pro...
2007-04-03, 4821👍, 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💬

How to Retrieve SQLWarning
How to Retrieve SQLWarning? SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do. They simply alert the user that something did not happen as planned. A warning can be reported on a Connectio...
2007-04-03, 5062👍, 0💬

What Is Class.forName
What Class.forName will do while loading drivers? It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
2007-04-03, 4968👍, 0💬

Creating TCP Socket
What information is needed to create a TCP Socket? The Local Systems IP Address and Port Number. And the Remote System's IP Address and Port Number.
2007-04-03, 5173👍, 0💬

<< < 1 2 3 4 5 >   Sort: Rank