Ads 468x60px

Pages

Monday, 17 December 2012

IEEE 2012 Projects: Secured Mobile Messaging

IEEE 2012 Projects: Secured Mobile Messaging

Thursday, 26 July 2012

Hibernate interview questions



15. How can a whole class be mapped as immutable?
Mark the class as mutable="false". This specifies that instances of the class are (not) mutable. Immutable classes, may not be updated or deleted by the application. Default value is true.


16. What is the use of dynamic-insert and dynamic-update attributes in a class mapping?
Criteria is a simplified API for retrieving entities by composing Criterion objects. This is a very convenient approach for functionality like "search" screens where there is a variable number of conditions to be placed upon the result set.
  • dynamic-update (defaults to false): Specifies that UPDATE SQL should be generated at runtime and contain only those columns whose values have changed.
  • dynamic-insert (defaults to false): Specifies that INSERT SQL should be generated at runtime and contain only the columns whose values are not null. 
17. What do you mean by fetching strategy ?
A fetching strategy is the strategy Hibernate will use for retrieving associated objects if the application needs to navigate the association. Fetch strategies may be declared in the O/R mapping metadata, or over-ridden by a particular HQL or Criteria query. 

18. What are Callback interfaces?
Callback interfaces allow the application to receive a notification when something interesting happens to an object. For example, when an object is loaded, saved, or deleted. Hibernate applications don't need to implement these callbacks, but they're useful for implementing certain kinds of generic functionality.

19. What are the types of Hibernate instance states ?
Three types of instance states:
  • Transient -The instance is not associated with any persistence context.
  • Persistent -The instance is associated with a persistence context having identity value representing record of the table.This object maintains synchronization with Database table record.
  • Detached -The instance was associated with a persistence context which has been closed – currently not associated. 
By using various methods of Hibernate API we can change Hibernate pojo class object from one state to another state.
We can make Transient object as Persistent object. But we can't make Detached object and Persistent object as Transient object.

20. What is automatic dirty checking?
Automatic dirty checking is a feature that saves us the effort of explicitly asking Hibernate to update the database when we modify the state of an object inside a transaction.

21. What is the difference between updating record by calling update() and merge()?
Both methods are given to update the record.If given record is not available update() does not perform any default operation,but merge() inserts the new record into the Database by having the data of given Hibernate pojo class object.
By using update() we can't gather the persistent state base Hibernate pojo class object representing the updated record.
By using merge() this operation is possible.

Tuesday, 24 July 2012

Hibernate interview questions

10. What is the need for Hibernate xml mapping file?
Hibernate mapping file tells Hibernate which tables and columns to use to load and store objects.

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0"?>
 <!DOCTYPE hibernate-mapping PUBLIC
<hibernate-mapping>
 <class name="sample.MyPersistanceClass" table="MyPersitaceTable">
 <id name="id" column="MyPerId">
 <generator class="increment"/>
 </id>
 <property name="text" column="Persistance_message"/>
 <many-to-one name="nxtPer" cascade="all" column="NxtPerId"/>
 </class>
</hibernate-mapping>
Everything should be included undertag. This is the main tag for an xml mapping document.

11. What the Core interfaces are of hibernate framework?
There are many benefits from these. Out of which the following are the most important one.
  1. Session Interface – This is the primary interface used by hibernate applications. The instances of this interface are lightweight and are inexpensive to create and destroy. Hibernate sessions are not thread safe.
  2. SessionFactory Interface – This is a factory that delivers the session objects to hibernate application. Generally there will be a single SessionFactory for the whole application and it will be shared among all the application threads.
  3. Configuration Interface – This interface is used to configure and bootstrap hibernate. The instance of this interface is used by the application in order to specify the location of hibernate specific mapping documents.
  4. Transaction Interface – This is an optional interface but the above three interfaces are mandatory in each and every application. This interface abstracts the code from any kind of transaction implementations such as JDBC transaction, JTA transaction.
  5. Query and Criteria Interface – This interface allows the user to perform queries and also control the flow of the query execution.
