- 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.
Thursday, June 19, 2008
Java Web development interview questions
Subscribe to:
Post Comments (Atom)
Topics
- ActionScript (1)
- Ajax (1)
- Apache mod_SSL (1)
- Apache SSL (2)
- Backup a Certificate (1)
- CA (1)
- connection pooling (1)
- cryptography (1)
- CSR (1)
- CSR Generation Instructions- Tomcat (1)
- Database Connection Pooling with Tomcat (1)
- datasource connection (1)
- Difference between equals and hashCode method (1)
- Difference between JDBC and hibernate (1)
- Difference between String StringBuffer and StringBuilder (1)
- Different types of SQL Joins (1)
- digital certificate (1)
- Digital Certificate Enrollment (1)
- digital certificate installation (1)
- DOM (2)
- DTD (1)
- encryption (1)
- Events in Flex (1)
- Flex Data Access (1)
- generate certificate (1)
- Good Java Interview questions (1)
- Hibernate (1)
- Hibernate Interview questions (1)
- Hibernate Interview questions 1 (1)
- Hibernate Interview questions 2 (1)
- Hibernate Interview questions 3 (1)
- Hibernate Vs. iBatis? (1)
- https (2)
- Import Certificate (1)
- Java Web development interview questions (1)
- JavaInterviewQuestions (1)
- JavaScriptAJAXinterview (1)
- jdbc connection (1)
- JDBC Questions 1 (1)
- JDBC Questions 2 (1)
- JSP interview questions (1)
- Junit (5)
- links (1)
- Move a Certificate (1)
- Multithreading (1)
- MXML (1)
- private key (1)
- public key (1)
- Running multiple Tomcat instances on one server (1)
- SAX (1)
- SCHEMA (1)
- Secure Socket Layer (1)
- Servlet Questions 1 (1)
- Servlet Questions 2 (1)
- Servlet Questions 3 (1)
- ShellScriptingquestions (1)
- Simple Java Questions (1)
- Singleton Design Pattern (1)
- siteminder sso netegrity (1)
- SSL (3)
- StringBuffer versus String (1)
- Third Normal Form (1)
- Unix (1)
- What is connection pooling? (1)
- What's the difference between "PreparedStatement" and "Statement"? (1)
- What's the differences between object and object references? (1)
- XML (1)
- XML Questions 1 (1)
- XML Questions 2 (1)
1 comment:
most useful information, the post shared was very nice.
Full Stack Training in Chennai | Certification | Online Training Course | Full Stack Training in Bangalore | Certification | Online Training Course | Full Stack Training in Hyderabad | Certification | Online Training Course | Full Stack Training in Pune | Certification | Online Training Course | Full Stack Training | Certification | Full Stack Online Training Course
Post a Comment