Java Interview Questions -39

Java Interview Questions -39

1.Does Hibernate Session Object has any cache associated with it by default ?

Yes, first-level caching is a mandatory requirement for Hibernate Session Object.

2.Is there any cache associated with Hibernate SessionFactory Object?
Yes, there is an optional second-level cache with Hibernate SessionFactory object.

3.Can a single Hibernate Session object be used across multiple threads running within a process?

No, Hibernate Session is basically single-threaded and not to be used across multiple threads.

4.Is this same for Hibernate SessionFactory object as well?

No, Hibernate SessionFactory is basically thread-safe, thus can be re-used across multiple threads and multiple Transacions as well.

5.How can the second-level caching for Hibernate SessionFactory object be

By setting appropriate hibernate.cache configuration related properties, one can enable/disable second-level caching for Hibernate SessionFactory object but only for once before SessionFactory is created

6.Is it possible to use Hibernate Session object with the scope and context defined by JTA Transaction ?

Yes, starting with Hibernate 3.0.1 version, Sessionfactory.getCurrentSession method has the scope and context defined by the running JTA Transaction scope and context.
But as of Hibernate 3.1 version, getCurrentSession method of Hibernate SessionFactory has the current Session Scope and Context controlled by pluggable current Session Context class, defined in configuration parameter such as

7.As of Hibernate 3.1 version can you be able to explain how many ways scope and context of Hibernate current contextual session be handled?

As of Hibernate 3.1 version, Hibernate has three ways to handle current contextual session, such as JTASessionContext,ThreadLocalSessionContext,ManagedSessionContext.

8.What is the difference between class tag and component tag in Hibernate from the persistence perspective?

class tag refers to an Entity that is persisted with an identifier, while component tag means the POJO associated with component tag is persisted along with contained object as a value type.So it doesn’t require
an identifier, while the contained object has an entity reference, not for the component object.

9.What is the difference between component and dynamic component?

Component in Hibernate world, means something that is embeded in a contained object and there exist a composition style of binding between the contained object and the component object. So component is declared
inside a class tag, just to say one type of use.Dynamic-component has the same characteristics as component but there exists a difference in the way dynamic-component can be used to map a bean’s attribute,
this can be of type java.util.Map with the key defined in mapping file and corresponding value from the table’s column. So with dynamic-component, there can be possibility of changing the attribute
key/value pair during deployment time, just by changing the name and column values in the mapping configuration file.

10.What are the different types of Modes are available, those can be defined?

Various Modes like CacheMode, LockMode, EntityMode, FlushMode, ScrollMode, these modes can be used along with Hibernate Session.

11.What are the various CacheMode available in Hibernate Version 3.2?

Various CacheMode like GET, IGNORE, NORMAL, PUT, REFRESH are available with Hibernate’s second-level cache.

12.Is there any way not to use Hibernate’s second-level cache, while using operations of Hibernate Session?

By setting CacheMode.IGNORE as the cache mode for any Hibernate Session instance, before any operation on that session is carried out. This way one can ignore Hibernate’s second-level cache while
using operations of Session.

13.How to disable Hibernate’s second-level cache from usage?

Just by providing cache provider as org.hibernate.cache.NoCacheProvider, one can disable use of Hibernate’s second level cache.Another way is by setting use_second_level_cache from hibernate.cache
property, as false.Another way is to use CacheMode.IGNORE along with Hibernate’s session.

14.What are the various steps to use Hibernate’s second-level cache?

One has to define the supporting cache provider for any second-level cache framework to be used, in Hibernate configuration file along with the configuration for Hibernate’s SessionFactory.
Then it is required to enable the use_second_level_cache property as true or providing appropriate cache mapping at class or collection mapping related configuration.

15.What are the various types of cache providers support available with Hibernate’s second-level cache features in api?

Various cache providers like EhCacheProvider, HashtableCacheProvider,JndiBoundTreeCacheProvider, OptimisticTreeCacheProvider, OSCacheProvider , SwarmCacheProvider and TreeCacheProvider etc.

16.If the project requirement to have the second level cache used in transactionalcontext, which cache would you choose out of those Cache Providers?

JBoss TreeCache cache provider and cache framework can be a choice,as it can be used in clustered environment with ip multicast replication mode. And this cache can be used along with a transactional context.

17.How about EHCache and OSCache providers from Hibernate version 3.0,can these be used in clustered environment, as of this version?