12. What role does the Session interface play in Hibernate?
The Session interface is the primary interface used by Hibernate applications. It is a single-threaded, short-lived object representing a conversation between the application and the persistent store. It allows you to create query objects to retrieve persistent objects.

Session session = sessionFactory.openSession();
Session interface role:
  • Wraps a JDBC connection
  • Factory for Transaction
Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier.

13. What is the general flow of Hibernate communication with RDBMS?
The general flow of Hibernate communication with RDBMS is :
  • Load the Hibernate configuration file and create configuration object. It will automatically load all  Hibernate mapping files
  • Create session factory from configuration object
  • Get one session from this session factory
  • Create HQL Query
  • Execute query to get list containing Java objects 
14. How do you map Java Objects with Database tables?
  • First we need to write Java domain objects (beans with setter and getter).
  • Write hbm.xml, where we map java class to table and database columns to Java class variables.
Example :
<hibernate-mapping>
  <class name="com.test.User"  table="user">
   <property  column="USER_NAME" length="255"
      name="userName" not-null="true"  type="java.lang.String"/>
   <property  column="USER_PASSWORD" length="255"
     name="userPassword" not-null="true"  type="java.lang.String"/>
 </class>
</hibernate-mapping>

Hibernate interview questions


1. What is Hibernate?
Hibernate is a pure Java object-relational mapping (ORM) and persistence framework that allows you to map plain old Java objects to relational database tables using (XML) configuration files.Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

2. What is ORM ?
ORM stands for object/relational mapping. ORM is the automated persistence of objects in a Java application to the tables in a relational database.

3. What are the ORM levels ?
The ORM levels are:
  • Pure relational
  • Light objects mapping
  • Medium object mapping
  • Full object Mapping

4. What is a pure relational ORM?
The entire application, including the user interface, is designed around the relational model and SQL-based relational operations.

5. What is a meant by light object mapping?
The entities are represented as classes that are mapped manually to the relational tables. The code is hidden from the business logic using specific design patterns. This approach is successful for applications with a less number of entities, or applications with common, metadata-driven data models. This approach is most known to all.

6. What is a meant by medium object mapping?
The application is designed around an object model. The SQL code is generated at build time. And the associations between objects are supported by the persistence mechanism, and queries are specified using an object-oriented expression language. This is best suited for medium-sized applications with some complex transactions. Used when the mapping exceeds 25 different database products at a time.

7. What is meant by full object mapping?
Full object mapping supports sophisticated object modeling: composition, inheritance, polymorphism and persistence. The persistence layer implements transparent persistence; persistent classes do not inherit any special base class or have to implement a special interface. Efficient fetching strategies and caching strategies are implemented transparently to the application.

8. What does ORM consists of ?
An ORM solution consists of the followig four pieces:
  • API for performing basic CRUD operations
  • API to express queries refering to classes
  • Facilities to specify metadata
  • Optimization facilities : dirty checking,lazy associations fetching
9. Why do you need ORM tools like hibernate?
The main advantage of ORM like hibernate is that it shields developers from messy SQL. Apart from this, ORM provides following benefits:
  • Improved productivity
    • High-level object-oriented API
    • Less Java code to write
    • No SQL to write
  • Improved performance
    • Sophisticated caching
    • Lazy loading
    • Eager loading
  • Improved maintainability
    • A lot less code to write
  • Improved portability
ORM framework generates database-specific SQL for you.

Wednesday, 18 July 2012

new operator in java

In Java in order to create an object ,we must follow dynamic memory allocation by using new operator.
new operator is known as dynamic memory allocation operator.

operations of 'new':
1. It allocates sufficient amount of memory space for the data members of the class.
2. It takes an address of created memory space or address of the class and placed into object name.

Syntax:


1. <class_name> object_name=new <class_name()>;
2. <class_name> object_name; //declaration
    object_name=new <class_name()>;


Here,
class_name is the name of the class.
object_name represents a valid variable name of java.

Whenever an object is declared whose default value is 'null'.Any attempt to use object_name,will result in compile time error.

Whenever an object is referenced whose default value is not 'null'.It simply holds the memory address of the actual object_name.






