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

Can you make use of a ServletOutputStream object from within a JSP page?
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...
2013-08-02, 2855👍, 0💬

How do you restrict page errors display in the JSP page?
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 ...
2013-07-23, 2777👍, 0💬

What is the difference between RequestDispatcher and sendRedirect?
What is the difference between RequestDispatcher and sendRedirect? RequestDispatcher: server-side redirect with request and response objects. sendRedirect : Client-side redirect with new request and response objects.
2013-08-19, 2760👍, 0💬

Why is _jspService() method starting with an '_' while other life cycle methods do not?
Why is _jspService() method starting with an '_' while other life cycle methods do not? _jspService() method will be written by the container hence any methods which are not to be overridden by the end user are typically written starting with an '_'. This is the reason why we don't override _jspServ...
2013-08-14, 2591👍, 0💬

Can you override jspInit() method? If yes, In which cases?
Can you override jspInit() method? If yes, In which cases? ye, we can. We do it usually when we need to intialize any members which are to be available for a servlet/JSP throughout its lifetime.
2013-08-16, 2590👍, 0💬

A JSP page, include.jsp, has a instance variable "int a", now this page is statically included in another JSP page, index.jsp, w
A JSP page, include.jsp, has a instance variable "int a", now this page is statically included in another JSP page, index.jsp, which has a instance variable "int a" declared. What happens when the index.jsp page is requested by the client? Compilation error, as two variables with same name can't be ...
2013-08-16, 2557👍, 0💬

What is the difference between ServletContext and PageContext?
What is the difference between ServletContext and PageContext? ServletContext: Gives the information about the container PageContext: Gives the information about the Request
2013-08-12, 2513👍, 0💬

How can my application get to know when a HttpSession is removed?
How can my application get to know when a HttpSession is removed? Define a Class HttpSessionNotifier which implements HttpSessionBindingListener and implement the functionality what you need in valueUnbound() method. Create an instance of that class and put that instance in HttpSession.
2013-08-20, 2432👍, 0💬

Can we override the jspInit(), _jspService() and jspDestroy() methods?
Can we override the jspInit(), _jspService() and jspDestroy() methods? We can override jspinit() and jspDestroy() methods but not _jspService().
2013-08-14, 2429👍, 0💬

What is the difference between directive include and jsp include?
What is the difference between directive include and jsp include? &lt;%@ include&gt; : Used to include static resources during translation time. : Used to include dynamic content or static content during runtime.
2013-08-19, 2411👍, 0💬

How do I perform browser redirection from a JSP page?
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.exforsys.com/path/error.ht ml");You can also physically alter the Location HTTP header attribute, as shown below: You ...
2013-07-24, 2395👍, 0💬

Explain the life cycle of JSP?
Explain the life cycle of JSP? Any JSP page goes through 7 phases in its entire lifecycle Phase Name Description Page translation The page is parsed and a Java file containing the corresponding servlet is created. Page compilation The Java file is compiled. Load class The compiled class is loaded. C...
2013-08-15, 2390👍, 0💬

How do I do fill_in_the_blank for each file in a directory?
How do I do fill_in_the_blank for each file in a directory? Here's code that just prints a listing of every file in the current directory: #!/usr/bin/perl -w opendir(DIR, "."); @files = readdir(DIR); closedir(DIR); foreach $file (@files) { print "$file\n"; }
2013-08-23, 2360👍, 0💬

How does JSP handle runtime exceptions?
How does JSP handle runtime exceptions? Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting of a JSP.
2013-08-20, 2358👍, 0💬

What is the page directive is used to prevent a JSP page from automatically creating a session?
What is the page directive is used to prevent a JSP page from automatically creating a session? &lt;%@ page session="false"&gt;
2013-08-08, 2357👍, 0💬

How do I generate a list of all .html files in a directory?
How do I generate a list of all .html files in a directory? Here's a snippet of code that just prints a listing of every file in the current directory that ends with the extension .html: #!/usr/bin/perl -w opendir(DIR, "."); @files = grep(/\.html$/,readdir(DIR)); closedir(DIR); foreach $file (@files...
2013-08-23, 2313👍, 0💬

What happens when a page is statically included in another JSP page?
What happens when a page is statically included in another JSP page? An include directive tells the JSP engine to include the contents of another file (HTML, JSP, etc.) in the current page. This process of including a file is also called as static include.
2013-08-15, 2274👍, 0💬

Can a JSP page process HTML FORM data?
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...
2013-07-30, 2249👍, 0💬

How can I set a cookie and delete a cookie from within a JSP page?
How can I set a cookie and delete a cookie from within a JSP page? A cookie, mycookie, can be deleted using the following scriptlet:
2013-08-07, 2224👍, 0💬

How do you connect to the database from JSP?
How do you connect to the database from JSP? A Connection to a database can be established from a jsp page by writing the code to establish a connection using a jsp scriptlets. Further then you can use the resultset object "res" to read data in the following way.
2013-08-08, 2217👍, 0💬

How is JSP include directive different from JSP include action.
How is JSP include directive different from JSP include action. When a JSP include directive is used, the included file's code is added into the added JSP page at page translation time, this happens before the JSP page is translated into a servlet. While if any page is included using action tag, the...
2013-08-13, 2213👍, 0💬

How do you delete a Cookie within a JSP?
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);
2013-08-10, 2202👍, 0💬

Can we use the constructor, instead of init(), to initialize servlet?
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 wit...
2013-07-10, 2175👍, 0💬

How many JSP scripting elements are there and what are they?
How many JSP scripting elements are there and what are they? There are three scripting language elements: declarations, scriptlets, expressions.
2013-07-16, 2172👍, 0💬

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