Explore topic-wise InterviewSolutions in Current Affairs.

This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.

1.

What Is Attribute Oriented Programming?

Answer»

XDoclet has brought the concept of attribute-oriented programming to Java. Until JDK 1.5, the Java language had no support for ANNOTATIONS; now XDoclet uses the Javadoc tag FORMAT (@attribute) to SPECIFY class-, field-, or method-level metadata attributes. These attributes are used to generate hibernate mapping file automatically when the application is built. This KIND of programming that WORKS on attributes is called as Attribute Oriented Programming.

XDoclet has brought the concept of attribute-oriented programming to Java. Until JDK 1.5, the Java language had no support for annotations; now XDoclet uses the Javadoc tag format (@attribute) to specify class-, field-, or method-level metadata attributes. These attributes are used to generate hibernate mapping file automatically when the application is built. This kind of programming that works on attributes is called as Attribute Oriented Programming.

2.

What Is Hql?

Answer»

HQL STANDS for Hibernate QUERY Language. Hibernate allows the USER to express queries in its own portable SQL extension and this is called as HQL. It ALSO allows the user to express in native SQL.

HQL stands for Hibernate Query Language. Hibernate allows the user to express queries in its own portable SQL extension and this is called as HQL. It also allows the user to express in native SQL.

3.

What Is Object/relational Mapping Metadata?

Answer»

ORM tools require a metadata format for the APPLICATION to SPECIFY the mapping between classes and tables, properties and columns, associations and foreign keys, Java types and SQL types. This information is called the object/relational mapping metadata. It defines the TRANSFORMATION between the different data type SYSTEMS and relationship representations.

ORM tools require a metadata format for the application to specify the mapping between classes and tables, properties and columns, associations and foreign keys, Java types and SQL types. This information is called the object/relational mapping metadata. It defines the transformation between the different data type systems and relationship representations.

4.

What Are Pojos?

Answer»

POJO stands for plain old java objects. These are just basic JAVABEANS that have DEFINED SETTER and getter methods for all the properties that are there in that bean. Besides they can also have some business logic related to that property. Hibernate applications works efficiently with POJOS RATHER then simple java classes.

POJO stands for plain old java objects. These are just basic JavaBeans that have defined setter and getter methods for all the properties that are there in that bean. Besides they can also have some business logic related to that property. Hibernate applications works efficiently with POJOs rather then simple java classes.

5.

What Should Sessionfactory Be Placed So That It Can Be Easily Accessed?

Answer»

As far as it is compared to J2EE environment, if the SESSIONFACTORY is PLACED in JNDI then it can be easily ACCESSED and SHARED between different threads and various components that are hibernate aware. You can set the SessionFactory to a JNDI by configuring a property hibernate. session_ factory_ name in the hibernate. properties file.

As far as it is compared to J2EE environment, if the SessionFactory is placed in JNDI then it can be easily accessed and shared between different threads and various components that are hibernate aware. You can set the SessionFactory to a JNDI by configuring a property hibernate. session_ factory_ name in the hibernate. properties file.

6.

What Does Hibernate.properties File Consist Of?

Answer»

This is a property file that should be PLACED in application CLASS path. So when the Configuration object is created, hibernate is first initialized. At this MOMENT the application will AUTOMATICALLY detect and read this hibernate.properties file.
hibernate.connection.datasource = JAVA:/comp/env/jdbc/AuctionDB
hibernate.transaction.factory_class =
net.sf.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class =
net.sf.hibernate.transaction.JBossTransactionManagerLookup
hibernate.dialect = net.sf.hibernate.dialect.PostgreSQLDialect 

This is a property file that should be placed in application class path. So when the Configuration object is created, hibernate is first initialized. At this moment the application will automatically detect and read this hibernate.properties file.
hibernate.connection.datasource = java:/comp/env/jdbc/AuctionDB
hibernate.transaction.factory_class =
net.sf.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class =
net.sf.hibernate.transaction.JBossTransactionManagerLookup
hibernate.dialect = net.sf.hibernate.dialect.PostgreSQLDialect 

7.

What Is Meant By Method Chaining?

Answer»

METHOD chaining is a programming technique that is supported by many hibernate interfaces. This is LESS READABLE when COMPARED to actual java code. And it is not mandatory to use this format. Look how a SESSIONFACTORY is created when we use method chaining.

SessionFactory sessions = new Configuration()
.addResource("myinstance/MyConfig.hbm.xml")
.setProperties( System.getProperties() )
.buildSessionFactory(); 

Method chaining is a programming technique that is supported by many hibernate interfaces. This is less readable when compared to actual java code. And it is not mandatory to use this format. Look how a SessionFactory is created when we use method chaining.

SessionFactory sessions = new Configuration()
.addResource("myinstance/MyConfig.hbm.xml")
.setProperties( System.getProperties() )
.buildSessionFactory(); 

8.

What Do You Create A Sessionfactory?

Answer»

Configuration cfg = new Configuration();
cfg.addResource("myinstance/MyConfig.hbm.xml");
cfg.setProperties( System.getProperties() );
SessionFactory SESSIONS = cfg.buildSessionFactory();
First, we need to create an INSTANCE of Configuration and USE that instance to refer to the location of the configuration file. After configuring this instance is USED to create the SessionFactory by calling the method buildSessionFactory(). 

Configuration cfg = new Configuration();
cfg.addResource("myinstance/MyConfig.hbm.xml");
cfg.setProperties( System.getProperties() );
SessionFactory sessions = cfg.buildSessionFactory();
First, we need to create an instance of Configuration and use that instance to refer to the location of the configuration file. After configuring this instance is used to create the SessionFactory by calling the method buildSessionFactory(). 

9.

What Is The File Extension You Use For Hibernate Mapping File?

Answer»

The NAME of the FILE should be like this : filename.hbm.xml
The filename VARIES here. The extension of these files should be “.hbm.xml”.
This is just a convention and it’s not mandatory. But this is the BEST practice to follow this extension.

The name of the file should be like this : filename.hbm.xml
The filename varies here. The extension of these files should be “.hbm.xml”.
This is just a convention and it’s not mandatory. But this is the best practice to follow this extension.

10.

What Are Different Environments To Configure Hibernate?

Answer»

There are mainly TWO types of environments in which the configuration of hibernate application differs.
i. Managed environment – In this kind of environment everything from database connections, transaction boundaries, SECURITY levels and all are defined. An EXAMPLE of this kind of environment is environment provided by application servers such as JBOSS, Weblogic and WebSphere.
ii. Non-managed environment – This kind of environment provides a basic configuration template. Tomcat is one of the best examples that provide this kind of environment.