No, these cache providers are capable of running in-memory and disk modes, with no cluster way of execution.

18.How can you avoid synchronization of persistent objects with the database, and do not want to retain this object in the first-level cache, when flush method is called on session?

By using evict method from session, one can remove specific object from first-level cache of session, and thus can avoid automatic synchronization of object with database, when flush method is called
on session instance.

19.Can you be able to evict all objects from the session cache? If yes, How?

Yes, it is possible to evict all objects from the session cache by using clear method on session instance.

20.If anyone wants to perform similar activities with Hibernate’s second-level cache, is it possible? If yes, how?

Yes, evict object(s) with or without criteria can be possible on Hibernate’s second-level cache by using methods on Hibernate’s SessionFactory, and methods are evict, evictCollection  and many more arguments available.

21.What are the different Transaction Factories available with Hibernate?

There are three different types of Transaction Factoryavailable with  Hibenate 3.2 as JDBCTransactionFactory, JTATransactionFactory and CMTTransactionFactory.

22.Which one is the default transaction factory in Hibernate 3.2?

JDBCTransactionFactory   is the default local transaction factory withHibernate 3.2.

23.Can Hibernate Session Factory be bound to JNDI?

Yes, by configuring in hibernate.cfg file, session factory can be bound to initial context (as defined by properties hibernate.jndi.url and hibernate.jndi.class).

24.Can Hibernate be used to call stored procedures and SQL statements?

Yes, there are provision in Hibernate 3.2, for defining callable statements and SQL in mapping HBM files.

25.Can the custom SQL be defined for creation of Java entity object by loading values from database tables and populating Java Object?

Yes, Javaentity objects can be loaded with custom SQL queries and can be defined in HBM file in form of HQL (Hibernate Query Language).

26.What are the different Fetching Strategies available with Hibernate 3.2?

There are four different Fetching standards available in Hibernate3.2, as follows: join fetching, select fetching, batch fetching, sub-select fetching.

27.What are the different types of statistics available in Hibernate 3.2?

Different types of statistics like QueryStatistics,CategorizedStatistics, CollectionStatistics, EntityStatistics etc., available in Hibernate 3.2.

28.How can you get a handle on Hibernate Statistics?

If Hibernate is deployed in a JMX enabled Application server, then Hibernate provided a statistics service,that can be registered as MBean with JMX server and be
used to retrieve different types of statistics available Hibernate statistics can be obtained from session factory as well.

29.Can Hibernate be used to map persistent entity POJO to XML files?

Yes, Hibernate can be used to mapp XML file/tags to POJO entity classes.

30.If there are multiple databases to be used to interact with domain classes, how can session factory be able to manage multiple datasources?

Each datasource will be configured to each session factory, and to use a single database, a session is created to use database.

31.What is lazy initialization in Hibernate?

When there is an association of one-to-one, or one-to-many, or many-to-many between classes, and on creation of one object, it has to be decided whether to bring associated objects along
with this object or not. By setting lazy=”true” we instruct Hibernate not to bring the associated object/objects during creation of the required object.By setting lazy=”false”, it is the reverse, this means
we instruct Hibernate to bring all the associated objects also at the time of returning the associating object.

32.If there any impact on performance by this attribute lazy ?

This is purely a configuration time decision one has to take to use lazy attribute and its value (true/false)appropriately. As SessionFactory is created once and reused,
all the configuration setting in HBM file is read once,and cann’t be changed at runtime.

33.What are the different states of an instance in Hibernate?

There are three states that exist for any instance of a class. These are transient, persistent and detached.Those instances that are created but not associated with
any session or not saved in database are trasient objects.Those instances that are created and be used in any of the methods like save, saveOrUpdate, update of Session are
called persistent objects.Those instances that were used in Session methods like save,saveOrUpdate or update to be inserted or updated in databasetable, and then session is flushed and closed, now these
objects are in JVM, but these are not bound to any session.

34.How can certain type of logic executed on execution of CRUD operation of session, without duplicating it across many places in code base?

Hibernate Interceptors can be used to receive callback for certain type of events or operations like save, delete,load, update of session. Session Factory level interceptor
and session level interceptor. These Interceptors can be used to have code for certain type of logic to be called for every lifecycle method of session.

35.How can multiple threads access session factory simulteneously to create session instance?

