GeekInterview.com
Answered Questions

Scrollable_sensitive resultset

Asked By: khadarzone | Asked On: Apr 11th, 2008

Explain with examples for scrollable_sensitive resultset?

Answered by: mohanpatil on: May 15th, 2010

If resultset is sensitive then using stmt.refreshRow() method, you get the updated data which is recently changed by other client in the database.

Answered by: pradeepkmr18 on: Jun 27th, 2008

Scrollable means the cursor can move forward or backward and Sensitive meansex:If u are using SCROLLABLE_SENSITIVE resultset i.e u have opened the result setIf any other person makes changes like inse...

Call stored procedure in Java using callablestatements

Asked By: khadarzone | Asked On: Apr 11th, 2008

How can we call a stored procedure in Java using callablestatements? Give an example.

Answered by: lilliput2009 on: Nov 18th, 2009

import java.sql.CallableStatement;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;public class Sample{    public static void main(String[] args) &...

Answered by: pradeepkmr18 on: Jul 3rd, 2008


first get connection object
Connection con=DriverManager.getConnection(); (we can get by datasourse object also)
CallableStatement cstmt=con.prepareCall("{ call procedurename(?,?,?,?) }");

cstmt.setString(1,ID);
cstmt.setString(2,name);
....
ucount=cstmt.executeUpdate();

What is the different between _jspinit() and JSPinit()?

Asked By: d | Asked On: Nov 21st, 2007

Answered by: Vikas.Barsainya on: May 15th, 2010

Here is the skeleton of HttpJspBase class which is developed by tomcat developers.You might have a clue from this for all related answers. public abstract class HttpJspBase extends HttpServlet { ...

Answered by: shunmugababu on: Nov 26th, 2008

You cannot override _jspInit() whereas it is possible to override jspInit().

What is the actual purpose of using framework in realtime applications?

Asked By: kiranmaye | Asked On: Oct 11th, 2007

Answered by: mani.sivapuram on: Feb 15th, 2011

To reduce the developer effort we will go for the framework. Because in the old projects are implemented with some pattern and they find some sort of common problems so all the common problems are sol...

Answered by: g lingareddy on: Jul 3rd, 2010

Frame work automatically generate ActionServlet which is reduce the work of programmer. In traditional Servlet/JSP project programmer explicitly write Actionservlet

Why main() is not written in servlets programs?

Asked By: m.pavankumar | Asked On: Jul 26th, 2007

Answered by: vinayroz on: Aug 6th, 2008

Simple java programs are stand alone application and in this case we have to specify the starting point of execution for interpreter but servlets are server side tech and based on client request. Whe...

Answered by: mullangi13 on: Jul 23rd, 2008

Servlet will execute in webcontainer only. The life cycle of servlet is init(ServletConfig cg)service(ServletRequest,ServletResponse)destroy()So our webcontainer will call these methods only to execut...

What is the difference between http session and application session?

Asked By: shireesha | Asked On: Jul 19th, 2007

Answered by: bh2008 on: Aug 6th, 2008

HttpSession is logged is user specific. You can't access across the users.But application session (static) variables can be accessed across the users in the application.HttpSession variable life t...

Answered by: vinayroz on: Aug 6th, 2008

There is nothing like application session. In simple words we can take it as how we manage session in our application, so that is by HttpSession interface or by Url rewriting, hidden fields and cookies.

Where do you declare methods in JSP?

Asked By: naggeek | Asked On: Jul 16th, 2007

Answered by: pradeepkmr18 on: Jun 11th, 2008

In jsp declarations we can declare methods and variables<%!      int x;             public void tone() ...

Answered by: bharaniprasanth on: Mar 10th, 2008

Declarations go outside the service method of converted servlet so ...just delcaring variables...declare it like

<%! public void add(int a , int b)
{
    //body
}
%>

Where do you use exception implicit object in JSP?

Asked By: naggeek | Asked On: Jul 14th, 2007

Answered by: pradeepkmr18 on: Jun 11th, 2008

To display the type of exception

one.jsp

<%@ page errorPage="errorpage.jsp" %>
<% ----- %>

errorpage.jsp

<%@ page isErrorPage="true" %>
<% out.println(exception.getMessage()); %>

Answered by: vishnu.baji on: Feb 28th, 2008

We use it in error pages. We will have details of exception thrown from the previous page and we can handle actions based on the type of exception...

What is the main difference between action and dispatchaction classes

Asked By: Gangadhar P | Asked On: May 22nd, 2007

Answered by: pradeepkmr18 on: Jun 8th, 2008

If our Form has single function we have to go for action class but if our Form has to perform multiple functions then we have go for dispatch action.In struts config we have to provide parameter="...

Answered by: ckanth99 on: Mar 26th, 2008

An Action class is part of the controller which is used as an adaptor between the web tier and business tier.  An Action class is invoked by ActionServlet to perform an operation depending on the...

How do you manage all the request from your servlet? How it will be thread safe?

Asked By: atulkumar81 | Asked On: May 17th, 2007

Answered by: pradeepkmr18 on: Jun 11th, 2008

by implementing single thread model we can make thread safe .Due to this it will create one instance per thread or request

Answered by: bharaniprasanth on: Mar 11th, 2008

Servlets by default are not thread safe...But we need to take many steps to make them thread safe...

like using synchronized blocks,varaibles...etc...

How do you write custom tags like tag library

Asked By: ahalya | Asked On: Apr 26th, 2007

Answered by: pradeepkmr18 on: Jun 11th, 2008

To develop acustom tag1)we need to write our own .tld2)for every tag in the tld we have to write tag handler classes (Generally .jar files contains the taghandler classes)using doStartTag(),doAfterBod...

