Skip to main content

Java J2EE Interview Questions and Answers - Part 6

  1. What are the types of statements in JDBC?- Statement: to be used createStatement() method for executing single SQL statement PreparedStatement — To be used preparedStatement() method for executing same SQL statement over and over. CallableStatement — To be used prepareCall() method for multiple SQL statements over and over.
  2. What is stored procedure?- Stored procedure is a group of SQL statements that forms a logical unit and performs a particular task. Stored Procedures are used to encapsulate a set of operations or queries to execute on database. Stored procedures can be compiled and executed with different parameters and results and may have any combination of input/output parameters.
  3. How to create and call stored procedures?- To create stored procedures: Create procedure procedurename (specify in, out and in out parameters) BEGIN Any multiple SQL statement; END; To call stored procedures: CallableStatement csmt = con. prepareCall(”{call procedure name(?,?)}”); csmt. registerOutParameter(column no. , data type); csmt. setInt(column no. , column name) csmt. execute();
  1. What is servlet?- Servlets are modules that extend request/response-oriented servers, such as java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company’s order database.
  2. What are the classes and interfaces for servlets?- There are two packages in servlets and they are javax. servlet and
  3. What is the difference between an applet and a servlet?- a) Servlets are to servers what applets are to browsers. b) Applets must have graphical user interfaces whereas servlets have no graphical user interfaces.
  1. What is the difference between doPost and doGet methods?- a) doGet() method is used to get information, while doPost() method is used for posting information. b) doGet() requests can’t send large amount of information and is limited to 240-255 characters. However, doPost()requests passes all of its data, of unlimited length. c) A doGet() request is appended to the request URL in a query string and this allows the exchange is visible to the client, whereas a doPost() request passes directly over the socket connection as part of its HTTP request body and the exchange are invisible to the client.
  2. What is the life cycle of a servlet?- Each Servlet has the same life cycle: a) A server loads and initializes the servlet by init () method. b) The servlet handles zero or more client’s requests through service() method. c) The server removes the servlet through destroy() method.
  3. Who is loading the init() method of servlet?- Web server
  1. What are the different servers available for developing and deploying Servlets?- a) Java Web Server b) JRun g) Apache Server h) Netscape Information Server i) Web Logic
  2. How many ways can we track client and what are they?- The servlet API provides two ways to track client state and they are: a) Using Session tracking and b) Using Cookies.
  3. What is session tracking and how do you track a user session in servlets?- Session tracking is a mechanism that servlets use to maintain state about a series requests from the same user across some period of time. The methods used for session tracking are: a) User Authentication - occurs when a web server restricts access to some of its resources to only those clients that log in using a recognized username and password. b) Hidden form fields - fields are added to an HTML form that are not displayed in the client’s browser. When the form containing the fields is submitted, the fields are sent back to the server. c) URL rewriting - every URL that the user clicks on is dynamically modified or rewritten to include extra information. The extra information can be in the form of extra path information, added parameters or some custom, server-specific URL change. d) Cookies - a bit of information that is sent by a web server to a browser and which can later be read back from that browser. e) HttpSession- places a limit on the number of sessions that can exist in memory. This limit is set in the session. maxresidents property.
  1. What is Server-Side Includes (SSI)?- Server-Side Includes allows embedding servlets within HTML pages using a special servlet tag. In many servlets that support servlets, a page can be processed by the server to include output from servlets at certain points inside the HTML page. This is accomplished using a special internal SSINCLUDE, which processes the servlet tags. SSINCLUDE servlet will be invoked whenever a file with an. shtml extension is requested. So HTML files that include server-side includes must be stored with an . shtml extension.
  2. What are cookies and how will you use them?- Cookies are a mechanism that a servlet uses to have a client hold a small amount of state-information associated with the user. a) Create a cookie with the Cookie constructor: public Cookie(String name, String value) b) A servlet can send a cookie to the client by passing a Cookie object to the addCookie() method of HttpServletResponse: public void HttpServletResponse. addCookie(Cookie cookie) c) A servlet retrieves cookies by calling the getCookies() method of HttpServletRequest: public Cookie[ ] HttpServletRequest. getCookie().
  3. Is it possible to communicate from an applet to servlet and how many ways and how?- Yes, there are three ways to communicate from an applet to servlet and they are: a) HTTP Communication(Text-based and object-based) b) Socket Communication c) RMI Communication

Comments

Popular Posts

DOT NET Interview Questions with Answers

When not to use Design Patterns?Do not use design patterns in any of the following situations.• When the software being designed would not change with time.• When the requirements of the source code of the application are unique.If any of the above applies in the current software design, there is no need to apply design patterns in the current design and increase unnecessary complexity in the design.When to use Design Patterns?Design Patterns are particularly useful in one of the following scenarios.• When the software application would change in due course of time.• When the application contains source code that involves object creation and event notification.Benefits of Design Patterns:The following are some of the major advantages of using Design Patterns in software development.• Flexibility• Adaptability to change• ReusabilityWhat are Design Patterns?A Design Pattern essentially consists of a problem in a software design and a solution to the same. In Design Patterns each pattern…