session factory is thread-safe, so it is okay to be used by many threads to have session from session factory, but I think session is not thread safe and it should be
used by one thread at a time, and after use,session has to be flushed and closed.

36.How many ways Hibernate manages concurrency ?

Hibernate has different ways of managing concurrency.These are  automatic versioning, detached object and extended user sessions.

37.What is the difference between uni-directional and bi-directional associations?

uni-directional association allows object creation from one direction only. Bi-directional association allows object querying from both directions of fetching object instances.

38.What are the different contextual session in Hibernate?

There are three different types of contextual session Hibernate provides, these are JTA session context, local thread session context and managed session context. JTA session context is
applicable in case Hibernate session is running in JTA (Java Transaction API), request thread level session scoped applicable in case of local thread session, and managed session, requires
application to open, close and flush session, so creation of session should be handled by application only.

39.Can you tell us difference between Hibernate HQL over SQL?

HQL is fully object oriented, with support for object inheritence, polymorphism and association, but SQL is more of Relational with structured form of queries.

40.What are the different scopes one can introduce while using Interceptors with Hibernate?

Probably, one can use interceptors with hibernate Session scoped or SessionFactory scoped contexts, while using Interceptors with Hibernate.

41.How many ways client application that uses Hibernate to react to certain events?

Probably, if I am not wrong, two ways one can react/act to certain events generated out of Hibernate Framework. These are either Interceptors or event systems.

42.Can I be able to persist a XML DOM object tree to database by defining mapping between XML DOM to database table, without using POJOs?

Yes, one can use Hibernate mapping to persist XML DOM tree hierarchy to database tables.

43.Suppose Hibernate Filters are defined in HBM file for a class,but need is to not use this filter at runtime, Is it possible?

Hibernate Filters are to be enabled for any instance of Hibernate session before use. So whenever is it not required, those filters won’t be used.

44.How can the Hibernate Filter be enabled/ disabled for a session?

session.enableFilter(method parameters/arguments) is the method for enabling/disabling filter for Hibernate Session instance.
In case of a requirement as to use combination of fields from different class files those are mapped to different tables. Or in short the requirement is to have functionality of a view (database perspective) but not create a
view in database.

45.What are the various persistent objects fetching strategies defined in Hibernate3 ?

There are four different types of persistent objects fetching strategies defined in Hibernate3, such as Joing fetching, select fetching, Sub-select  fetching and Batch fetching strategies.

46.Can these fetching strategies for retrieving persistent objects, those are defined in Object Relational Mapping in configuration, be able to over-ridden ?

Yes, fetching strategies as defined in Mapping configuration files can be over-ridden by using HQL or Criteria defined/used with Hibernate Session instance.

47.Can the property tag definition of the class tag for the POJO class that is being used in O/R Mapping, be lazily loaded by using lazy=”true”?

Yes, we can define lazy=”true” for any property within a class tag from the O/R mapping file. But we must have to apply proper instrumentation of the build-time
bytecode of the class that is being used, or else this lazy definition will be ignored while fetching respective persistent object.

48.While working with large binary stream or serializable object to be used with database using Hibernate Session, is there any setting that is to be used in Hibernate specific configuration file?

Yes, hibernate.jdbc.use_streams_for_binary setting can be used with value true or false, in case you want to use large binary or serializable data to/from database.

49.While using outer join fetch strategy, can you impose certain depth or level of object hierarchy to be fetched?

Yes, one can impose certain depth or level of object hierarchy to be fetched while using outer join fetch strategy, by using the configuration setting as hibernate.max_fetch_depth with some count number.

50.In case of highly concurrent database usage mode, can you set for all updates on table to be executed based on primary key column of the table, for which column data to be updated?

Yes, by using hibernate.order_updates as true or false for achieving/forcing this type of updates based on primary key column values.

51.Suppose you have encountered a situation whereby cluster aware second level cache is not performing properly or upto desired expectation level while working wiht Hibernate.
Is there any setting that you can remember that can help by minimizing number of updates or object put calls, thus can help in increasing performance of read from cache in cluster

hibernate.cache.use_minimal_puts setting in Hibernate configuration file, with a value as true or false, would optimize Hibernate second-level cache by minimizing number of
additions/updations to objects those are being cached, thus minimizing overhead associated with number of reads from database.

52.How can you log all seond-level cache related activities while using Hibernate Framework?

By using the Log category “org.hibernate.cache”, one can obtain log related to Hibernate’s second-level cache activities.