There are mainly two types of environments in which the configuration of hibernate application differs.
i. Managed environment – In this kind of environment everything from database connections, transaction boundaries, security levels and all are defined. An example of this kind of environment is environment provided by application servers such as JBoss, Weblogic and WebSphere.
ii. Non-managed environment – This kind of environment provides a basic configuration template. Tomcat is one of the best examples that provide this kind of environment.

11.

What Are The Extension Interfaces That Are There In Hibernate?

Answer»

There are many extension interfaces PROVIDED by hibernate.
ProxyFactory INTERFACE - used to CREATE proxies
ConnectionProvider interface – used for JDBC connection management
TransactionFactory interface – Used for transaction management
Transaction interface – Used for transaction management
TransactionManagementLookup interface – Used in transaction management.
Cahce interface – provides caching techniques and strategies
CacheProvider interface – same as CACHE interface
ClassPersister interface – provides ORM strategies
IdentifierGenerator interface – used for primary key generation
Dialect abstract class – provides SQL support. 

There are many extension interfaces provided by hibernate.
ProxyFactory interface - used to create proxies
ConnectionProvider interface – used for JDBC connection management
TransactionFactory interface – Used for transaction management
Transaction interface – Used for transaction management
TransactionManagementLookup interface – Used in transaction management.
Cahce interface – provides caching techniques and strategies
CacheProvider interface – same as Cache interface
ClassPersister interface – provides ORM strategies
IdentifierGenerator interface – used for primary key generation
Dialect abstract class – provides SQL support. 

12.

What Are Extension Interfaces?

Answer»

When the built-in FUNCTIONALITIES PROVIDED by HIBERNATE is not sufficient enough, itprovides a way so that user can include other INTERFACES and implement those interfaces for user desire functionality. These interfaces are called as Extension interfaces.

When the built-in functionalities provided by hibernate is not sufficient enough, itprovides a way so that user can include other interfaces and implement those interfaces for user desire functionality. These interfaces are called as Extension interfaces.

13.

What Are Callback Interfaces?

Answer»

These interfaces are used in the application to receive a notification when some OBJECT events occur. Like when an object is loaded, saved or DELETED. There is no need to IMPLEMENT callbacks in hibernate APPLICATIONS, but they’re useful for implementing certain KINDS of generic functionality. 

These interfaces are used in the application to receive a notification when some object events occur. Like when an object is loaded, saved or deleted. There is no need to implement callbacks in hibernate applications, but they’re useful for implementing certain kinds of generic functionality. 

14.

What The Core Interfaces Are Of Hibernate Framework?

Answer»

There are many benefits from these. Out of which the FOLLOWING are the most important one.

i. 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. 
ii. 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.
iii. 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.
iv. 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.
v. Query and Criteria Interface – This interface allows the user to perform queries and ALSO control the flow of the query execution. 

There are many benefits from these. Out of which the following are the most important one.

i. 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. 
ii. 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.
iii. 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.
iv. 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.
v. Query and Criteria Interface – This interface allows the user to perform queries and also control the flow of the query execution. 

15.

What Is A Hibernate Xml Mapping Document And How Does It Look Like?

Answer»

In order to make most of the things work in hibernate, usually the information is provided in an xml document. This document is called as xml mapping document. The document defines, among other things, how properties of the user defined persistence classes’ map to the columns of the RELATIVE tables in database.

<?xml VERSION="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC
"HTTP://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<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 under <hibernate-mapping> tag. This is the MAIN tag for an xml mapping document. 

In order to make most of the things work in hibernate, usually the information is provided in an xml document. This document is called as xml mapping document. The document defines, among other things, how properties of the user defined persistence classes’ map to the columns of the relative tables in database.

<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<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 under <hibernate-mapping> tag. This is the main tag for an xml mapping document. 

16.

How Does Hibernate Code Looks Like?

Answer»

Session session = getSessionFactory().openSession();
Transaction TX = session.beginTransaction();
MyPersistanceClass mpc = new MyPersistanceClass ("SAMPLE App");
session.save(mpc);
tx.commit();
session.close();
The Session and Transaction are the INTERFACES PROVIDED by hibernate. There are MANY other interfaces besides this. 

Session session = getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
MyPersistanceClass mpc = new MyPersistanceClass ("Sample App");
session.save(mpc);
tx.commit();
session.close();
The Session and Transaction are the interfaces provided by hibernate. There are many other interfaces besides this. 

17.

What Are The Benefits Of Orm And Hibernate?

Answer»

There are many benefits from these. Out of which the following are the most important one.
i. Productivity – Hibernate reduces the burden of developer by providing much of the functionality and let the developer to concentrate on BUSINESS logic.
ii. MAINTAINABILITY – As hibernate provides most of the functionality, the LOC for the application will be reduced and it is easy to maintain. By automated object/relational persistence it even reduces the LOC.
iii. Performance – Hand-coded persistence provided greater performance than automated one. But this is not true all the times. But in hibernate, it provides more optimization that works all the TIME there by increasing the performance. If it is automated persistence then it still increases the performance.
iv. Vendor INDEPENDENCE – Irrespective of the different types of databases that are there, hibernate provides a much easier way to develop a cross platform application. 

There are many benefits from these. Out of which the following are the most important one.
i. Productivity – Hibernate reduces the burden of developer by providing much of the functionality and let the developer to concentrate on business logic.
ii. Maintainability – As hibernate provides most of the functionality, the LOC for the application will be reduced and it is easy to maintain. By automated object/relational persistence it even reduces the LOC.
iii. Performance – Hand-coded persistence provided greater performance than automated one. But this is not true all the times. But in hibernate, it provides more optimization that works all the time there by increasing the performance. If it is automated persistence then it still increases the performance.
iv. Vendor independence – Irrespective of the different types of databases that are there, hibernate provides a much easier way to develop a cross platform application. 

18.

What Is Meant By Full Object Mapping?

Answer»

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. 

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. 

19.

What Is A Meant By Medium Object Mapping?

Answer»

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. 

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. 

20.

What Is A Meant By Light Object Mapping?

Answer»

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.

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.

21.

What Is A Pure Relational Orm?

Answer»

The entire APPLICATION, including the USER INTERFACE, is DESIGNED around the relational MODEL and SQL-based relational operations.

The entire application, including the user interface, is designed around the relational model and SQL-based relational operations.

22.

What Are The Different Levels Of Orm Quality?

