CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies
JSP Interview Questions & Answers - Learning Mode
COOLINTERVIEW.COM J2EE INTERVIEW QUESTIONS JSP INTERVIEW QUESTIONS QUESTIONS & ANSWERS - LEARNING MODE

JSP Interview Questions & Answers - Learning Mode

JavaServer Pages (JSP) is a Java technology that allows software developers to dynamically generate HTML, XML or other types of documents in response to a Web client request. The technology allows Java code and certain pre-defined actions to be embedded in any web application.

Try JSP Interview Questions & Answers - Exam Mode

1 2 3 4 5 6 7 8 9 10 11 Next

Sort By : Latest First | Oldest First | By Rating

JSP Interview Questions & Answers - Learning Mode
Try JSP Interview Questions & Answers - Exam Mode
Question: Can a JSP page instantiate a serialized bean?

Answer: No problem! The useBean action specifies the beanName attribute, which can be used for indicating a serialized bean.

For example:

<jsp:useBean id="shop" type="shopping.CD" beanName="CD" />
<jsp:getProperty name="shop" property="album" />

A couple of important points to note. Although you would have to name your serialized file "filename.ser", you only indicate "filename" as the value for the beanName attribute. Also, you will have to place your serialized file Source: CoolInterview.com
Question: What is the difference between include directive & jsp:include action?

Answer: Difference between include directive and <jsp:include>

1.<jsp:include> 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 included jsp page and option of specifying the additional request parameter.
2.The <jsp:include> also supports the use of request time attributes valus for dynamically specifying included page which directive does not.
3.the include direc Source: CoolInterview.com
Question: What is difference between scriptlet and expression



Answer: Anything that is put in the Jsp Expression tag get evaluated to a string, which, technically becomes an argument to the println() statement in the generated servlet.( JSP eventually is converted to a servlet ) otherwise it serves no purpose on its own.

Expression has the following syntax

NO SEMICOLON

Scriptlet:
Source: CoolInterview.com
Question: How to overwrite the init and destroy method in a JSP page.



Answer: We can overwrite the init method in a jsp page by using declaration tag in our JSP page.
Source: CoolInterview.com
Question: What are the implicit objects in JSP & differences between them?

Answer: There are 9 Implicit Objects defined in JSP are :
application, config, exception, out, page, pageContext, request, response and session.

The main difference between these Objects lies in their scope and the data they handles.

Submitted by Sagar GV (mydearsagar@yahoo.com)
_________________


JSP Implicit Objects :-

S.No Implici Object Class or Interface Source: CoolInterview.com
Question: Can a single JSP page be considered as a J2EE application?



Answer: Yes, if its packed as war or if it's directory structure confirms j2ee specifications with a dd Source: CoolInterview.com
Question: How can I restrict the user from Clicking of Back button in any browser?


Answer: One of the way to restrict the user to Go back by disabling the back button can be done using the Following Script.

Please use the script in the <Head> tag of the every page you design(it works in Internet explorer . C# using Asp.net)


<script="Javascript">
<!--

javascript:window.history.forward(1);

//-->
</script>


Source: CoolInterview.com
Question: How can I enable session tracking for JSP pages if the browser has disabled cookies?

Answer: 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 using URL rewriting. URL rewriting essentially includes the session ID within the link itself as a name/value pair.

However, for this to be effective, you need to append the session ID for each and every link that is part of your servlet response. Adding the session ID to a lin Source: CoolInterview.com
Question: How to delete cookies in JSP?



Answer: Whenever you want to delete cookies, just set the Maxtime value to 0..

example given below.

Cookie cookie = new Cookie ("myCookie", "theCookieValue");

// Expire in five minutes (5 * 60)
cookie.setMaxTime( 300 );


some... more code here.. or any other page..

// Expire after the browser is closed
// cookie.setMaxTime( -1 );

// Expire right now
// cookie.setMaxTime( 0 );

Source: CoolInterview.com
Question: How to pop up a jsp page?refreshing every two seconds.






Answer: You need to take help of HTML Auto refresh facility to achive this task. Please search google to know more about auto refresh html tag. You can also do view source of few stock or cricket site which have this autorefresh factility. Source: CoolInterview.com
Question: How the jsp changes will be effected in servlet file after converting?



Answer: Here jsp engine cheack whether jsp page is older than its servlet page or not and on the basis of this it it's decide whether changes are needed or not. Source: CoolInterview.com
Question: What is the need of taglibraries?



Answer: Custom tag Libraries allow the java programmer to write code that provides data access and other services.

TagLibraries cab have access to all the objects available to jsp pages including request,response,IN,OUT.

Communicate with each other,you can create and initialize a bean(javabean).Create a variable that refers to that bean in one tag,and then use the bean in other tag.

can be nested with one another,allowing complex interactions with in a jsppage.

Source: CoolInterview.com
Question: How to pass java script array to jsp
page?



Answer: I just started to learn java script. working on practice project to create shopping cart. The jsp page will getting the information from database, after user key in quantity in text box, it will submit to servlet.

Code:
<input type=text name="<%= newit.getItem() %>Qty" value = "0">

now I wanna use javascript to validate if the input is positive integer, so I change the name to "Qty", and added a hidden field right after this.

Code:
<input type=text name= Source: CoolInterview.com
Question: My html form contains an INPUT "text" element that accepts Date, i want to catch that date and want to query it using JSP?
In short, how can i use that HTML form element with Prepared Statements in JSP?



Answer: In jsp...

String s=request.getParameter(textfield)

write the query like

String q=..... where date=? //s bz we r using prepared St

executeQuery(q);

-----------------

here we have get the date from text field and assign to local varible and execute........ using prepared statement
Source: CoolInterview.com
Question: How can we move from one JSP page to another(mean using what tecnique?)



Answer: <jsp:forward page="/pagename" /

Source: CoolInterview.com
Question: How to compile the JSP pages manually in all applications and web servers



Answer: yes it can be possible,

in order to do so first set u r class path to setenv in weblogic and then

type weblogic.jspc -keepgenerated jspfile name

this is the procedure to precompile the jsp with out the help of container with web-logic
Source: CoolInterview.com
Question: Is there a way to reference the "this" variable within a JSP page?

Answer: 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. Source: CoolInterview.com
Question: How do you pass control from one JSP page to another?

Answer: 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

Submitted By: Rekha ( rekha.s @ enrichsolutions . com )
Source: CoolInterview.com
Question: What is the differnce between application server and web server



Answer: Web server cannot communicate with Component Architecture or Distributed Architecture.It consists of Servlets and JSP pages.Application server is EJB. It can communicate will both Web and Distributed Architecture. Application server is a Component Architecture. Source: CoolInterview.com
Question: What is the difference between Difference between doGet() and doPost()?


Answer: The main difference doGET() and doPOST() is that:

doGET() is having limited length,i.e 1024 charaters,where as doPOST() can accept unlimited characters
Source: CoolInterview.com

1 2 3 4 5 6 7 8 9 10 11 Next



India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.031006 Seconds