Answered by: bharaniprasanth on: Mar 11th, 2008

Four elements are needed

1. Tag class.
2. TLD descriptor
3. Inclusion of the prefix elements line in Beginning of JSP
4. Using the tags with a start and end tag elements...

Not to forget mention the tag library in the web.xml

Is action class is servlet or not ? If yes why ?

Asked By: enjoy | Asked On: Apr 2nd, 2007

Answered by: PS on: May 17th, 2013

No.. Action class is not a servlet. The only servlet class in plain struts framework (without spring etc.) is ActionServlet.

Answered by: GK on: Oct 7th, 2012

No. the Struts action class neither extend any class nor implement any interface. More over it has defined one method getServlet() .. discribes which servlet it associated with it. This will be Acti...

When jasper exceptions will occurs and why?

Asked By: gothlururaaja | Asked On: Feb 13th, 2007

Answered by: pradeepkmr18 on: Jun 12th, 2008

If there is any problem during compilation servlet(converted jsp to servlet) Generally this jasper exception will comejava.lang.Object | +--java.lang.Throwable | +--java.lang.Excep...

Answered by: SURJYA SAHOO on: Feb 22nd, 2007

Generally jsper Exception comes, if the compilation is not successful . 

How to add multiple .Property files in sturts-config.XML file..?

Asked By: Rafi | Asked On: Oct 17th, 2006

If any one knows the answer plz add..

Answered by: Vani.Y on: Aug 14th, 2011

By assigning a key attribute to each property file,while configuring in struts configuration file.

Answered by: VIRAT REDDY on: Jul 30th, 2011

By configuring in struts config file as follows:

Code
  1. <struts-config>
  2.     <form-beans>
  3.                -------------------------
  4.                 ----------------------------
  5. </form-beans>
  6. <action-mappings>
  7.     --------------------
  8.        ----------------------
  9. </action-mappings>
  10. <message-resources parameter="name of prop file1"/>
  11. <message-resources parameter="name of prop file2"/>
  12. ------------------------
  13. --------------
  14. -
  15. </struts-config>

What is the difference between forwardaction and includeaction?

Asked By: Rajeshwar | Asked On: Sep 12th, 2006

Answered by: pradeepkmr18 on: Jun 9th, 2008

Difference in output.

ex: if we forward from one.jsp to two.jsp the contents of only two.jsp will be generated .
     if we include two.jsp in one.jsp the contents of both the jsp's will be generated

Answered by: subhashini on: Sep 21st, 2006

1.forward action is similar to <jsp:forward> and include action is similar to <jsp:include> in jsp2. forward action is used to forward to control from one page to another page or action.&n...

Which of the following allows phantom read in JDBC, connection class?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) transaction_read_uncommittedb) transaction_read_ committedc) transaction_serializabled) transaction_repeatable_read.Explanation: a phantom read is where one transaction reads all rows that satisfy a where condition, a second transaction inserts a row that satisfies that where condition, and the first...

Answered by: pradeepkmr18 on: Jul 3rd, 2008

These will allow phanthom read
Read_uncommited
Read_commited
Repeatable_read

Answered by: charankk on: May 2nd, 2008

Guys ...do not give any wrong answers,If you know very well then answer.

Here to avoid the phatom read ,we will go for TRANSATION_SERIALIZABLE ,Which blocks the records in row level .But this affects performance drastically .
Hence the answer is  "C "

Which is the best driver among the 4 JDBC drivers?How can we load that driver?

Asked By: siddu | Asked On: Oct 17th, 2005

Answered by: pradeepkmr18 on: Jul 3rd, 2008

We have to select the driver based on reqirement .

Answered by: arun kumar on: Dec 7th, 2005

hi, there, the order in which the drivers can be used is 4213, :) bye