Answer»

There are four levels defined for ORM quality.
i. PURE relational
II. Light OBJECT MAPPING
iii. Medium object mapping
iv. FULL object mapping.

There are four levels defined for ORM quality.
i. Pure relational
ii. Light object mapping
iii. Medium object mapping
iv. Full object mapping.

23.

What Does An Orm Solution Comprises Of?

Answer»

• It should have an API for performing basic CRUD (CREATE, Read, Update, DELETE) operations on objects of persistent classes.
• Should have a language or an API for SPECIFYING queries that refer to the classes and the PROPERTIES of classes.
• An ability for specifying mapping metadata.
• It should have a technique for ORM implementation to INTERACT with transactional objects to perform dirty checking, lazy association fetching, and other optimization functions.

• It should have an API for performing basic CRUD (Create, Read, Update, Delete) operations on objects of persistent classes.
• Should have a language or an API for specifying queries that refer to the classes and the properties of classes.
• An ability for specifying mapping metadata.
• It should have a technique for ORM implementation to interact with transactional objects to perform dirty checking, lazy association fetching, and other optimization functions.

24.

What Is Orm?

Answer»

ORM stands for Object/Relational mapping. It is the programmed and translucent PERSEVERANCE of OBJECTS in a Java application in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It WORKS by transforming the data from one representation to ANOTHER.

ORM stands for Object/Relational mapping. It is the programmed and translucent perseverance of objects in a Java application in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another.

25.

What Is Hibernate?

Answer»

Hibernate is a powerful, high performance object/relational persistence and query service.

This lets the USERS to develop persistent classes following object-oriented principles such as ASSOCIATION, inheritance, POLYMORPHISM, COMPOSITION, and collections.

Hibernate is a powerful, high performance object/relational persistence and query service.

This lets the users to develop persistent classes following object-oriented principles such as association, inheritance, polymorphism, composition, and collections.

26.

Declarative Exception Handling

Answer»

If you have developed web applications long enough, you will realize a recurring pattern emerges: when the backend (e.g. the EJB TIER) throws you an exception, you nearly always need to display an error page corresponding to the type of that exception. Sooner or later, you will come up with a mechanism to use a lookup table (e.g. an HashMap) to lookup an error page from the exception class. 

Struts 1.1 now provides a similar but more powerful mechanism to declare exception HANDLING. In Struts 1.1, you can declare in the struts-config.xml the ASSOCIATIONS between an exception class and an exception HANDLER. Using the default exception handler included in Struts, you can also specify the path of the error pages. With this INFORMATION, Struts will automatically forward to the specified pages when an uncaught exception is thrown from an Action. 

Like other facilities in Struts, the exception handlers are pluggable. You can write and define your own handler classes if needed. 

If you have developed web applications long enough, you will realize a recurring pattern emerges: when the backend (e.g. the EJB tier) throws you an exception, you nearly always need to display an error page corresponding to the type of that exception. Sooner or later, you will come up with a mechanism to use a lookup table (e.g. an HashMap) to lookup an error page from the exception class. 

Struts 1.1 now provides a similar but more powerful mechanism to declare exception handling. In Struts 1.1, you can declare in the struts-config.xml the associations between an exception class and an exception handler. Using the default exception handler included in Struts, you can also specify the path of the error pages. With this information, Struts will automatically forward to the specified pages when an uncaught exception is thrown from an Action. 

Like other facilities in Struts, the exception handlers are pluggable. You can write and define your own handler classes if needed. 

27.

How Can I Avoid Validating A Form Before Data Is Entered?

Answer»

The simplest way is to have two actions. The first one has the job of setting the form data, i.e. a blank registration screen. The second action in our WRITES the registration data to the database. Struts would take care of invoking the VALIDATION and returning the user to the correct screen if validation was not COMPLETE

The EditRegistration action in the struts example application illustrates this: 

< action path="/editRegistration">
type="org.apache.struts.webapp.example.EditRegistrationAction"
attribute="registrationForm"
scope="request"
VALIDATE="false">
<forward name="SUCCESS path="/registration.jsp"/>
</action>

When the /editRegistration action is invoked, a registrationForm is created and added to the request, but its validate method is not called. The default value of the validate attribute is true, so if you do not want an action to trigger form validation, you need to remember to add this attribute and set it to false.

The simplest way is to have two actions. The first one has the job of setting the form data, i.e. a blank registration screen. The second action in our writes the registration data to the database. Struts would take care of invoking the validation and returning the user to the correct screen if validation was not complete. 

The EditRegistration action in the struts example application illustrates this: 

< action path="/editRegistration">
type="org.apache.struts.webapp.example.EditRegistrationAction"
attribute="registrationForm"
scope="request"
validate="false">
<forward name="success path="/registration.jsp"/>
</action>

When the /editRegistration action is invoked, a registrationForm is created and added to the request, but its validate method is not called. The default value of the validate attribute is true, so if you do not want an action to trigger form validation, you need to remember to add this attribute and set it to false.

28.

When Is The Best Time To Validate Input?

Answer»

This is an excellent question. Let's step back a second and think about a typical mid to large size application. If we start from the back end and work TOWARD the view we have:
1) DATABASE: Most modern databases are going to validate for required fields, duplicate records, security constraints, etc. 
2) Business Logic: Here you are going to check for valid data relationships and things that make sense for the particular problem you are triing to SOLVE
... This is where struts comes into the picture, by now the system should be pretty well bulletproof. What we are going to do is make validation friendlier and informative. Rember it is OK to have duplicate validations... 
3) ActionErrors validate(ActionMapping map, HttpServletRequest req) is where you can do your validation and feed back to the view, information required to correct any errors. validate is run after the form has been reset and after the ActionForm properties have been set from corresponding view based input. Also remember you can turn validation off with validate="false" in the action mapping in the struts-config.xml. This is done by RETURNING an ActionErrors collection with messages from your ApplicationResources.properties file. 
Here you have access to the request so you can see what kinds of action is being requested to fine tune your validations. The <html:error> tag allows you to dump all errors on your page or a particular error associated with a particular property. The input attribute of the struts-config.xml action allows you to send validation errors to a particular jsp / html / tile page. 
4) You can have the system perform low level validations and client side feedback using a ValidatorForm or its derivatives. This will generate javascript and GIVE instant feedback to the user for simple data entry errors. You code your validations in the validator-rules.xml file. A working knowledge of regular expressions is necessary to use this feature effectively.

