Scrollable_sensitive resultset
Explain with examples for scrollable_sensitive resultset?
Call stored procedure in Java using callablestatements
How can we call a stored procedure in Java using callablestatements? Give an example.
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) &...
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()?
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 { ...
You cannot override _jspInit() whereas it is possible to override jspInit().
What is the actual purpose of using framework in realtime applications?
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...
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?
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...
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?
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...
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?
In jsp declarations we can declare methods and variables<%! int x; public void tone() ...
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?
To display the type of exception
one.jsp
<%@ page errorPage="errorpage.jsp" %>
<% ----- %>
errorpage.jsp
<%@ page isErrorPage="true" %>
<% out.println(exception.getMessage()); %>
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
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="...
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?
by implementing single thread model we can make thread safe .Due to this it will create one instance per thread or request
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
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...
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 ?
No.. Action class is not a servlet. The only servlet class in plain struts framework (without spring etc.) is ActionServlet.
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?
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...
Generally jsper Exception comes, if the compilation is not successful .
How to add multiple .Property files in sturts-config.XML file..?
If any one knows the answer plz add..
By assigning a key attribute to each property file,while configuring in struts configuration file.
By configuring in struts config file as follows:
What is the difference between forwardaction and includeaction?
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
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?
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...
These will allow phanthom read
Read_uncommited
Read_commited
Repeatable_read
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?
We have to select the driver based on reqirement .
hi, there, the order in which the drivers can be used is 4213, :) bye
What is the actual difference between mvc and mvc model2
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...
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
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..
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
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...
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
These are the tags we can define
<data-sources/>
<form- beans/>,
<global- forwards/>,
<message-resources>,
<switch-action>
<plug-in/>
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
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)
Agree with Amzad. in struts as on version 1.2 we have only six tag libs.
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...
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.
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
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;
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( )
setAutoCommit(false); disables the default commit mode. we need to explicitly commit the transaction.
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...
If resultset is sensitive then using stmt.refreshRow() method, you get the updated data which is recently changed by other client in the database.
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...