* 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 arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
* How can a servlet refresh automatically if some new data has entered the database? - You can use a client-side Refresh or Server Push.
* The code in a finally clause will never fail to execute, right? - Using System.exit(1); in try block will not allow finally code to execute.
* How many messaging models do JMS provide for and what are they? - JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
* What information is needed to create a TCP Socket? - The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
* 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.
* How to Retrieve Warnings? - 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 Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings();
if (warning != null)
{
while (warning != null)
{
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
* How many JSP scripting elements are there and what are they? - There are three scripting language elements: declarations, scriptlets, expressions.
* 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 page level.
* 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 procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
* 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 include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
* 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.
* 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.
Labels
.NET Job Questions
About Java
Absract class
Abstract class
Abstract Class and Interface
Aggregation
ajax
aop
apache ofbiz
Apache ofbiz tutrial
Association
authentication
autocad
basics
batch
Binary Tree
bootstrap loader in java
build
Builder design pattern
C++ Job Questions
caching
CallableStatement in java
certifications
Chain of responsibility Design pattern
charts
check parentheses in a string
Classes
classloader in java
classloading concept
code quality
collage level java program
Composition
concurrency
Concurrency Tutorial
Converting InputStream to String
Core Java
core java concept
core java interview questions
Core Java Interview Questions
Core Java Questions
core java tutorial
CyclicBarrier in Java
data structures
database
Database Job Questions
datetime in c#
DB
Db2 SQL Replication
deserialization in java
Design Patterns
designpatterns
Downloads
dtd
Eclipse
ejb
example/sample code
exception handling in core java
file handling injava
File I/O vs Memory-Mapped
Filter
first program in spring
flex
Garbage Collection
Generics concept in java
grails
groovy and grails
Guice
Heap
hibernate
Hibernate Interview Questions
how-to
IBM DB2
IBM DB2 Tutorial
ide
immutable
Interceptor
Interface
interview
Interview Questions for Advanced JAVA
investment bank
j2ee
java
JAVA Code Examples
Java 7
java changes
java class loading
JAVA Classes and Objects
Java Classloader concept
Java classloading concept
java cloning concept
java collection
Java collection interview questions
Java Collections
java concurrency
Java CountDownLatch
java definiton
Java design pattern
Java EE 5
Java EE 6
Java Exceptions
Java file
Java Garbage Collection
Java generics
Java Glossary
java hot concept
java immutable concept
Java Interface
Java interview Question
java interview question 2012
java interview question answer
Java Interview Questions
Java Interview Questions and Answers
java interview topic
java investment bank
Java Job Questions
java multithreading
java multithreading concept
java new features
Java Packages
java proxy object
java questions
Java Serialization
Java serialization concept
java serialization interview question
java session concept
java string
Java Swings Questions
java synchronization
java threading
Java Threads Questions
java tutorial
java util; java collections; java questions
java volatile
java volatile interview question
Java Wrapper Classes
java.java1.5
java.lang.ClassCastException
JavaNotes
javascript
JAX-WS
jdbc
JDBC
JDBC Database connection
jdk 1.5 features
JDK 1.5 new features Concurrent HashMap
JMS interview question
JMS tutorial
job
JSESSIONID concept
JSESSIONID interview Question
JSF
jsp
JSP Interview Question
JSP taglib
JSTL with JSP
Junit
Junit Concept
Junit interview question.Best Practices to write JUnit test cases in Java
JVM
Linux - Unix tutorial
Marker Interfaces
MD5 encryption and decryption
messaging
MNC software java interview question
musix
NCR java interview question
Networking Job Questions
news
Object Serialization
Objects
ojdbc14.jar
OOP
Oracle
Oracle SQL Query for two timestamp difference
orm
own JavaScript function call in Apache ofbiz
Packages
Palm Apps
patterns
pdf
persistence
Portal
Portlet Spring Integration
Prime number test in java
programs
Rails
Reboot remote computers
REST
Ruby
Sample application
schema
SCJP
security
Senior java developer interviews
servlet3
servlets
session tracking
singleton design pattern
Spring
Spring 2.5 Framework
spring ebook
Spring framework concept
spring MVC
spring pdf
Spring Security
Spring Security interview questions
SQL
SQL performance
SQL Query to create xml file
Sql Query tuning
ssis and ssrs
StAX and XML
string concept
string immutable
string in java
strings
struts
Struts2
Struts2 integration
synchronization works in java
Technical Interview
testing
tips
Tomcat
top
Tutorial
Volatile in deep
Volatile working concept
web
Web Developer Job Questions
web services
weblogic
Weblogic Application Server
websphere
what is JSESSIONID
xml
XML parsing in java
XML with Java
xslt
|
|
Showing posts with label Networking Job Questions. Show all posts
Showing posts with label Networking Job Questions. Show all posts
Saturday, 13 July 2013
Java Web development interview questions
Database, Networking, Java interview questions
* 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 arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
* How can a servlet refresh automatically if some new data has entered the database? - You can use a client-side Refresh or Server Push.
* The code in a finally clause will never fail to execute, right? - Using System.exit(1); in try block will not allow finally code to execute.
* How many messaging models do JMS provide for and what are they? - JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
* What information is needed to create a TCP Socket? - The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
* 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.
* How to Retrieve Warnings? - 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 Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings();
if (warning != null)
{
while (warning != null)
{
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
* How many JSP scripting elements are there and what are they? - There are three scripting language elements: declarations, scriptlets, expressions.
* 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 page level.
* 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 procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
* 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 include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
* 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.
* 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.
* 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 arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
* How can a servlet refresh automatically if some new data has entered the database? - You can use a client-side Refresh or Server Push.
* The code in a finally clause will never fail to execute, right? - Using System.exit(1); in try block will not allow finally code to execute.
* How many messaging models do JMS provide for and what are they? - JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
* What information is needed to create a TCP Socket? - The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
* 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.
* How to Retrieve Warnings? - 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 Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings();
if (warning != null)
{
while (warning != null)
{
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}
* How many JSP scripting elements are there and what are they? - There are three scripting language elements: declarations, scriptlets, expressions.
* 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 page level.
* 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 procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
* 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 include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
* 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.
* 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.
Job Questions for Java Servlet
1. What is the servlet?
2. What are the JSP atrributes?
3. What is the need of super.init(config) in servlets?
4. How to know whether we have to use jsp or servlet in our project?
5. Can we call destroy() method on servlets from service method?
6. What is the Servlet Interface?
7. What is the difference between GenericServlet and HttpServlet?
8. How we can check in particular page the session will be alive or not?
9. What is the importance of deployment descriptor in servlet?
10. When we increase the buffer size in our project using page directive attribute ‘buffer’ what changes we observe?
11. What is the difference between ServetConfig and ServletContext..?
12. When a servlet accepts a call from a client, it receives two objects. What are they?
13. What are the differences between GET and POST service methods?
14. In which conditions we have to use the ServletContext?
15. What methods will be called in which order?((i.e)service(),doget(),dopost())
16. Servlet is Java class. Then why there is no constructor in Servlet? Can we write the constructor in Servlet
17. What is the use of ServletConfig and ServletContext..?
18. What information that the ServletRequest interface allows the servlet access to?
19. What is the difference between ServletContext and ServletConfig?
20. When do you have action=get?
21. What is a Singleton class. How do you write it?
22. What is difference between sendRedirect() and forward()..? Which one is faster then other and which works on server?
23. What information that the ServletResponse interface gives the servlet methods for replying to the client?
24. Can I invoke a JSP error page from a servlet?
25. Can a init(ServletConfig config) method be overrided in servlets?
26. How many ServletConfig and servlet context objects are present in one application?
27. Do we have a constructor in servlet? can we explictly provide a constructor in servlet programme as in java program?
28. What are the uses of Servlets?
29. Can I just abort processing a JSP?
30. Is servlet is used to create a dynamic webpage or Static webpage or both?
31. If you want a servlet to take the same action for both GET and POST request, what should you do?
32. What is the difference between JSP and SERVLETS?
33. What are the advantages using servlets than using CGI?
34. What is a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or synchronization?
35. We have two applications in that we have two servlets each.How they(servlets) communicate with each other?
36. How the server will know (i.e) when it can invoke init, service,destroy methods of servlet life cycle?
37. How to communicate between two servlets?
38. What is the difference between servlets and applets?
39. How will u pass the argument from one servlet to another servlet?
40. What method used to add a jsp to the servlet?
41. How HTTP Servlet handles client requests?
42. How to get one Servlet’s Context Information in another Servlet?
43. Difference between single thread and multi thread model servlet
44. What is the super class of All servlets?
45. How are Servlet Applet communication achieved?
46. What is servlet context and what it takes actually as parameters?
47. What is the servlet life cycle?
48. Types of Servlets?
49. Why is that we deploy servlets in a webserver.What exactly is a webserver?
50. Which code line must be set before any of the lines that use the PrintWriter?
2. What are the JSP atrributes?
3. What is the need of super.init(config) in servlets?
4. How to know whether we have to use jsp or servlet in our project?
5. Can we call destroy() method on servlets from service method?
6. What is the Servlet Interface?
7. What is the difference between GenericServlet and HttpServlet?
8. How we can check in particular page the session will be alive or not?
9. What is the importance of deployment descriptor in servlet?
10. When we increase the buffer size in our project using page directive attribute ‘buffer’ what changes we observe?
11. What is the difference between ServetConfig and ServletContext..?
12. When a servlet accepts a call from a client, it receives two objects. What are they?
13. What are the differences between GET and POST service methods?
14. In which conditions we have to use the ServletContext?
15. What methods will be called in which order?((i.e)service(),doget(),dopost())
16. Servlet is Java class. Then why there is no constructor in Servlet? Can we write the constructor in Servlet
17. What is the use of ServletConfig and ServletContext..?
18. What information that the ServletRequest interface allows the servlet access to?
19. What is the difference between ServletContext and ServletConfig?
20. When do you have action=get?
21. What is a Singleton class. How do you write it?
22. What is difference between sendRedirect() and forward()..? Which one is faster then other and which works on server?
23. What information that the ServletResponse interface gives the servlet methods for replying to the client?
24. Can I invoke a JSP error page from a servlet?
25. Can a init(ServletConfig config) method be overrided in servlets?
26. How many ServletConfig and servlet context objects are present in one application?
27. Do we have a constructor in servlet? can we explictly provide a constructor in servlet programme as in java program?
28. What are the uses of Servlets?
29. Can I just abort processing a JSP?
30. Is servlet is used to create a dynamic webpage or Static webpage or both?
31. If you want a servlet to take the same action for both GET and POST request, what should you do?
32. What is the difference between JSP and SERVLETS?
33. What are the advantages using servlets than using CGI?
34. What is a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or synchronization?
35. We have two applications in that we have two servlets each.How they(servlets) communicate with each other?
36. How the server will know (i.e) when it can invoke init, service,destroy methods of servlet life cycle?
37. How to communicate between two servlets?
38. What is the difference between servlets and applets?
39. How will u pass the argument from one servlet to another servlet?
40. What method used to add a jsp to the servlet?
41. How HTTP Servlet handles client requests?
42. How to get one Servlet’s Context Information in another Servlet?
43. Difference between single thread and multi thread model servlet
44. What is the super class of All servlets?
45. How are Servlet Applet communication achieved?
46. What is servlet context and what it takes actually as parameters?
47. What is the servlet life cycle?
48. Types of Servlets?
49. Why is that we deploy servlets in a webserver.What exactly is a webserver?
50. Which code line must be set before any of the lines that use the PrintWriter?
Subscribe to:
Posts (Atom)