53.What are the Transaction Strategies available with Hibernate Framework?

Various transaction strategies available in Hibernate as such are for JDBC, JTA and CMT with related TransactionFactories.

54.Does Hibernate as of latest version, provide support for use defined Transaction Factories?

Yes, as of latest version of Hibernate Framework, custom/use defined/supplied Transaction Factories can be used, by defining appropriate factory class file for the setting

55. What is the role of Action/ Model ?

Actions in Struts are POJO , is also considered as a Model. The role of Action are to execute business logic or delegate call to business logic by the means of action methods which is mapped to request and contains business data to be used by the view layer by means of setters and getters inside the Action class and finally helps the framework decide which result to render

56. How does Interceptors help achieve Struts2 a better framework than Struts1 ?

i.Most of the trivial work are made easier to achieve for example automatic form population.
ii. Intelligent configuration and defaults for example you can have struts.xml or annotation based configuration and out of box interceptors can provide facilities that a common web application needs
iii.Now Struts2 can be used anywhere in desktop applications also, with minimal or no change of existing web application,since actions are now POJO.POJO actions are even easier to unit test.Thanks to interceptors
iv.Easier UI and validation in form of themes and well known DOJO framework.
v.Highly plugable,Integrate other technologies like Spring,Hibernate etc at ease.
vi.Ready for next generation RESTFUL services

57.What is the relation between ValueStack and OGNL ?

A ValueStack is a place where all the data related to action and the action itself is stored. OGNL is a mean through which the data in the ValueStack is manipulated.

58.Can annotation-based and XML based configuration of actions coexists ?


59.What is struts.devMode and why it is used ?

struts.devMode is a key used in file (Can also be configured in struts.xml file as ) , to represent whether the framework is running in development mode or production mode by setting true or false. If set to development mode, it gives the following benefits : –
> Resource bundle reload on every request; i.e. all localization properties file can be modified and the change will be reflected without restarting the server.
> struts.xml or any configuration  files can be modified without restarting or redeploying the application
> The error occurs in the application will be reported, as oppose to production mode.
Also remember that struts.devMode should be marked as false in production environment to reduce impact of performance. By default it is “false”.

60.What is the difference between empty default namespace and root name space ?

If the namespace attribute is not defined in the package tag or assigned “” value then it is called empty default namespace. While if “/” is assigned as value to the namespace attribute then it is called as root namespace.
The root namespace is treated as all other explicit namespaces and must be matched. It’s important to distinguish between the empty default namespace, which can catch all request patterns as long as the action name matches, and the root namespace, which is an actual namespace that must be matched.

61.Which interceptor is responsible for setting action’s JavaBean properties ?

com.opensymphony.xwork2.interceptor.ParametersInterceptor is the interceptor class who sets the action’s JavaBean properties from request.

62.What is the difference between Action and ActionSupport ?

Action is interface defines some string like SUCCESS,ERROR etc  and an execute() method. For convenience Developer implement this interface to have access to String field in action methods. ActionSupport on other hand implements Action and some other interfaces and provides some feature like data validation and localized error messaging  when extended in the action classes by developers.

63.What is execute and wait interceptor ?

The ExecuteAndWaitInterceptor is great interceptor provided out of box in Struts2 for running long-lived actions in the background while showing the user a nice progress meter or a progress bar. For example while uploading a large file to the server we can use this interceptor to display a nice running progress bar instead of leaving the user in confusion that the application is not responding.This also prevents the HTTP request from timing out when the action takes more than 5 or 10 minutes.

64.Does the order in which interceptors execute matters ? If yes then why ?

Well, the answer is yes and no.Some Interceptors are designed to be independent so the order doesn’t matter,but some interceptors are totally dependent on the previous interceptors execution.For example the validation and workflow interceptors,the validation interceptors checks if there is any error in the form being submitted to the action, then comes the workflow interceptor who checks if validation ( occured in the last) has any error,in presence of error it will not let the rest of the interceptors ( if any ) in the stack to execute.So this is very important that the validation interceptors execute first before the workflow. On the other hand lets say you wrote an interceptors who is doing the authentication and you have the user credential provided ( by the time this executes) it doesn’t matter where this interceptors is placed( It is a different fact that you would like to keep it in the top ).

65.Who loads the struts.xml file ? Which Struts2 API loads the struts.xml file?

