Monday, 26 December 2011

Java interview questions: - How to configure tag libraries in Struts 1.xx version?

Following are the steps to configure tag libraries in Struts 1.xx version.

Manual configuration:

Used in Struts version less than or equal 1.1

Step 1:  Download struts-bean.tld, struts-html.tld, struts-logic.tld and struts-tiles.tld and put the same in WEB-INF

Step 2:  Declare the taglib uri in web.xml

And so on

Step 3: Access the same in Jsp
Automatic Configuration:

Used in Struts version 1.2, 1.3

Step 1:

Download struts-taglib.jar and put the jar in WEB-INF/lib

(All the tld are present in struts-taglib.jar\META-INF\tld)

Step 2: Access the tlds in Jsp

Also see the following interesting video on Struts: -

Know more on  Java interview questions


Get more on Java/Struts interview questions from author’s blog

Wednesday, 21 December 2011

Java interview questions: - Mention the predefined result struts.

In Struts 2 there are certain pre-defined result types which along with its function are explained as below.

Result typeFunction
Chain ResultAction Chaining
Dispatcher Result web resource integration,
includingJSP integration
FreeMarker Result FreeMarker integration
HttpHeader Result control special HTTP behaviors
Redirect Result redirect to another URL (web resource)
Redirect Action Resultredirect to another action mapping
Stream Resultstream an InputStream back to the
browser (usually for file downloads)
Velocity ResultVelocity integration
XSL ResultXML/XSLT integration
PlainTextdisplay the raw content of a particular
page (i.e jsp, HTML)
Tiles Resultprovide Tiles integration

View the following video on Bean Tag with Struts 2 as follows: -

For more on  Java interview questions, so click and visit.


Author’s more on Java interview questions

Thursday, 15 December 2011

Java interview questions: - In hibernate framework explain the core interfaces of it?

This is one of the most favorite  Java interview questions of the interviewer. So in the following way one can answer this question: -

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

Session Factory Interface
This is a factory that delivers the session objects to hibernate application.

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 hbm documents

Transaction Interface
This interface abstracts the code from any kind of transaction implementations such as JDBC transaction, JTA transaction

Query and Criteria Interface
This interface allows the user to perform queries and also control the flow of the query execution

Following is the video where it is shown practically to implement Many To One relation in database using Hibernate: -

Click and get to see more on  Java/J2EE interview questions series.


Also visit author’s blog for more Java/J2EE interview questions

Thursday, 8 December 2011

Java/Struts interview questions: - Elaborate the difference between Struts 1.x and Struts 2.x

Struts 1.xStruts 2.x
Configuration of ActionServlet via servletConfiguration of FilterDispatcher is via filters
Struts1 extends the abstract base class
by its action class
Implements Action interface but not a compulsion.
 Any POJO class can behave like Action
Follows FrontController patternFollows FilterDispacther pattern
Extra care has to be taken to make resources
 thread safe because Actions are singletons
Action objects are instantiated for each request and
 hence are inherently thread safe
Testing is a problem since execute() method
exposes Servlet API
Testing is easier
ActionForms serves are inputAny POJO can serve as input
Binds objects in page using standard mechanismBinds objects using valuestack
Type conversions are using common-beanutils.jarType conversions are using OGNL
General notation for config file is Struts-config.xml
 is used
General notation for config file is struts.xml
No concept of namespaceNamespace are readily available for modularity

Also see the following interesting video on Struts: -

Know more on  Java/Struts interview questions


Get more on Java/Struts interview questions from author’s blog