Tuesday, 17 July 2012

Final variable in java



Any variable either member variable or local variable (declared inside method or block) modified by final keyword is called final variable. Final variables are often declare with static keyword in java and treated as constant.

In Java to make any thing thing as constant we use a keyword final.
The final keyword is placing an important role in three levels.They are


1. At variable level

syntax:    final datatype variable_name=variable_value;
example: final int a=10;

Therefore final variable values can not be modified.

2. At method level


Final keyword in java can also be applied to methods. A java method with final keyword is called final method and it can not be overridden in sub-class. You should make a method final in java if you think it’s complete and its behavior should remain constant in sub-classes. Final methods are faster than non-final methods because they are not required to be resolved during run-time and they are bonded on compile time.
syntax: final return type method_name(list_of_parameters)
{
//body
}

Once the method is final which can not be overridden.

3. At class level

Java class with final modifier is called final class in Java. Final class is complete in nature and can not be sub-classed or inherited. Several classes in Java are final e.g. String, Integer and other wrapper classes.
syntax: final class <class_name>
{

//.................................
}


final classes never participates in inheritance process.




Features of java

Features of any Programming Language is nothing nut the list of services provided by the language to the industry programmers.
Java language provides 13 features.They are


1.Simple
2.platform independent
3.Architecture Neutral
4.Portable
5.Multithreaded
6.Interpreted
7.Object Oriented
8.Robust
9.Distributed
10.Dynamic
11.Secure
12.Performance
13.Networked


The concept of Write-once-run-anywhere (known as the Platform independent) is one of the important key feature of java language that makes java as the most powerful language.

1. SimpleThere are various features that makes the java as a simple language. Programs are easy to write and debug because java does not use the pointers explicitly. It is much harder to write the java programs that can crash the system but we can not say about the other programming languages. Java provides the bug free system due to the strong memory management. It also has the automatic memory allocation and deallocation system.The java programming environment contains in build garbage collector for improving the performance of the java applications by collecting unreferenced memory space.

2. Platform Independent
The concept of Write-once-run-anywhere (known as the Platform independent) is one of the important key feature of java language that makes java as the most powerful language. Not even a single language is idle to this feature but java is more closer to this feature. The programs written on one platform can run on any platform provided the platform must have the JVM. 

3. Architecture Neutral
Java is an architectural neutral language as well. The growing popularity of networks makes developers think distributed. In the world of network it is essential that the applications must be able to migrate easily to different computer systems. Not only to computer systems but to a wide variety of hardware architecture and Operating system architectures as well.  The Java compiler does this by generating byte code instructions, to be easily interpreted on any machine and to be easily translated into native machine code on the fly. The compiler generates an architecture-neutral object file format to enable a Java application to execute anywhere on the network and then the compiled code is executed on many processors, given the presence of the Java runtime system. Hence Java was designed to support applications on network.


4. Portable
A portable application is one which runs on all operating systems and on all available processors without considering their vendors and architectures.

portability=platform independent + architectural neutral

5.  Multithreaded
Java is also a Multithreaded programming language. Multithreading means a single program having different threads executing independently at the same time. Multiple threads execute instructions according to the program code in a process or a program. Multithreading works the similar way as multiple processes run on one computer.
Multithreading programming is a very interesting concept in Java. In multithreaded programs not even a single thread disturbs the execution of other thread. Threads are obtained from the pool of available ready to run threads and they run on the system CPUs. This is how Multithreading works in Java which you will soon come to know in details in later chapters.


6. Interpreted
We all know that Java is an interpreted language as well. With an interpreted language such as Java, programs run directly from the source code.
The interpreter program reads the source code and translates it on the fly into computations. Thus, Java as an interpreted language depends on an interpreter program.
Advantage of Java as an interpreted language is its error debugging quality. Due to this any error occurring in the program gets traced. This is how it is different to work with Java.