In Struts2 FilterServlet is the responsible class for loading struts.xml file as we deploy the application on the container.Unlike Servlet (as with Struts1) needs the load-on-startup tag to load the front controller,a filter doesn’t need to have load on startup tag to be loaded as the application is deployed. As with servlet specification a filter is loaded/executed as the application  starts up.

66.What is the DispatchAction (Struts1) equivalent in Strtus2 ?

Struts1 provided the facility of having related action methods in a Single Action class,depending on the method parameter, the mapped methods were executed.To achieve this we have to extend the DispatchAction class in Struts1.But this comes as default in Struts2, We need to provide the qualified methods in the action class( no need to inherit any class), and provide the mapping of action path/name to the method attribute in action tag(struts.xml) and proper code in view layer.

67.What is the difference between DispatchAction and dynamic method invocation in Struts2 ?

can see the map doesn’t return the parameter as String unlike the Servlet specification, but an array of String  (can be convinient for multivalued UI controls check box,single value UI controls data can be retrived as in above code ).

68.What is abstract package in Struts2, and what is its use ?

An abstract package usually defines inheritable components such as intercetpor,different interceptor stacks,result types etc.But doesn’t contain any actions.The way we declare a package as abstract is through the package elements attribute as abstract and setting the value to “true”. By default ( if abstract attribute is not mentioned) it is false.Struts-default.xml is an example of abstract package.

69.Does Struts2 mandates of implementing the Action interface in action classes to have the default Action method (execute)?

Struts2 doesn’t mind if the action classes doesn’t implement the Action interface, to have the execute method executed on default action method selection.Even though it appears that Action interfaces has the execute method declaration and one must implement it to have the execute method overriden in the action classes,Struts2 takes it as an informal contract with the developer by letting the developer to have an execute method conforming to the signature of execute method.Whenever Struts2 finds any voilation to the declaration of the method in unimplemented action class it throws the exeception.

70.What is the advantage of extending the action class from ActionSupport class?

The use of ActionSupport class provides the features like validation, locale support and serialization to an action,

71.How can one integrate Spring IoC with Struts 2?

Struts 2 comes with support for Spring and Spring can be used to inject beans to various classes. It can also be used to inject properties to the action class of struts 2. For configuring Spring, contextLoaderListener can be configured.

72.Describe the flow of a request in a Struts 2 web application?

It can be best understood by using a diagram. Please refer the following URL for understanding the same.

73.What tool/IDE/frameworks do you use to write code in a Struts 2 web application?

Mostly it is MyEclipse 9 which has excellent support for struts 2. Netbeans 7  has support for Struts 1 but not Struts 2. Other that the IDE one can also mention tools like DreamWeaver, Spring, Hibernate, XMLSpy etc.

74.What are the steps to migrate a web application written with Struts 1 to Struts 2?

This involves moving ActionForms of Struts1 to POJO properties of Struts 2.Converting Struts1 struts-config.xml to struts.xml of Struts2.

75.What is Controller in Spring MVC framework?

In a general way, Controller (‘c’ in mvc ) delivers access to the behavior of application which is usually defined by a service interface and acts as glue between core application and the web. It processes/interprets client data

76.What is a front controller in Spring MVC ?

A front controller is defined as “a controller which handles all requests for a Web Application.” DispatcherServlet (actually a servlet) is the front controller in Spring MVC that intercepts every request and then dispatches/forwards requests to an appropriate controller.

77.What is SimpleFormController in Spring MVC and how to use it in your web application ?

It offers you form submission support. This can help in modeling forms and populating them with model/command object returned by the controller. After filling the form, it binds the fields, validates the model/command object, and passes the object back to the controller so that the controller can take appropriate action..

78.Why to override formBackingObject(HttpServletRequest request) method in Spring MVC?

You should override formBackingObject(HttpServletRequest request) if you want to provide view with model object data so that view can be initialized with some default values e.g. Consider in your form view.

79.What are the advantages of Spring MVC over Struts MVC ?

1. There is clear separation between models, views and controllers in Spring.
2. Spring’s MVC is very versatile and flexible based on interfaces but Struts forces Actions and Form object into concrete inheritance.
3. Spring provides both interceptors and controllers.

80. Difference between FileSystemResource and ClassPathResource ?

In FileSystemResource you need to give path of spring-config.xml (Spring Configuration) file relative to your project or the absolute location of the file.
You can get this by right-clicking the spring-config.xml …