What is the actual difference between mvc and mvc model2

Asked By: Chennaiah | Asked On: Oct 16th, 2005

Answered by: pradeepkmr18 on: Jul 10th, 2008

MVC1A Model 1 application control is decentralized, because the current page being displayed determines the next page to display. In addition, each JSP page or servlet processes its own inputs (parame...

Answered by: ashishin on: May 12th, 2008

Hi,MVC is a design pattern. It contains two models. MVC Model1, MVC Model2 .Struts framework implements MVC Design Pattern. Struts can implement Model 1 and Model 2. Model 2 most properly describes th...

What do you like most with ant

Asked By: Interview Candidate | Asked On: Aug 23rd, 2005

Answered by: koti.tirumala on: Jan 5th, 2012

Memory leaks are caused by writting poor program design where Object reference are long lived and the garbage collector is unable to reclaim those objects..

Answered by: javagek on: Aug 27th, 2011

I guess the best thing about ANT is that it's easier to learn and works cross platform and cross programming language - which is a real bonus.

What is action class. What are the methods in action class

Asked By: Interview Candidate | Asked On: Jul 11th, 2005

Answered by: devabscmca on: Jul 31st, 2010

Action Class acts as a controller b/n user data and business logic.It is having execte() method using this we are calling business logic.Execute method syntax :-public ActionForward execute(ActionMapp...

Answered by: sangamesh32 on: Aug 5th, 2008

This is the class from which business logic of stuts
begins,which contains execute method ..This class contains all
deployment information of particualar Action object.
This class determines where the result must send once its
 processing is complete as a ActionForward Object.

What we will define in struts-config.XML file. And explain their purpose

Asked By: Interview Candidate | Asked On: May 8th, 2005

Answered by: pradeepkmr18 on: Jun 7th, 2008

These are the tags we can define

<data-sources/>
<form- beans/>,
<global- forwards/>,
,
,
<message-resources>,
<switch-action>
<plug-in/> 

Answered by: Sony V George on: Apr 4th, 2007

We can say like soul of struts is Struts-config.xml.The server will read struts-config.xml once only on the time of server starting. so server will know how and where to re-route to each and every req...

What are the various struts tag libraries

Asked By: Interview Candidate | Asked On: Aug 23rd, 2005

Answered by: pradeepkmr18 on: Jun 7th, 2008

There are only five struts tag libraries

1)Bean tag lib

2)Html tag lib

3)logic tag lib

4)nested tag lib

5)Template tag lib

others are JSTL tag libraries(ex: c.tld,sql.tld,fmt.tld)

Answered by: nirav on: May 24th, 2007

Agree with Amzad. in struts as on version 1.2 we have only six tag libs.

What is struts

Asked By: Interview Candidate | Asked On: Sep 7th, 2005

Answered by asreeni on 2005-04-08 03:24:40: the core of the struts framework is a flexible control layer based on standard technologies like Java servlets, Javabeans, resourcebundles, and XML, as well as various jakarta commons packages. Struts encourages application architectures based on the model...

Answered by: vana_mlk on: Jul 2nd, 2010

I worked with struts it completely MVC base. I used SHINE pattern. It is a MVC base too. Actually it is an open source project to implement J2EE application.

Answered by: satyanandr on: Sep 11th, 2009

Apache Struts is a frame work build on several design patterns like MVC, FrontController, Factory, Singleton etc., It is most suitable framework to develop web based applications, because  this f...

What is stored procedure. How do you create stored procedure

Asked By: Interview Candidate | Asked On: Sep 7th, 2005

Answered by: pradeepkmr18 on: Jul 3rd, 2008

Stored procedure contains set of sQL Statements thar are executed in the database by the sql stament processor.

code:

DECLARE
 NUM1 NUMBER:=10;
 NUM2 NUMBER:=20;
BEGIN
    DBMS_OUTPUT.PUT_LINE('sum:'||To_Char(NUM1+NUM2,'999.99'));
END;

Answered by: Hameed on: Oct 12th, 2005

Stored Procedure is an object design with business logic and stored in the database .Since it stays in the database ,the execution of the business logic is more faster...

What is the purpose of setautocommit( )

Asked By: Interview Candidate | Asked On: Sep 9th, 2005

Answered by: raghuprasad on: Nov 23rd, 2008

setAutoCommit(false); disables the default commit mode. we need to explicitly commit the transaction.

Answered by: dkiranmai on: Nov 21st, 2008

If a connection is in auto-commit mode, then all its SQL statements are run and commited as individual transactions. Otherwise, its SQL statements are grouped into transactions that are ended by a cal...

Interview Question

 Ask Interview Question?

 

Career Counselling

 Have Career Question?

 Ask Chandra

 Ask Only Career questions.

Follow us: