Java

How can we make message resources definitions file available to the Struts framework environment?

We can make message resources definitions file (properties file) available to Struts framework environment by adding this file to struts-config.xml.

<message-resources parameter=”com.login.struts.ApplicationResources”/>

What is preinitialization of a servlet?

A container does not initialize the servlets as soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the element, which can be specified in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request comes in is called preloading or preinitializing a servlet.

How do you invoke Stored Procedures?

<sql-query name="selectAllEmployees_SP" callable="true">
 <return alias="emp">
   <return-property name="empid" column="EMP_ID"/>
   <return-property name="name" column="EMP_NAME"/>       
   <return-property name="address" column="EMP_ADDRESS"/>
    { ? = call selectAllEmployees() }
 </return>
</sql-query>

What are differences between struts and JSF?

In a nutshell, Faces has the following advantages over Struts:

  • Eliminated the need for a Form Bean
  • Eliminated the need for a DTO Class
  • Allows the use of the same POJO on all Tiers because of the Backing Bean

The primary advantages of Struts as compared to JavaServer Faces technology are as follows:

  • Because Struts is a web application framework, it has a more sophisticated controller architecture than does JavaServer Faces technology. It is more sophisticated partly because the application developer can access the controller by creating an Action object that can integrate with the controller, whereas JavaServer Faces technology does not allow access to More >

Does WebLogic support auto generating primary keys for entity beans?

Yes, this feature was added in WLS 6.1

How should I obtain my JDBC connection so that it participates in the EJB container’s transaction?

You must get your JDBC connection from a TxDataSource or from the JTS driver. If you get a JDBC connections from a plain DataSource or directly from the JDBC driver, it will NOT participate in the EJB container transaction.

TxDataSources are recommended instead of accessing the JTS driver directly. TxDataSources are the standard mechanism in JDBC 2.0 for connection pooling, and they support 2PC/XA transactions.

My transaction aborted, but my database changes did not rollback.

See previous question. You must obtain your JDBC connections from a TxDataSource.

Why did my JDBC code throw a rollback SQLException?

Your JDBC code may throw the following exception:

“The coordinator has rolled back the transaction.

No further JDBC access is allowed within this transaction.”

The WebLogic JTS JDBC driver throws this exception when the current JDBC connection transaction rolls back prior to or during the JDBC call. This exception indicates that the transaction in which the JDBC connection was participating was rolled back at some point prior to or during the JDBC call.

The rollback may have happened in an earlier EJB invoke that was part of the transaction, or the rollback may have occurred because the transaction timed out. In either case, the transaction will More >

Can I use a join or intermediate table to implement a One-Many relationship?

This is currently not supported. One-Many relationships require that the bean on the Many side of the relationship contain a foreign-key in one of its tables.

When should I use a Stateful session bean and when should I use a servlet session?

The answer to this question is very application-specific and there are situations in which either approach will work. A stateful session bean provides declaritive transaction and security checking as well as failover to a secondary in a cluster.