This is an excellent question. Let's step back a second and think about a typical mid to large size application. If we start from the back end and work toward the view we have:
1) Database: Most modern databases are going to validate for required fields, duplicate records, security constraints, etc. 
2) Business Logic: Here you are going to check for valid data relationships and things that make sense for the particular problem you are triing to solve. 
... This is where struts comes into the picture, by now the system should be pretty well bulletproof. What we are going to do is make validation friendlier and informative. Rember it is OK to have duplicate validations... 
3) ActionErrors validate(ActionMapping map, HttpServletRequest req) is where you can do your validation and feed back to the view, information required to correct any errors. validate is run after the form has been reset and after the ActionForm properties have been set from corresponding view based input. Also remember you can turn validation off with validate="false" in the action mapping in the struts-config.xml. This is done by returning an ActionErrors collection with messages from your ApplicationResources.properties file. 
Here you have access to the request so you can see what kinds of action is being requested to fine tune your validations. The <html:error> tag allows you to dump all errors on your page or a particular error associated with a particular property. The input attribute of the struts-config.xml action allows you to send validation errors to a particular jsp / html / tile page. 
4) You can have the system perform low level validations and client side feedback using a ValidatorForm or its derivatives. This will generate javascript and give instant feedback to the user for simple data entry errors. You code your validations in the validator-rules.xml file. A working knowledge of regular expressions is necessary to use this feature effectively.

29.

Can You Give Me A Simple Example Of Using The Requiredif Validator Rule?

Answer»

First off, there's an even newer Validator RULE called validwhen, which is almost certainly what you want to USE, since it is much easier and more powerful. It will be available in the first release after 1.1 ships. 
The example shown below could be coded with validwhen as:

<form name="medicalStatusForm">

<field
property="pregnancyTest" depends="validwhen">
<arg0 key="medicalStatusForm.pregnancyTest.label"/>
<var>
<var-name>TEST</var-name>
<var-value>((((SEX == 'm') OR (sex == 'M')) 
AND (*this* == null)) OR (*this* != null))</test>
</var>
</field>

Let's assume you have a medical information form
with THREE fields,
sex, pregnancyTest, and testResult. If sex is 'f' or 'F', 
pregnancyTest is required. If pregnancyTest is not blank, 
testResult is required. The entry in your validation.xml 
file would look like this:

<form name="medicalStatusForm">

<field
property="pregnancyTest" depends="requiredif">
<arg0 key="medicalStatusForm.pregnancyTest.label"/>
<var>
<var-name>field[0]</var-name>
<var-value>sex</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>EQUAL</var-value>
</var>
<var>
<var-name>fieldValue[0]</var-name>
<var-value>F</var-value>
</var>
<var>
<var-name>field[1]</var-name>
<var-value>sex</var-value>
</var>
<var>
<var-name>fieldTest[1]</var-name>
<var-value>EQUAL</var-value>
</var>
<var>
<var-name>fieldValue[1]</var-name>
<var-value>f</var-value>
</var>
<var>
<var-name>fieldJoin</var-name>
<var-value>OR</var-value>
</var>
</field>

<field
property="testResult" depends="requiredif">
<arg0 key="medicalStatusForm.testResult.label"/>
<var>
<var-name>field[0]</var-name>
<var-value>pregnancyTest</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>NOTNULL</var-value>
</var>
</field>
</form>

First off, there's an even newer Validator rule called validwhen, which is almost certainly what you want to use, since it is much easier and more powerful. It will be available in the first release after 1.1 ships. 
The example shown below could be coded with validwhen as:

<form name="medicalStatusForm">

<field
property="pregnancyTest" depends="validwhen">
<arg0 key="medicalStatusForm.pregnancyTest.label"/>
<var>
<var-name>test</var-name>
<var-value>((((sex == 'm') OR (sex == 'M')) 
AND (*this* == null)) OR (*this* != null))</test>
</var>
</field>

Let's assume you have a medical information form
with three fields,
sex, pregnancyTest, and testResult. If sex is 'f' or 'F', 
pregnancyTest is required. If pregnancyTest is not blank, 
testResult is required. The entry in your validation.xml 
file would look like this:

<form name="medicalStatusForm">

<field
property="pregnancyTest" depends="requiredif">
<arg0 key="medicalStatusForm.pregnancyTest.label"/>
<var>
<var-name>field[0]</var-name>
<var-value>sex</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>EQUAL</var-value>
</var>
<var>
<var-name>fieldValue[0]</var-name>
<var-value>F</var-value>
</var>
<var>
<var-name>field[1]</var-name>
<var-value>sex</var-value>
</var>
<var>
<var-name>fieldTest[1]</var-name>
<var-value>EQUAL</var-value>
</var>
<var>
<var-name>fieldValue[1]</var-name>
<var-value>f</var-value>
</var>
<var>
<var-name>fieldJoin</var-name>
<var-value>OR</var-value>
</var>
</field>

<field
property="testResult" depends="requiredif">
<arg0 key="medicalStatusForm.testResult.label"/>
<var>
<var-name>field[0]</var-name>
<var-value>pregnancyTest</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>NOTNULL</var-value>
</var>
</field>
</form>

30.

Can I Have An Action Without A Form?

Answer»

Yes. If your Action does not need any data and it does not need to make any data available to the view or controller component that it forwards to, it doesn't need a form. A good example of an Action with no ActionForm is the LogoffAction in the struts example application:

<action path="/logoff"
type="org.apache.struts.webapp.example.LogoffAction"&GT;
<forward NAME="SUCCESS" path="/index.jsp"/>
</action>

This action NEEDS no data other than the user's session, which it can get from the Request, and it doesn't need to prepare any view elements for display, so it does not need a form.

However, you cannot use the <html:form> tag without an ActionForm. Even if you want to use the <html:form> tag with a simple Action that does not REQUIRE input, the tag will expect you to use some type of ActionForm, even if it is an empty subclass without any properties.

Yes. If your Action does not need any data and it does not need to make any data available to the view or controller component that it forwards to, it doesn't need a form. A good example of an Action with no ActionForm is the LogoffAction in the struts example application:

<action path="/logoff"
type="org.apache.struts.webapp.example.LogoffAction">
<forward name="success" path="/index.jsp"/>
</action>

This action needs no data other than the user's session, which it can get from the Request, and it doesn't need to prepare any view elements for display, so it does not need a form.

However, you cannot use the <html:form> tag without an ActionForm. Even if you want to use the <html:form> tag with a simple Action that does not require input, the tag will expect you to use some type of ActionForm, even if it is an empty subclass without any properties.

31.

Do I Have To Use Jsps With My Application?

Answer»

The short answer to this question is: No, you are not limited to JavaServer PAGES
The LONGER answer is that you can use any type of presentation technology which can be returned by a web SERVER or Java container. The list includes but is not limited to: 
* JavaServer Pages,
* HTML pages,
* WML files,
* Java servlets,
* Velocity templates, and
* XML/XLST
Some people even mix and match apparently UNRELATED technologies, like PHP, into the same web APPLICATION.

The short answer to this question is: No, you are not limited to JavaServer Pages. 
The longer answer is that you can use any type of presentation technology which can be returned by a web server or Java container. The list includes but is not limited to: 
* JavaServer Pages,
* HTML pages,
* WML files,
* Java servlets,
* Velocity templates, and
* XML/XLST
Some people even mix and match apparently unrelated technologies, like PHP, into the same web application.

32.

Why Does The Option Tag Render Selected=selected Instead Of Just Selected?

Answer»

Attribute minimization (that is, specifying an attribute with no value) is a place where HTML violates standard XML syntax RULES. This matters a lot for people WRITING to BROWSERS that support XHTML, where doing so makes the page invalid. It's much better for STRUTS to use the expanded syntax, which works the same on existing browsers interpreting HTML, and newer browsers that EXPECT XHTML-compliant syntax. Struts is following the behavior recommended by the XHTML specification.

Attribute minimization (that is, specifying an attribute with no value) is a place where HTML violates standard XML syntax rules. This matters a lot for people writing to browsers that support XHTML, where doing so makes the page invalid. It's much better for Struts to use the expanded syntax, which works the same on existing browsers interpreting HTML, and newer browsers that expect XHTML-compliant syntax. Struts is following the behavior recommended by the XHTML specification.

33.

Why Does The Tag Url-encode Javascript And Mailto Links?

Answer»

The <html:link> tag is not intended for USE with client-side references like those used to launch Javascripts or email CLIENTS. The purpose of link tag is to interject the context (or module) path into the URI so that your server-side links are not dependent on your context (or module) NAME. It also encodes the link, as needed, to maintain the client's SESSION on the server. Neither feature applies to client-side links, so there is no reason to use the <html:link> tag. Simply markup the client-side links using the standard tag.

The <html:link> tag is not intended for use with client-side references like those used to launch Javascripts or email clients. The purpose of link tag is to interject the context (or module) path into the URI so that your server-side links are not dependent on your context (or module) name. It also encodes the link, as needed, to maintain the client's session on the server. Neither feature applies to client-side links, so there is no reason to use the <html:link> tag. Simply markup the client-side links using the standard tag.

34.

Why Do The Struts Tags Provide For So Little Formatting?

Answer»

The Struts tags seem to provide only the most rudimentary functionality. Why is there not better support for date formatting and advanced string handling? 

Three reasons: 

First, work started on the JSTL and we didn't want to duplicate the effort. 
Second, work started on Java Server Faces, and we didn't want to duplicate that effort either. 

Third, in a Model 2 application, most of the formatting can be HANDLED in the ActionForms (or in the business tier), so all the tag has to do is SPIT out a string. This leads to better reuse since the same "how to format" code does not need to be repeated in every INSTANCE. You can "say it once" in a JavaBean and be done with it. Why don't the Struts taglibs offer more layout options? 

Since the Struts tags are open source, you can extend them to provide whatever ADDITIONAL formatting you may need. If you are interested in a pre-written taglib that offers more layout options, see the struts-layout taglib. 

In the same arena, there is a well regarded CONTRIBUTOR taglib that can help you create Menus for your Struts applications.

The Struts tags seem to provide only the most rudimentary functionality. Why is there not better support for date formatting and advanced string handling? 

Three reasons: 

First, work started on the JSTL and we didn't want to duplicate the effort. 
Second, work started on Java Server Faces, and we didn't want to duplicate that effort either. 

Third, in a Model 2 application, most of the formatting can be handled in the ActionForms (or in the business tier), so all the tag has to do is spit out a string. This leads to better reuse since the same "how to format" code does not need to be repeated in every instance. You can "say it once" in a JavaBean and be done with it. Why don't the Struts taglibs offer more layout options? 

Since the Struts tags are open source, you can extend them to provide whatever additional formatting you may need. If you are interested in a pre-written taglib that offers more layout options, see the struts-layout taglib. 

In the same arena, there is a well regarded contributor taglib that can help you create Menus for your Struts applications.

35.

How Can I Scroll Through List Of Pages Like The Search Results In Google?

Answer»

MANY Struts DEVELOPERS USE the Pager from the JSPTags SITE.
HTTP://jsptags.com/tags/navigation/pager/

Many Struts developers use the Pager from the JSPTags site.
http://jsptags.com/tags/navigation/pager/

36.

Can I Use Javascript To Submit A Form?

Answer»

You can submit a form with a link as below. BTW, the examples below assume you are in an block and 'myForm' is picked up from the struts-config.xml name field of the action. 