7. Object Oriented
To be an Object Oriented language, any language must follow at least the four characteristics.
  • Inheritance   :   It is the process of creating the new classes and using the behavior of the existing classes by extending them just to reuse  the existing code and adding the additional features as needed.
  • Encapsulation  :   It is the mechanism of combining the information and providing the abstraction.
  • Polymorphism   :   As the name suggest one name multiple form, Polymorphism is the way of providing the different functionality by the functions  having the same name based on the signatures of the methods.
  • Dynamic binding  :   Sometimes we don't have the knowledge of objects about their specific types while writing our code. It is the way of providing the maximum functionality to a program about the specific type at runtime.  
Java, it is a fully Object Oriented language because object is at the outer most level of data structure in java. No stand alone methods, constants, and variables are there in java. Everything in java is object even the primitive data types can also be converted into object by using the wrapper class.


 8. Robust
Java has the strong memory allocation and automatic garbage collection mechanism. It provides the powerful exception handling and type checking mechanism as compare to other programming languages. Compiler checks the program whether there any error and interpreter checks any run time error and makes the system secure from crash. All of the above features makes the java language robust.

9. DistributedThe widely used protocols like HTTP and FTP are developed in java. Internet programmers can call functions on these protocols and can get access the files from any remote machine on the internet rather than writing codes on their local system.

10. Dynamic
While executing the java program the user can get the required files dynamically from a local drive or from a computer thousands of miles away from the user just by connecting with the Internet.
The language java always follows dynamic memory allocation only.
Dynamic memory allocation is one in which memory will be allocated at run time.

11. SecureJava does not use memory pointers explicitly. All the programs in java are run under an area known as the sand box. Security manager determines the accessibility options of a class like reading and writing a file to the local disk. Java uses the public key encryption system to allow the java applications to transmit over the internet in the secure encrypted form. The bytecode Verifier checks the classes after loading. 

12. PerformanceJava uses native code usage, and lightweight process called  threads. In the beginning interpretation of bytecode resulted the performance slow but the advance version of JVM uses the adaptive and just in time compilation technique that improves the performance. 

13. Networked
The basic aim of networking is to share the data between multiple machines either locally or globally.we can develop internet applications by making use of J2EE and also we can develop intranet application by making use of J2SE.

Friday, 13 July 2012

Struts CheckBox Example

Common.properties (copy it into webapps\app1\WEB-INF\classes\com\mkyong\common\properties folder)

#error message
error.common.html.checkbox.required = Please tick the checkbox.
#label message
label.common.html.checkbox.name = CheckBox
label.common.html.checkbox.button.submit = Submit
label.common.html.checkbox.button.reset = Reset

web.xml (copy it into webapps\app1\WEB-INF folder)

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Struts-CheckBox-Example</display-name>

<servlet>
<servlet-name>action</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
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>


struts-config.xml (copy it into webapps\app1\WEB-INF folder)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>
 <form-beans>
  <form-bean
   name="htmlCheckBoxForm"
   type="com.mkyong.common.form.HtmlCheckBoxForm"/>

 </form-beans>
 <action-mappings>

     <action
   path="/CheckBoxPage"
   type="org.apache.struts.actions.ForwardAction"
   parameter="/pages/checkbox.jsp"/>

  <action
   path="/CheckBox"
   type="com.mkyong.common.action.HtmlCheckBoxAction"
   name="htmlCheckBoxForm"
   validate="true"
   input="/pages/checkbox.jsp"
   >

   <forward name="success" path="/pages/display.jsp"/>
  </action>
 </action-mappings>
 <message-resources
  parameter="com.mkyong.common.properties.Common" />
</struts-config>

HtmlCheckBoxAction.java (copy it into webapps\app1\WEB-INF\classes folder and compile it)

package com.mkyong.common.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class HtmlCheckBoxAction extends Action{

 public ActionForward execute(ActionMapping mapping,ActionForm form,
   HttpServletRequest request,HttpServletResponse response) throws Exception {

  return mapping.findForward("success");
 }

}

HtmlCheckBoxForm.java (copy it into webapps\app1\WEB-INF\classes folder and compile it)

package com.mkyong.common.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
public class HtmlCheckBoxForm extends ActionForm{

