81. How you will make available any message resources definations file to the struts famework environment.

Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through <message-resources /> tag.Example:<message-resources parameter=”MessageResources” />

80. What is Jakarta Struts FrameWork

Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.

79. What are the core classes of the Struts Frame Work

Core classes of Struts Framework are ActionForm, Action, ActionMapping, ActionForward, ActionServlet etc.

78. What are the components of Struts

Struts is based on the MVC design pattern. Struts components can be categories into Model, View and Controller. Model: Components like business logic / business processes and data are the part of Model. View: JSP, HTML etc. are part of View Controller: Action Servlet of Struts is part of Controller components which works as front [...]

77. What are differences between <bean:message> and <bean:write>

<bean:message>: This tag is used to output locale-specific text (from the properties files) from a MessageResources bundle.  <bean:message key=”label.search.name”/> <bean:write>: This tag is used to output property values from a bean. <bean:write> is a commonly used tag which enables the programmers to easily present the data. <bean:write name=”student” property=”age”/>

76. What is LookupDispatchAction

An abstract Action that dispatches to the subclass mapped execute method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the parameter property of the corresponding ActionMapping. (Ref. http://struts.apache.org/1.2.7/api/org/apache/struts/actions/LookupDispatchAction.html).

75. What is struts flow

Struts Flow is a port of Cocoon’s Control Flow to Struts to allow complex workflow, like multi-form wizards, to be easily implemented using continuations-capable JavaScript. It provides the ability to describe the order of Web pages that have to be sent to the client, at any given point in time in an application. The code [...]

74. How to 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”                     type=”mybank.account.DuplicateUserException”/> b) Programmatic Exception Handling: Here you can use try{}catch{} block to handle the exception.

73. What is the Action Errors and Action Message?

ActionMessage: A class that encapsulates messages. Messages can be either global or they are specific to a particular bean property.Each individual message is described by an ActionMessage object, which contains a message key (to be looked up in an appropriate message resources database), and up to four placeholder arguments used for parametric substitution in the [...]

72. How to setup struts to use multiple configuration files.

Struts can use multiple configuration files. Here is the configuration example:<servlet>        <servlet-name>banking</servlet-name>        <servlet-class>org.apache.struts.action.ActionServlet        </servlet-class>        <init-param>        <param-name>config</param-name>        <param-value>/WEB-INF/struts-config.xml,                /WEB-INF/struts-authentication.xml,                /WEB-INF/struts-help.xml           </param-value>    </init-param>

71. What we will define in struts-config.xml file.

The main control file in the Struts framework is the struts-config.xml XML file, where action mappings are specified. This file’s structure is described by the struts-config DTD file, which is defined at http://jakarta.apache.org/struts/. A copy of the DTD can be found on the /docs/dtds subdirectory of the framework’s installation root directory. The top-level element is [...]

70. What is the request processor in struts and how it works

The RequestProcessor Class is the actual place where the request processing takes place in a Struts controller environment. When the request object first reaches the actionservlet class then it invokes the process method of the underlying RequestProcessor Class. This process method then looks into the struts-config.xml file and tries to locate the name of the [...]

69. What is struts actions and action mappings.

A Struts action is an instance of a subclass of an Action class, which implements a portion of a Web application and whose perform or execute method returns a forward. An action can perform tasks such as validating a user name and password. An action mapping is a configuration file entry that, in general, associates [...]

68. What are the various struts tag libraries.

Struts is very rich framework and it provides very good and user friendly way to develop web application forms. Struts provide many tag libraries to ease the development of web applications. These tag libraries are: Bean tag library – Tags for accessing JavaBeans and their properties. HTML tag library – Tags to output standard HTML, [...]

67. What is the difference between perform() and execute()

Perform method is the method which was deprecated in the Struts Version 1.1.  In Struts 1.x, Action.perform() is the method called by the ActionServlet. This is typically where your business logic resides, or at least the flow control to your JavaBeans and EJBs that handle your business logic. As we already mentioned, to support declarative [...]

66.How to enable front-end validation based on the xml in validation.xml

The <html:javascript> tag to allow front-end validation based on the xml in validation.xml. For  example the code: <html:javascript  formName=”logonForm”                          dynamicJavascript=”true”                          staticJavascript=”true”  />  generates the client side java script for the form “logonForm” as defined in the  validation.xml file. The <html:javascript> when added in the jsp file generates the client site validation script. Following [...]

65. What is the Struts Validator Framework

Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be [...]

64. What is Action Class

The Action is part of the controller. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to  Subclass and overwrite the execute()  method. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. There should be no database interactions in [...]

63. Explain ActionFrom Class and its life cycle.

An ActionForm is a java bean that extends org.apache.struts.action.ActionForm, ActionForm maintain the session state of web application. All data submitted by the user are sent corresponding ActionForm  ActionForm class is used to capture user-input data from an HTML form and transfer it to the Action Class. ActionForm plays the role of Transport Vehicle between the presentation Tire [...]

62. What are new features of Struts 1.1