<a href='javascript:void(document.forms["myForm"].submit()>My Link</a> 
Now the trick in the action is to decode what action you intend to perform. Since you are using JavaScript, you could set a field value and look for it in the request or in the form. 
... html/javascript part ... 
<input type='hidden' value='myAction' />
<input type='button' value='Save MEEEEE'
onclick='document.forms["myForm"].myAction.value="save";
document.forms["myForm"].submit();' />
<input type='button' value='Delete Meeeee'
onclick='document.forms["myForm"].myAction.value="delete";
document.forms["myForm"].submit();' />
... the java part ...
class MyAction extends ActionForm implements Serializable {

public ActionForward execute (ActionMapping map, ActionForm form,
HttpServletRequest req, HttpServletResponse) {

String myAction = req.getParameter("myAction");

if (myAction.equals("save") {
// ... save action ...
} else if (myAction.equals("delete") {
// ... delete action ...
}
}
}
}

This is just one of many WAYS to achieve submitting a form and decoding the INTENDED action. Once you get used to the framework you will find other ways that make more sense for your coding style and requirements. Just remember this example is completely non-functional without JavaScript.

You can submit a form with a link as below. BTW, the examples below assume you are in an block and 'myForm' is picked up from the struts-config.xml name field of the action. 

<a href='javascript:void(document.forms["myForm"].submit()>My Link</a> 
Now the trick in the action is to decode what action you intend to perform. Since you are using JavaScript, you could set a field value and look for it in the request or in the form. 
... html/javascript part ... 
<input type='hidden' value='myAction' />
<input type='button' value='Save Meeeee'
onclick='document.forms["myForm"].myAction.value="save";
document.forms["myForm"].submit();' />
<input type='button' value='Delete Meeeee'
onclick='document.forms["myForm"].myAction.value="delete";
document.forms["myForm"].submit();' />
... the java part ...
class MyAction extends ActionForm implements Serializable {

public ActionForward execute (ActionMapping map, ActionForm form,
HttpServletRequest req, HttpServletResponse) {

String myAction = req.getParameter("myAction");

if (myAction.equals("save") {
// ... save action ...
} else if (myAction.equals("delete") {
// ... delete action ...
}
}
}
}

This is just one of many ways to achieve submitting a form and decoding the intended action. Once you get used to the framework you will find other ways that make more sense for your coding style and requirements. Just remember this example is completely non-functional without JavaScript.

37.

Can't I Just Create Some Of My Javabeans In The Jsp Using A Scriptlet?

Answer»

Struts is designed to encourage a MODEL 2/MVC architecture. But there is nothing that prevents you from using Model 1 techniques in your JavaServer Pages, so the answer to the question is "Yes, you can". 

Though, using Model 1 techniques in a Struts application does go against the grain. The approach recommended by most Struts developers is to create and populate whatever objects the view may need in the Action, and then forward these through the request. Some objects may also be created and stored in the session or context, depending on how they are used. 

Likewise, there is nothing to prevent you from using scriptlets along with JSP tags in your pages. Though, many Struts developers report writing very complex scriplet-free applications and recommend the JSP tag approach to OTHERS

For HELP with Model 1 techniques and scriptlets, you might consider joining the Javasoft JSP-interest mailing list, where there are more people still using these approaches.

Struts is designed to encourage a Model 2/MVC architecture. But there is nothing that prevents you from using Model 1 techniques in your JavaServer Pages, so the answer to the question is "Yes, you can". 

Though, using Model 1 techniques in a Struts application does go against the grain. The approach recommended by most Struts developers is to create and populate whatever objects the view may need in the Action, and then forward these through the request. Some objects may also be created and stored in the session or context, depending on how they are used. 

Likewise, there is nothing to prevent you from using scriptlets along with JSP tags in your pages. Though, many Struts developers report writing very complex scriplet-free applications and recommend the JSP tag approach to others. 

For help with Model 1 techniques and scriptlets, you might consider joining the Javasoft JSP-interest mailing list, where there are more people still using these approaches.

38.

Why Are My Checkboxes Not Being Set From On To Off?

Answer»

A problem with a checkbox is that the browser will only include it in the request when it is checked. If it is not checked, the HTML specification SUGGESTS that it not be sent (i.e. omitted from the request). If the value of the checkbox is being persisted, either in a session bean or in the model, a checked box can never unchecked by a HTML FORM -- because the form can never send a signal to UNCHECK the box. The application must somehow ascertain that since the element was not sent that the corresponding value is unchecked. 

The recommended approach for Struts applications is to use the reset method in the ActionForm to set all properties represented by checkboxes to null or false. The checked boxes submitted by the form will then set those properties to true. The omitted properties will remain false. Another solution is to use radio buttons instead, which always submit a value. 

It is IMPORTANT to note that the HTML specification recommends this same behavior WHENEVER a control is not "successful". Any blank element in a HTML form is not guaranteed to submitted. It is therefor very important to set the default values for an ActionForm correctly, and to implement the reset method when the ActionForm might kept in session scope.

A problem with a checkbox is that the browser will only include it in the request when it is checked. If it is not checked, the HTML specification suggests that it not be sent (i.e. omitted from the request). If the value of the checkbox is being persisted, either in a session bean or in the model, a checked box can never unchecked by a HTML form -- because the form can never send a signal to uncheck the box. The application must somehow ascertain that since the element was not sent that the corresponding value is unchecked. 

The recommended approach for Struts applications is to use the reset method in the ActionForm to set all properties represented by checkboxes to null or false. The checked boxes submitted by the form will then set those properties to true. The omitted properties will remain false. Another solution is to use radio buttons instead, which always submit a value. 

It is important to note that the HTML specification recommends this same behavior whenever a control is not "successful". Any blank element in a HTML form is not guaranteed to submitted. It is therefor very important to set the default values for an ActionForm correctly, and to implement the reset method when the ActionForm might kept in session scope.

39.

Why Doesn't The Focus Feature On The Tag Work In Every Circumstance?

Answer»

Unfortunately, there is some DISAGREEMENT between the various browsers, and different versions of the same browser, as to how the FOCUS can be SET. The <html:form> tag provides a QUICK and easy JavaScript that will set the focus on a form for most versions of most browsers. If this feature doesn't work for you, then you should set the focus using your own JavaScript. The focus feature is a convenient "value-add" -- not a CORE requirement of the tag. If you do come up with a JavaScript that provides the final solution to this project, please post your patch to this Bugzilla ticket.

Unfortunately, there is some disagreement between the various browsers, and different versions of the same browser, as to how the focus can be set. The <html:form> tag provides a quick and easy JavaScript that will set the focus on a form for most versions of most browsers. If this feature doesn't work for you, then you should set the focus using your own JavaScript. The focus feature is a convenient "value-add" -- not a core requirement of the tag. If you do come up with a JavaScript that provides the final solution to this project, please post your patch to this Bugzilla ticket.

40.

Can I Use Multiple Html Form Elements With The Same Name?

Answer»

YES. Define the element as an array and Struts will autopopulate it like any other. 
private STRING[] id= {};
public String[] getId() { RETURN this.id; }
public VOID setItem(String id[]) {this.id = id;}
And so forth

Yes. Define the element as an array and Struts will autopopulate it like any other. 
private String[] id= {};
public String[] getId() { return this.id; }
public void setItem(String id[]) {this.id = id;}
And so forth

41.

Do Actionforms Have To Be True Javabeans?

Answer»

The UTILITIES that Struts uses (Commons-BeanUtils since 1.1) require that ACTIONFORM properties follow the JavaBean patterns for mutators and accessors (GET*,SET*,is*). Since Struts uses the Introspection API with the ActionForms, some containers may require that all the JavaBean patterns be followed, including declaring "implements Serializable" for each subclass. The safest thing is to review the JavaBean specification and follow all the prescribed patterns.

Since Struts 1.1, you can also use DynaActionForms and mapped-backed forms, which are not TRUE JavaBeans. For more see ActionForm classes in the User Guide and Using Hashmaps with ActionForms in this FAQ.

The utilities that Struts uses (Commons-BeanUtils since 1.1) require that ActionForm properties follow the JavaBean patterns for mutators and accessors (get*,set*,is*). Since Struts uses the Introspection API with the ActionForms, some containers may require that all the JavaBean patterns be followed, including declaring "implements Serializable" for each subclass. The safest thing is to review the JavaBean specification and follow all the prescribed patterns.

Since Struts 1.1, you can also use DynaActionForms and mapped-backed forms, which are not true JavaBeans. For more see ActionForm classes in the User Guide and Using Hashmaps with ActionForms in this FAQ.

42.

Why Is Actionform A Base Class Rather Than An Interface?

Answer»

The MVC design pattern is very simple to understand but much more difficult to live with. You just need this little bit of BUSINESS Logic in the View logic or you need just that little bit of View logic in the Business tier and pretty SOON you have a real mess.

Making ActionForm a class takes advantage of the single inheritance restriction of Java to it MAKES it more difficult for people to do things that they should not do.

ActionForms implemented as interfaces encourage making the property types match the underlying business tier instead of Strings, which violates one of the PRIMARY purposes for ActionForms in the first place (the ability to reproduce invalid input, which is a fundamental user expectation). ActionForms as an interface would also encourage using existing DAO objects as ActionForms by adding implements ActionForm to the class. This violates the MVC design pattern goal of separation of the view and business logic. 

Since the goal of struts is to enforce this separation, it just makes more sense for Struts to own the ActionForm. 

DynaActionForms relieve developers of maintaining simple ActionForms. For near zero maintenance, TRY Niall Pemberton's LazyActionForm.

The MVC design pattern is very simple to understand but much more difficult to live with. You just need this little bit of Business Logic in the View logic or you need just that little bit of View logic in the Business tier and pretty soon you have a real mess.

Making ActionForm a class takes advantage of the single inheritance restriction of Java to it makes it more difficult for people to do things that they should not do.

ActionForms implemented as interfaces encourage making the property types match the underlying business tier instead of Strings, which violates one of the primary purposes for ActionForms in the first place (the ability to reproduce invalid input, which is a fundamental user expectation). ActionForms as an interface would also encourage using existing DAO objects as ActionForms by adding implements ActionForm to the class. This violates the MVC design pattern goal of separation of the view and business logic. 

Since the goal of struts is to enforce this separation, it just makes more sense for Struts to own the ActionForm. 

DynaActionForms relieve developers of maintaining simple ActionForms. For near zero maintenance, try Niall Pemberton's LazyActionForm.

43.

Why Are Some Of The Class And Element Names Counter-intuitive?

Answer»

The framework grew in the telling and, as it EVOLVED, some of the names drifted. The good THING about a nightly build, is that everything BECOMES available to the COMMUNITY as soon as it is written. The bad thing about a nightly build is that things like class names get locked down early and then BECOME difficult to change.

The framework grew in the telling and, as it evolved, some of the names drifted. The good thing about a nightly build, is that everything becomes available to the community as soon as it is written. The bad thing about a nightly build is that things like class names get locked down early and then become difficult to change.

44.

What Is A Modular Application? What Does Module-relative Mean?

Answer»

Since Struts 1.1, the framework supports multiple APPLICATION modules. All applications have at least one root, or default, module. Like the root directory in a file system, the default application has no NAME. (Or is named with an empty string, depending your viewpoint.) Developing an application with only a default module is no different from how applications were developed under Struts 1.0. Since Struts 1.1, you can add additional modules to your application, each of which can have their own CONFIGURATION FILES, messages resources, and so forth. Each module is developed in the same way as the default module. Applications that were developed as a single module can ADDED to a multiple module application, and modules can promoted to a standalone application without change. For more about configuring your application to support multiple modules, see Configuring Applications in the User Guide.

But to answer the question =:0), a modular application is a Struts application that uses more than one module. Module-relative means that the URI starts at the module level, rather than at the context level, or the absolute-URL level. 

* Absolute URL: http://localhost/myApplication/myModule/myAction.do
* context-relative: /myModule/myAction.do
* module-relative: /myAction.do
The Struts Examples application is a modular application that was assembled from several applications that were created independently.

Since Struts 1.1, the framework supports multiple application modules. All applications have at least one root, or default, module. Like the root directory in a file system, the default application has no name. (Or is named with an empty string, depending your viewpoint.) Developing an application with only a default module is no different from how applications were developed under Struts 1.0. Since Struts 1.1, you can add additional modules to your application, each of which can have their own configuration files, messages resources, and so forth. Each module is developed in the same way as the default module. Applications that were developed as a single module can added to a multiple module application, and modules can promoted to a standalone application without change. For more about configuring your application to support multiple modules, see Configuring Applications in the User Guide.

But to answer the question =:0), a modular application is a Struts application that uses more than one module. Module-relative means that the URI starts at the module level, rather than at the context level, or the absolute-URL level. 

