Tuesday, August 31, 2010
Struts FAQs
< Pre 1 2 3 4 Q24.What are the important tags of struts-config.xml ? <struts-config> <!-- ========== Form Bean Definitions ============ -->
<form-beans>
<form-bean name="login" type=" LoginForm" /> </form-beans> <!-- ========== Global Forward Definitions ========= --> <global-forwards> </global-forwards> <!-- ========== Action Mapping Definitions ======== --> <action-mappings> <action ...
Struts FAQs
< Pre 1 2 3 4 Next >Q13. How you will handle exceptions in Struts?In Struts you can handle the exceptions in two ways:
a) Declarative Exception Handling: You can either define global exception handling tags in your struts-config.xml or define the exception handling tags within
<action>..</action> tag.
Example:
<exception
key="database.error.duplicate"
path="/UserExists.jsp"
...
Struts FAQs
< Pre 1 2 3 4 Next > Q12. What is RequestProcessor?
The controller is responsible for intercepting and translating user input into actions to be performed by the model. The controller is responsible for selecting the next view based on user input and the outcome of model operations. The Controller receives the request from the browser, invoke a business operation and coordinating the view to return to the client.The controller is implemented by a java servlet, this servlet is centralized...
Struts FAQs
1 2 3 4 Next >Q 1. What is MVC? Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data.
Model: The model contains the core of the application's functionality. The model enca psulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.
View: The view provides the presentation of the model. It is the look of the application. The view can access...
Collections FAQs
Q51. What is TreeMap?
TreeMap can be used to store a group of objects as key-value pairs where all the entries are arranged according to some sorting order of keys.
The underlying data structure is RED-BLACK Tree
Duplicates keys are not allowed but values can be duplicated.
Insertion order is not preserved because insertion is based on some sorting order
If we are depending on Natural sorting order then keys should be homogeneous(violation leads to ClassCastException) but values need not homogeneous
In case of customized...
Collections FAQs
Q41. What is difference between HashSet and TreeSet?
HashSet TreeSet
1The underlying data structure is Hashtable 1The underlying data structure is balanced tree
2Heterogeneous objects are allowed 2 Heterogeneous objects are not allowed bydefalut
3Insertion order is not preserved and it is based on hashcode of the objects 3 Insertion order is not preserved and all the objects are inserted according to some sorting order.
...
Collections FAQs
1 2 3 4 5 6 Next>Q31. Explain about HashSet class?The underlying data structure is Hashtable
null values are accepted
duplicates are not allowed
insertion order is based on hashcode of the object hence insertion order is not preserved
best suitable if frequent operation is search operations
HashSet class implements Serializable and Cloneable
it is implementation class for Set interface
heterogeneous objects are allowed
it is introduced in 1.2 version
Q32. If we are trying to insert duplicate values in Set what will...
Collections FAQs
Q21. What is difference between ArrayList and Vector?
ArrayList Vector
1. No method is synchronized in the ArrayList class 1. All methods in Vector are synchronized.
2. ArrayList object is not thread safe. 2. Vector is thread safe.
3. Relatively performance is high 3. Relatively performance is low
4. Introduced in 1.2 version and it is non legacy 4. Introduced in 1.0 version and it is legacy
Q22. How we can get synchronized version...
Collections FAQs
Q11. Explain about SortedSet interface?
It is child interface of Set interface. it can be used to represent a group of individual objects in to a single entity where All the objects are arranged in some sorting order (Can be natural sorting order or customizede).
Duplicates are not allowed.
Q12. Explain about NavigableSet ?
It is child interface of SortedSet and provides several utility methods for navigation purposesIt doesn’t allows duplicates ...
Collections FAQs
Q1. What are limitations of object Arrays?
The main limitations of Object arrays areThese are fixed in size ie once we created an array object there is no chance of increasing or decreasing size based on our requirement. Hence If we don’t know size in advance , arrays are not recommended to use
Arrays can hold only homogeneous elements.
There is no underlying data structure for arrays and hence no readymade method support for arrays. Hence for every requirement programmer has to...
Monday, August 30, 2010
JDBC FAQs
31: how to update the database through PreparedStatement object.
import java.sql.*;
public class PreparedUpdateEx
{
public static void main(String[] args)throws Exception
{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con = DriverManager.getConnection(“jdbc:odbc:nag”,”system”,”durga”);
PreparedStatement...