 String checkboxValue;
 public String getCheckboxValue() {
  return checkboxValue;
 }
 public void setCheckboxValue(String checkboxValue) {
  this.checkboxValue = checkboxValue;
 }
 @Override
 public ActionErrors validate(ActionMapping mapping,
   HttpServletRequest request) {

  ActionErrors errors = new ActionErrors();
      
     if( getCheckboxValue() == null || ("".equals(getCheckboxValue()))) {
        errors.add("common.checkbox.err",
          new ActionMessage("error.common.html.checkbox.required"));
     }
      
     return errors;
 }

 @Override
 public void reset(ActionMapping mapping, HttpServletRequest request) {
  // reset properties
  checkboxValue = "";
 }

}

checkbox.jsp (copy it into webapps\app1 folder)

<html>
<head>
</head>
<body>
<h1>Struts html:checkbox example</h1>
<html:form action="/CheckBox">

<html:messages id="err_name" property="common.checkbox.err">
<div style="color:red">
 <bean:write name="err_name" />
</div>
</html:messages>
<div style="padding:16px">
<bean:message key="label.common.html.checkbox.name" /> :
 <html:checkbox property="checkboxValue" />
</div>
<div style="padding:16px">
 <div style="float:left;padding-right:8px;">
  <html:submit><bean:message key="label.common.html.checkbox.button.submit" /></html:submit>
 </div>
 <html:reset><bean:message key="label.common.html.checkbox.button.reset" /></html:reset>
</div>
</html:form>

</body>
</html>



 display.jsp (copy it into webapps\app1 folder)

<html>
<head>
</head>
<body>
<h1>
 CheckBox value : <bean:write name="htmlCheckBoxForm" property="checkboxValue" />
</h1>
</body>
</html>

super keyword in java

the super keyword indicates the following :

1. The super keyword in java programming language refers to the superclass of the class where the super keyword is currently being used.
2. The super keyword as a standalone statement is used to call the constructor of the superclass in the base class.


Example to use the super keyword to call the constructor of the superclass in the base class:
public class class1
{
public class1(String arg)
{
super(arg);
}
..................
}

-->  The syntax super.<method_Name>() is used to give a call to a method of the superclass in the base class.
--> This kind of use of the super keyword is only necessary when we need to call a method that is overridden in this base class in order to specify that the method should be called on the superclass.


Example to use the super keyword with a method:

public class class1
{
.............................
public String fun()
{
return super.fun();
}
.............................
}


class A
{
int k = 10;
}
class Test extends A
{
public void m()
{
System.out.println(super.k);
}
}

keywords in java

Click Here to download doc

this keyword in java with example

The keyword this is useful when you need to refer to instance of the class from its method. The keyword helps us to avoid name conflicts. As we can see in the program that we have declare the name of instance variable and local variables same. Now to avoid the confliction between them we use this keyword. Here, this section provides you an example with the complete code of the program for the illustration of how to what is this keyword and how to use it.
In the example, this.length and this.breadth refers to the instance variable length and breadth while length and breadth refers to the arguments passed in the method. We have made a program over this. After going through it you can better understand.

Here is the code of the program:

class Rectangle{
  int length,breadth;
  void show(int length,int breadth){
  this.length=length;
  this.breadth=breadth;
  }
  int calculate(){
  return(length*breadth);
  }
}
public class UseOfThisOperator{
  public static void main(String[] args){
  Rectangle rectangle=new Rectangle();
  rectangle.show(5,6);
  int area = rectangle.calculate();
  System.out.println("The area of a Rectangle is  :  " + area);
  }
}


Output of the program is given below:
The area of a Rectangle is : 30

Java Classpath

Wednesday, 4 July 2012

struts interview questions


