Professional Documents
Culture Documents
Javascript: 3 Object Hierarchy in Java Script .What Is Dom (Document Object Model) - Javascript ?
Javascript: 3 Object Hierarchy in Java Script .What Is Dom (Document Object Model) - Javascript ?
1 What is JavaScript?
JavaScript is a scripting language, commonly used for the client side validations in Java
Server Pages & DHTML.
Client side scripting is associated with client and it does not need any of the server related
objects such as database. Server side scripting is associated with server and uses database
objects.
Document Object module is a technique used in JavaScript, using which elements of the document(an
HTML page,a form within a page etc) are identified in the script.
var regExp=/^\d+$/
if(regExp.test(document.form1.field1.value))
{
return true
}
else
{
return false
}
5 Event Handling in JavaScript?
Event handling such as click can be handled using a script method, such as onClick="display()", where
display() is a JavaScript method.
JSP/Servlets
In functional wise there is no difference between JSP and serevlet. JSP is again going to
convert into Servlet at the server and executes. But the difference comes when separating the
presentation logic with the business logic. We write all the presentation logic in jsp and all the
flow and business logic in servlet.
1
SingleThreadModel is an interface provided by java API to ensure that only one thread
is executing the servlet's service() method at any given time.
4. What are the ways in which a java class can be instantiated from a JSP?
5. What are the various scopes available for a bean used in the USEBEAN tag?
<scope = request/page/session/application>
6. What are the various ways of managing session across the application? Explain briefly.
URL rewriting - Client specific Unique token id is passed along with the URL
Hidden form fields - Unique token is embedded within HTML form
Cookies-A cookie is a small piece of textual information sent by the server to the client
stored on the client and returned by the client for all requests to the server.
7. Explain the significance of multithreading used in servlets. How do you declare global
variables in a servlet and in a JSP?
8. How do you accept parameters from a form submitted via GET/POST methods?
Request.getParameter()
9. Does Applet support JDBC and Servlets?
No.
10. Use of Servlet Config , Servlet Context?
2
15.How do you pass String or a file between two Servers?
Document.form.submit()
17.What is the difference between dopost and doget request?
DoGet() the parameters are transmitted through URL and hence large cannot be
transmiited.
DoPost() the parameters are transmitted through request object and hence one can
transfer large amount of data. Since the transfer is through request object, security is
ensured.
18. Difference between a forward & sendRedirect?
SendRedirect() sends a redirect response to the client. The client receives the HTTP
response 302 indicating that temporarily the client is being redirected to the specified
location. forward the request to another servlet or a JSP page or an HTML file .
20 How does the container handle multiple requests for the same Servlet?