* Absolute URL: http://localhost/myApplication/myModule/myAction.do
* context-relative: /myModule/myAction.do
* module-relative: /myAction.do
The Struts Examples application is a modular application that was assembled from several applications that were created independently.

45.

Why Was Reload Removed From Struts (since 1.1)?

Answer»

The problem with ReloadAction was that Struts was trying to act like a container, but it couldn't do a proper job of it. For EXAMPLE, you can't reload classes that have been modified, or (portably) add new classes to a running web application (even if the container supported it). 

Meanwhile, as Struts 1.1 was being developed, work PROGRESSED on THINGS like Tomcat's reload command via the Manager webapp. This feature allows you to quickly reload-on-demand, complete with saving and restoring your SESSION). It started to make even less sense for Struts to half-implement a feature that containers are implementing fully.

A more minor point is that freezing the configuration information at application startup time allows Struts to safely access the mapping information without bothering with synchronization. The "startup-only" strategy creates a modest but real improvement in performance for all users. 

So, ReloadAction is not supported since Struts 1.1 for two reasons:

* It never did let you reload everything that you would really WANT to -- particularly changed classes -- so many people ended up having to reload the webapp anyway.
* Containers are starting to offer reload-on-demand features which does the same thing as the Struts ReloadAction, only better.
* Not supporting ReloadAction lets Struts avoid doing synchronization locks around all the lookups (like figuring out which action to use, or the destination of an ActionForward) so applications can run a little faster.

Of course, if someone came up with an implementation that solved these problems without creating any others, we would not be opposed to including a new ReloadAction.