Ques: 76 Describe the <tiles:useAttribute/> and <tiles:importAttribute/> tags in Tiles tag library in Struts framewrok?
Ans: The <tiles:useAttribute/> tag is used to retrieve a Tiles object from the Tiles context and expose that object as a scriptlet variable. The <tiles:useAttribute/> tag has no body and supports five attribute:
name, id, className, scope, ignore.
The <tile:importAttribute/> tag is ues to import a Tiles object from the Tiles context into a JSP scriptlet variable, which is stored in the named scope. If the name and scope attributes are not included are not included in the tag instance, then all Tile objects stored in the Tiles context are imported and placed in page scope. The < tiles:importAttribute/> tag has no body and supports three attributes:
name, scope, ignore.

Ques: 77 Which tag can be used to initialize the Tiles definition factory in Struts framework?
Ans: The <tiles:initComponentDefintions/> tag is used to initialize the Tiles definition factory. This tag is evaluated only once or not at all if the factory has already been initialized by other means. The <tiles:initComponentDefinition/> has no body and supports two attributes:
  * file : The file containing your Tile definitions.(Required)
  * classname : The fully qualified classname of the definition factory being initialized. This class, if specified, must implement the org.apache.struts.tiles.DefinitionFactory.(Optional)

Ques: 78 What are the steps involved in installing the Logic tag library in your Struts application?
Ans: To use the Logic tag library in web application, You must complete the following steps:
  * Copy the TLD file packaged with this tag library struts-logic.tld) to the webapps/MyAppName/WEB-INF directory.
  * Make sure that the struts.jar file is in the webapps/MyAppName/WEB-INF/lib directory.
  * Add the following <taglib> sub-element to the web.xml file of the Web application:
  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>
You must add the following taglib directive to each JSP that will leverage the HTML tag library:
  <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

Ques: 79 What is the use of <logic:empty/> and <logic:notEmpty/> tag defined by Logic tag library in Struts framework?
Ans: The <logic:empty/> tag evaluates its body if either the scripting variable identified by the name attribute or a property of the named scripting variable is equal to null or an empty string. The <logic:empty/> tag has a body type of JSP and supports three attributes:
  * name : Identifies the scripting variable being tested.
  * property : Identifies the data member of the scripting variable ot be tested.(optional)
  * scope : Defines the scope of the bean specified by the name attribute.
The <logic:notEmpty/> tag evaluates its body if either the scripting variable or property of the named scripting variable is not equal to null or an empty string. The <logic:empty/> tag has a body type of JSP and supports three attributes:
  * name : Specifies a scripting variable to be used as the variable being tested.(Required)
  * property : Specifies the data member of the scripting variable to be tested.(optional)
  * scope : Defines the scope of the bean specified by the name attribute.

Ques: 80 What is the use of <logic:equal/> and <logic:notEqual/> tag defined by Logic tag library in Struts framework?
Ans: The <logic:equal/> tag evaluates its body if the variable specified by any one of the attributes cookie, header, name, property, parameter equals the constant value specified by the value attribute. The <logic:equal/> tag has a body of JSP and supports seven attributes:
value, cookie, header, name, property, parameter, scope.
Example:
<logic:equal name="user"
  property="age"
  value="<%= requiredAge %>">
  You are exactly at the right age.
</logic:equal>

The <logic:notEqual/> tag evaluates its body if the variable specified by any one of the attributes cookie, header, name, property, parameter is not equal to the constant value specified by the value attribute. The <logic:equal/> tag has a body of JSP and supports seven attributes:
value, cookie, header, name, property, parameter, scope.
Example:
<logic:notEqual name="user"
  property="age"
  value="<%= requiredAge %>">
  You are not at the right age.
</logic:equal>

struts interview questions


Ques: 66 What is the use of <html:javascript/> tag in the HTML tag library?
Ans: The <html:javascript/> tag is used to insert JavaScript validation methods based on the Commons Validator Plugin. The JavaScript methods used for validation are retrieved from the validator definition file using the formName as the index. The <html:javascript/> tag has no body and supports eight attributes:
cdata, dynamicJavaScript, formName, htmlComment, method, page, src, staticJavascript.

Ques: 67 What is the use of <html:message/> tag in HTML tag library used in Struts application?
Ans: The <html:message/> tag is used to display a collection of messages stored in an ActionErrors, ActionMessages, String, or String array object. 
The <html:message/> has a body type of JSP and supports eight attributes:
id, bundle, locale, name, property, header, footer, message.