The new features added to Struts 1.1 are 1. RequestProcessor class 2. Method perform() replaced by execute() in Struts base Action Class 3. Changes to web.xml and struts-config.xml4.Declarative exception handling5.Dynamic ActionForms6.Plug-ins7.Multiple Application Modules8.Nested Tags9.The Struts Validator10.Change to the ORO package11.Change to Commons logging12.Removal of Admin actions13. Deprecation of the GenericDataSource.

61. What is a Action Servlet

public class ActionServlet extends javax.servlet.http.HttpServlet ActionServlet provides the “controller” in the Model-View-Controller (MVC) design pattern for web applications that is commonly known as “Model 2″. The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the [...]

60. What is the difference between TYPE_SCROLL_INSENSITIVE and TYPE_SCROLL_SENSITIVE

You will get a scrollable ResultSet object if you specify one of these ResultSet constants.The difference between the two has to do with whether a result set reflects changes that are made to it while it is open and whether certain methods can be called to detect these changes. Generally speaking, a result set that [...]

59. How to make updates to updatable result sets.

Another new feature in the JDBC 2.0 API is the ability to update rows in a result set using methods in the Java programming language rather than having to send an SQL command. But before you can take advantage of this capability, you need to create a ResultSet object that is updatable. In order to [...]

58. 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 [...]

57. How can you load the driver.

Driver can be loaded in 2 ways : 1. class.forName(“sun.jdbc.odbc.JdbcOdbc”); 2. Driver d=new Driver(“sun.jdbc.odbc.JdbcOdbc”);    DriverManager.registerDriver(d); vendar specific one: Driver d=new oracle.driver.oracleDriver();

56. How can you retrieve data from the ResultSet

Example: Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT COF_NAME, PRICE FROM COFFEES”); while (rs .next() ) { //Iam assuming there are 3 columns in the table. System.out.println ( rs.getString(1)); System.out.println(rs.getString(2)); System.out.println(rs.getString(3)); } //don’t forget to close the resultset, statement & connection rs.close(); //First  stmt.close(); //Second con.close(); //Last  System.out.println(“You are done”); 

55. How do you implement Connection Pooling

Connection Pooling can be implemented by the following way.   A javax.sql.ConnectionPoolDataSource interface that serves as a resource manager connection factory for pooled java.sql.Connection objects. Each database vendors provide the implementation for that interface.  For example, the oracle vendors implementation is as follows: oracle.jdbc.pool.oracleConnectionPoolDataSource Class.  A javax.sql.PooledConnection interface encapsulates the physical connection for the database. Again, the [...]

54. How to call a stored procedure from JDBC

Stored Procedures can be called in java by using the prepareCall() method which returns a CallableStatement object. CallableStatement cs = con.prepareCall(“{call Procedure_name}”); ResultSet rs = cs.executeQuery();

53. What are the three statements in JDBC & difference between them.

1.Statement which is used to run simple sql statements like select and update 2. PrepareStatment is used to run Pre compiled sql.  3. CallableStatement is used to execute the stored procedures.

52. What is the difference between ResultSet and RowSet

A ResultSet maintains a connection to a database and because of that it can’t be serialized and also we cant pass the Resultset object from one class to other class across the network. RowSet is a disconnected, serializable version of a JDBC ResultSet and also the RowSet extends the ResultSet interface so it has all [...]

51. What is a transaction.

To emulate a business transaction, a program may need to perform several steps. A financial program, for example, might transfer funds from a checking account to a savings account with the steps listed in the following pseudocode: begin transaction debit checking account credit savings account update history log commit transaction Either all three of these [...]

50. What is the purpose of setAutoCommit()

Autocommit behavior    The JDBC specification requires that, by default, a COMMIT is performed after each data modification statement. Currently, the server-side JDBC behavior is to commit. You can control this behavior using a statement such as the following: conn.setAutoCommit( false ) ; where conn is the current connection object. Connection defaults    From server-side JDBC, only the first [...]

49. What is the difference between statement and prepared statment?

Prepared Statement is Pre-compiled class , but Statement is not. So in PreparedStatement the execution will be faster. Actually when u submit a simple statement to the databse, at first the DBMS parses it and sends it back with the result, so again when u send the same statement again the DBMS server parses it [...]

48. What is a savepoint.

Save point is a feature using which we can save  status of the transaction to a perticular extent.so that if anytime we have lost a transaction we can get it back using save point.

47. What is the difference between ResultSetMetaData and DatabaseMetaData

ResultSetMetaData You can interrogate JDBC for detailed information about a query’s result set using a ResultSetMetaData object. ResultSetMetaData is a class that is used to find information about the ResultSet returned from a executeQuery call. It contains information about the number of columns, the types of data they contain, the names of the columns, and [...]

46. What do you mean by batch update

The JDBC drivers that support JDBC 2.0 and above support batch updates. With batch updates, instead of updating rows of a  table one at a time, you can direct JDBC to execute a group of updates at the same time. Statements that can be included in the same batch of updates are known as batchable [...]

45. What is the difference between local and global transaction.

A transaction is atomic unit of Work.The tasks which are made into the transaction act as a unit which can be executed successfully all,or if at least one task fails to its promise ,then the effect of all the tasks are to be rollbacked.Thus transaction is committed or rolled backed. Transactions can be divided into [...]

Follow

Get every new post delivered to your Inbox.