The problem with ReloadAction was that Struts was trying to act like a container, but it couldn't do a proper job of it. For example, you can't reload classes that have been modified, or (portably) add new classes to a running web application (even if the container supported it). 

Meanwhile, as Struts 1.1 was being developed, work progressed on things like Tomcat's reload command via the Manager webapp. This feature allows you to quickly reload-on-demand, complete with saving and restoring your session). It started to make even less sense for Struts to half-implement a feature that containers are implementing fully.

A more minor point is that freezing the configuration information at application startup time allows Struts to safely access the mapping information without bothering with synchronization. The "startup-only" strategy creates a modest but real improvement in performance for all users. 

So, ReloadAction is not supported since Struts 1.1 for two reasons:

* It never did let you reload everything that you would really want to -- particularly changed classes -- so many people ended up having to reload the webapp anyway.
* Containers are starting to offer reload-on-demand features which does the same thing as the Struts ReloadAction, only better.
* Not supporting ReloadAction lets Struts avoid doing synchronization locks around all the lookups (like figuring out which action to use, or the destination of an ActionForward) so applications can run a little faster.

Of course, if someone came up with an implementation that solved these problems without creating any others, we would not be opposed to including a new ReloadAction.

46.

Is There A Particularly Good Ide To Use With Struts?

Answer»

Struts should work well with any development environment that you WOULD like to use, as well as with any programmers EDITOR. The members of the Struts development TEAM each use their own tools such as EMACS, IDEA, Eclipse, and NETBEANS.

Struts should work well with any development environment that you would like to use, as well as with any programmers editor. The members of the Struts development team each use their own tools such as Emacs, IDEA, Eclipse, and NetBeans.

47.

What About Jstl And Javaserver Faces ?

Answer»

JSTL, the JavaServer Standard Tag Library, is a set of JSP tags that are designed to make it easier to DEVELOP Web applications. JavaServer Faces (JSF) is a specification for a new technology that promises to make it easier to write MVC applications, both for the Web and for the desktop. 

The inventor of Struts, Craig McClanahan, is the specification co-lead for JavaServer Faces (JSR 127), and architect of the REFERENCE implemenation as well as Java Studio Creator. Both JSTL and JSF are complementary to Struts. 

The mainstay of the Struts framework is the controller components, which can be used with any Java presentation technology. As new technologies become available, it is certain that new "glue" components will also APPEAR to help these technologies work as well with Struts.

Struts originally came bundled with a set of custom JSP tags. Today, several extensions are available to help you use Struts with other popular presentation technologies, like XSLT and VELOCITY. Likewise, extensions for JSTL and JSF are now available as well. 

The JSTL reference implementation is available through the Jakarta Taglibs site. A JSTL taglibs for Struts, Struts-El , is available and distributed with Struts beginning with the 1.1 release. 

The JSF specification and reference implementation is available through Sun's The JSF specification and reference implementation is available through Sun's Java ServerFaces page. An early-release JavaServer Faces taglib for Struts, Struts-Faces, is also in early release and available through the nightly build. The Struts Faces taglib is expected to work with any compliant JSF implementation, including MyFaces.

JSTL, the JavaServer Standard Tag Library, is a set of JSP tags that are designed to make it easier to develop Web applications. JavaServer Faces (JSF) is a specification for a new technology that promises to make it easier to write MVC applications, both for the Web and for the desktop. 

The inventor of Struts, Craig McClanahan, is the specification co-lead for JavaServer Faces (JSR 127), and architect of the reference implemenation as well as Java Studio Creator. Both JSTL and JSF are complementary to Struts. 

The mainstay of the Struts framework is the controller components, which can be used with any Java presentation technology. As new technologies become available, it is certain that new "glue" components will also appear to help these technologies work as well with Struts.

Struts originally came bundled with a set of custom JSP tags. Today, several extensions are available to help you use Struts with other popular presentation technologies, like XSLT and Velocity. Likewise, extensions for JSTL and JSF are now available as well. 

The JSTL reference implementation is available through the Jakarta Taglibs site. A JSTL taglibs for Struts, Struts-El , is available and distributed with Struts beginning with the 1.1 release. 

The JSF specification and reference implementation is available through Sun's The JSF specification and reference implementation is available through Sun's Java ServerFaces page. An early-release JavaServer Faces taglib for Struts, Struts-Faces, is also in early release and available through the nightly build. The Struts Faces taglib is expected to work with any compliant JSF implementation, including MyFaces.

48.

Will The Struts Tags Support Other Markup Languages Such As Wml ?

Answer»

Struts itself is markup neutral. The original Struts taglibs are only one example of how presentation LAYER components can access the framework. The framework objects are exposed through the STANDARD application, session, and request contexts, where any Java component in the application can make use of them.

Markup extensions that use Struts are available for VELOCITY and XLST, among others. A new Struts tag library for Java Server Faces is also in development.

For more about USING WAP/WML with Struts see the ARTICLE WAP up your EAserver.

Struts itself is markup neutral. The original Struts taglibs are only one example of how presentation layer components can access the framework. The framework objects are exposed through the standard application, session, and request contexts, where any Java component in the application can make use of them.

Markup extensions that use Struts are available for Velocity and XLST, among others. A new Struts tag library for Java Server Faces is also in development.

For more about using WAP/WML with Struts see the article WAP up your EAserver.

49.

Are The Struts Tags Xhtml Compliant ?

Answer»

If you USE an &LT;html:html XHTML="true> or <html:xhtml/> element on your page, the tags will RENDER as XHTML (since Struts 1.1).

If you use an <html:html xhtml="true> or <html:xhtml/> element on your page, the tags will render as XHTML (since Struts 1.1).

50.

Why Aren't The Struts Tags Maintained As Part Of The Jakarta Taglibs Project ?

Answer»

Development of both products began about the same TIME. Leading up to the release of 1.0, it was thought better to continue to develop the taglibs alongside the controller. Now that 1.0 is out, the JavaServer Pages Standard Taglib is in ACTIVE development. Once WORK on JSTL stabilizes, the Struts taglibs will be REVISITED. Tags which are not linked DIRECTLY to the framework may be hosted at Jakarta Taglibs instead.

Development of both products began about the same time. Leading up to the release of 1.0, it was thought better to continue to develop the taglibs alongside the controller. Now that 1.0 is out, the JavaServer Pages Standard Taglib is in active development. Once work on JSTL stabilizes, the Struts taglibs will be revisited. Tags which are not linked directly to the framework may be hosted at Jakarta Taglibs instead.