81.Difference between BeanFactory and ApplicationContext ?

BeanFactory instantiates beans lazily i.e. Beans are instantiated when you get them from BeanFactory not on loading BeanFactory.

82.Which methods of Serializable interface should I implement?

The serializable interface is an empty interface, it does not contain any methods. So we do not implement any methods.

83. What is the SimpleTimeZone class?

The SimpleTimeZone class provides support for a Gregorian calendar.

84. Which class is extended by all other classes?

The Object class is extended by all other classes.

85. What is the purpose of the System class?

The purpose of the System class is to provide access to system resources.

86.Which TextComponent method is used to set a TextComponent to the read-only state?


87.How are the elements of a CardLayout organized?

The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.

88. Can a double value be cast to a byte?

Yes, a double value can be cast to a byte.

89. What must a class do to implement an interface?

It must provide all of the methods in the interface and identify the interface in its implements clause.

90. What class is the top of the AWT event hierarchy?

The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy.

91.What value does read() return when it has reached the end of a file?

The read() method returns -1 when it has reached the end of a file.

92.Can a Byte object be cast to a double value?

No. An object cannot be cast to a primitive value.

91.How to communicate with data base?

To connect to data base we have set of interfaces provided by Java.sql.*; First you need to load JDBC driver and then Make JDBC connection.

92.What is the use of ForwardAction?

The ForwardAction class is useful when you’re trying to integrate Struts into an existing application that uses Servlets to perform business logic functions. You can use this class to take advantage of the Struts controller and its functionality, without having to rewrite the existing Servlets. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page. By using this predefined action, you don’t have to write your own Action class. You just have to set up the struts-config file properly to use ForwardAction.

93.What is IncludeAction?

The IncludeAction class is useful when you want to integrate Struts into an application that uses Servlets. Use the IncludeAction class to include another resource in the response to the request being processed.

94.What is the difference between ForwardAction and IncludeAction?

The difference is that you need to use the IncludeAction only if the action is going to be included by another action or jsp. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page.

95.Give the Details of XML files used in Validator Framework?

The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean.

96.How you will 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.

97.What is a scriptlet?

A scriptlet contains Java code that is executed every time a JSP is invoked. When a JSP is translated to a servlet, the scriptlet code goes into the service() method. Hence, methods and variables written in scriptlets are local to the service() method. A scriptlet is written between the <% and %> tags and is executed by the container at request processing time.

98.What are JSP declarations?

As the name implies, JSP declarations are used to declare class variables and methods in a JSP page. They are initialized when the class is initialized. Anything defined in a declaration is available for the whole JSP page. A declaration block is enclosed between the <%! and %> tags. A declaration is not included in the service() method when a JSP is translated to a servlet.

99.What is a JSP expression?

A JSP expression is used to write an output without using the out.print statement. It can be said as a shorthand representation for scriptlets. An expression is written between the <%= and %> tags. It is not required to end the expression with a semicolon, as it implicitly adds a semicolon to all the expressions within the expression tags.

100.How is scripting disabled?

Scripting is disabled by setting the scripting-invalid element of the deployment descriptor to true. It is a subelement of jsp-property-group. Its valid values are true and false. The syntax for disabling scripting is as follows:

101. What is the difference between session scope and request scope when saving FormBean?

The difference between session scope and request scope when saving FormBean are following:
In Request Scope, values of FormBean are available to current request but in Session Scope, values of FormBean are available throughout the session.

102. How to display validation errors on JSP page?

Validation error: Validation error are those error which arises when user or client enters the invalid format data into the form. For this validation of data struts enables the programmer with the Validator() method which validates both the data from client side and the server side.
We can display all error in the JSP page by using the following syntax in the code.
SYNTAX: <html:error/>

103. What are the Custom tags?

Custom Tags are User Defined Tags, which means that user can create those tags depending upon their need in the application.When a JSP page consisting of user- defined or custom tag is translated into a Servlet, the custom is also get translated into operation
Help in fast development of the application due to custom tag reusability.

104. What is the difference between empty default namespace and root namespace?

The difference between the empty default namespace and root name space are:
When namespace attribute is not defined then it is referred to as Empty Default Namespace whereas when name space attribute is assign with forward slash(/) then it is referred to as Root Name Space.
The root namespace must be matched.



This site uses Akismet to reduce spam. Learn how your comment data is processed.