Ques: 68 What is the difference between <html:option/> and <html:options/> tag in HTML tag library?
Ans: The <html:option/> tag is used to generate an HTML <input> element to type <option>, which represents a single option element nested inside a parent <select> element. The <html:option/> tag has a body type of JSP and supports eight attributes:
value, bundle, disabled, key, locale, style, styleId, styleClass.
The <html:options/> tag (as a child of the <html:select/> tag) is used to generate a list of HTML <option> elements. The <html:options/> tag has no body and support eight attributes:
collection, filter, labelName, lableProperty, name, property, style, styleClass.

Ques: 69 What is for <html:rewrite/> tag used defined by the HTML tag library?
Ans: The <html:rewrite/> tag is used to create a request URI based on the identical policies used with the <html:link/> tag but without the <a> element.
 The <html:rewrite/> tag has no body and supports 12 attributes:
anchor, forward, href, name, page, paramId, paramName, paramProperty, paramScope, property, scope, transaction.

Ques: 70 What are the steps involved in installing the Tiles tag library in your Struts application?
Ans: To use Tiles tag library in web application, You must complete the following steps:
  * Copy the TLD file packaged with this tag library struts-tiles.tld to the       webapps/MyAppName/WEB-INF directory.
  * Make sure that the struts.jar file is in the webapps/MyAppName/WEB-INF/lib directory.
  * Add the following <taglib> sub-element to the web.xml file of the Web application:
  <taglib>
    <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
  </taglib>
You must add the following taglib directive to each JSP that will leverage the Tiles tag library:
  <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

Ques: 71 What is the use of <tiles:insert/> tag in Tiles tag library in Struts framewrok?
Ans: The <tiles:insert/> tag is used to insert a Tiles template into a JSP. You must use the <tiles:put/> or <tiles:putList/> tags to substitute sub-components of the tile being inserted. 
The <tiles:insert/> tag has a body type of JSP and support 14 attributes:
template, components, page, definition, attribute, name, beanName, beanProperty, beanScope, flush, ignore, role, controllerUrl, controllerClass.

Ques: 72 What is the use of <tiles:definition/> tag in Tiles tag library in Struts framewrok?
Ans: The <tiles:definition/> tag is used to create a JavaBean representation of Tiles template definition that is stored in the named scope bound to the identifier named by id attribute. The <tiles:definition/> tag acts much like a runtime counterpart to the XML <definition/> found in the Tiles definition file. The <tiles:definition/> tag has a body type of JSP and supports six attribute:
id, scope, template, page, role, extends.

Ques: 73 What is for <tiles:put/> tag used in Tiles tag library in Struts framewrok?
Ans: The <tiles:put/> tag is used to define the equivalent of a parameter, representing a sub-component of a template, that will be used to the Tiles object. 
The <tiles:put/> tag has a body type of JSP and supports eight attribute:
name, value, direct, type, beanName, beanProperty, beanScope, role.

Ques: 74 What is the use of <tiles:putList/> tag in Tiles tag library in Struts framewrok?
Ans: The <tiles:putList/> tag is used to define a list of parameters that will passed as attribute to the Tiles object. The list is created from a collection of child <tiles:add/> tags. 
The <tiles:putList/> tag has a body type of JSP and supports a single attribute:
name : The name of the list being created.(Required)

Ques: 75 What is the use of <tiles:add/> and <tiles:get/> tags in Tiles tag library in Struts framewrok?
Ans: The <tiles:add/> tag is used to add parameters to a parameter as defined by a <tiles:putList/> tag. 
The <tiles:add/> tag has a body type of JSP and supports seven attributes:
beanName, beanProperty, beanScope, direct, role, type, value.
The <tiles:get/> tag is used to retrieve and insert parameters previously defined from the Tiles context. With the exception of ignore attribute being defaulted to true, this tag is functioanlly the same as the <tiles:insert/>. 
The <tiles:get/> tag has no body content and support four attributes:
name, ignore, flush, role.