Use Address bar effectively - Easy address bar commands

You are already familiar with quite a few browser address bar shortcuts. For instance, type some text in the address bar of your browser (e.g. apple), press Ctrl + Enter and the browser will automatically send you to the corresponding .com website (in this case, www.apple.com) Or type in some complex search query (e.g., site:firefox.com internet explorer) in the address bar, hit go and the browser will show results from your default search engine*. The address bar of Google Chrome is even smarter as it can offer live suggestions while you are typing the search query.
Other than these built-in shortcuts, you may also want to know about a couple of URL hacks (a better term would be "address bar commands") that let you do stuff from the address bar itself  – they are pretty easy to remember and don't require you to install any bookmarklets or add-ons (so you can use them on any computer and even some mobile phones).

1. Download videos from Youtube with URL Change easily – If …

Free Softwares , freewares : 16 July 09

Recover Files

Recover Files can undelete/recover deleted files. Its features
include: recovers files after deletion in the Recycle Bin, files
deleted from a network share, DOS command prompt, Shift+Delete is
used, when Move or Cut command are used, from Hard drives, floppy
disks, external USB disk / flash drivers, deleted by other
applications or by viruses, and much more; Supports FAT16, FAT32, NTFS
and NTFS 5 file systems; Performs non-destructive and read-only scan
and file recovery; Restores original create and modified file dates;
Supports unicode and non-alphabet languages; Filters files by name,
extension, folder and file type.

The 1.16 MB Recover Files, version 3.10 (July 06, 20079) for Windows
Vista, Windows 2003, Windows XP, Windows 2000, Windows 95, 98, ME and
Windows NT 4 can be downloaded at http://www.UndeleteUnerase.com/download.html

Exl-Plan Free

Exl-Plan Free is an Excel-based business finance planner, can be used
either for immediate or later projections, by both s…

IBM Weekend Hiring for Java Professionals - 24th Nov 2012

Urgent Hiring Requirements for Java Professionals

Dear IBMer,

We solicit your help in bringing your friends and family members who qualify to apply for the given positions only.
We need your help & support to close the below positions. Please refer us good profiles like yours only & help us in closing the requirement.

Requirements Summary:

Please adhere to the demand:--

Skill -Java/J2EE with Spring/Hibernate/Struts
Exp Range - 3 to 4 yrs only (Please do not refer above 4yrs and below 3yrs as we will not be able to call them for the interview)
Joining Location - Pune/Kolkata/Chennai/Hyderabad

Interview Location - Bangalore/Chennai/Kolkata
Interview Date - 24th Nov 2012 (Only)


Important Note:Please refer to the above demand and share the profiles only for them to get the Interview Process started Immediately.Looking forward to your support to help us close these demand through Employee Referral only.16 years of Education is mandatory.Please check with the candidates that whether they have …

PDFzen: Simple document sharing.

PDFzen

You don't need to create an account to use PDFzen. Just upload your document and start editing. When you are finished, you can download the document as a PDF or get the link to share via email or social media. HTML5 PDF editing means PDFzen works right from the browser of your iPhone or iPad.

Features

Share
Easily share your document in many different ways.

Sign or Draw
Sign or draw anywhere on a document with the draw tool.

Type
Use the type tool to type on any part of a document.

Highlight
Point out important areas.

File Formats
.pdf, .doc, .docx, .xls, .xlx, .odt, .rtf)

Mobile-friendly
View and edit your PDFs on your PC, your phone, or your tablet.

Need to scan to PDF?
Use deskPDF Reader to scan your documents into PDF format, fill out forms, and easily share them with PDFzen integration.

Wallet_friendly

PDFzen will always be free to mark up, share and collaborate on documents. No strings attached, aver the developers

Check it out at https://pdfzen.c…

MobileComm Recruits Freshers

Freshers IT Job Opening at MobilecommExperience: 0 - 1 Years 

Location: Delhi/NCR

Education: 
UG - B.Tech/B.E. - Computers, Electrical, Electronics/Telecomunication, Instrumentation   
PG - Post Graduation Not Required 

Industry Type: Telcom/ISP

Functional Area:
IT-Support, Telecom, Hardware

Job Description: 


*GSM Fundamentals. *RF Planning & Optimization. *Transmission Planning & Optimization. *3G Technologies
Desired Candidate Profile

B.E./B.Tech E&C, Telecommunication, Computers, IT 0 to 1 Yrs. experience Willing to work in GSM Mobile Industry Willing to travel anywhere in India Willing to undergo Job Oriented Training on self support basis
Company Profile
MobileComm Technologies (India) Pvt. Ltd. is subsidiary of MobileComm Professionals, Inc. USA - MobileComm Professionals Inc. is an engineering services organization supporting telecom cellular operators and OEM's to design, deploy and manage wireless networks. MobileComm is ISO9001 certified organization offering comp…

Contact Form

Name

Email *

Message *