java4all@1986 java. Powered by Blogger.

>> Friday, June 17, 2011

Q).What is the difference between the ActionError and ActionErrors class provided by the Struts Framework?
A).The org.apache.struts.action.ActionError class extends the org.apache.struts.action.ActionMessage class and reresents the single error message. The key attribute of the ActionError class is used to lookup a resource from the application resource bundle, "Internationalizing your struts application".
The org.apache.struts.action.ActionErrors class extends the org.apache.struts.action.ActionMessage class and represents a collection of ActionError classes. The ActionErrors class is composed of two contructors and a single method that allows you to add an ActionError object to the current collection of ActionErrors.

Q).What is the tiles framework in struts?
A).The tiles framework turns the concept of jsp:includes inside out. Developers can build pages by assembling reusable Tiles. You can think of Tiles as visual components.
A Tile and a Tile layout can be reused on more than one page. Tiles are other JSP pages or any web resource. Tile layouts dictate how the Tiles will be laid out on the page.

Q).How will you create a Tile layout view in your struts application?
A).To create a TIle layout, you must do the following:
  * Import the Tiles taglib into the JSP by using taglib directive.
  * Use string parameters to display such elements as the title of the page using the tiles:getAsStringTag.
  * Insert the Tiles in the correct regions of the layout using the tiles:insert tag.
  * Pass any needed parameters to the internal Tiles using the sub-tag of tiles:insert called tiles:put.

  Q).How will you use the Tile layout in your struts application?
  A).To use a Tile, You need to perform the following steps:
  * Import the Tiles taglib with the taglib directive.
  * Use tiles:insert tag to insert the Tile layout into the current page.
  * Use tile:put tag to pass string parameters.
  * Use tiles:put tag to pass parameter Tiles.

  Q).Describe the scope of the Tile in the Struts application?

  A).The Tiles framework defines an additional scope called Tile scope. Like page scope, Tile scope is more private than request scope. It allows the user of the Tile to pass arguments (called parameters) to the TIle. Like a display function, it makes the page callable.
Nested tiles do not share the same Tile scope as their parent. The Tile scope of the current Tile is saved before the nested Tile is displayed; after the nested Tile finishes, the parent's Tile scope is restored to the request.

Q).What is the difference between the jsp:include tag and tiles:insert tag?

A).The jsp:include tag allows you to call a page and pass it to request parameters (jsp:param); the tiles:insert tag is similar but more powerful. The tiles:insert allows you to call a page and pass it sub-pages (called Tiles) and attributes. Tile scope lets you pass variables that are available only to that Tile layout.

Q).How can you add a DataSource in your struts-config file?

A).The first component that we configure is a DataSource.

  <data-sources>       
     <data-source>        
         <set-property property="driverClass" value="com.mysql.jdbc.Driver"/>        
         <set-property property="url" value="jdbc:mysql://localhost:3306/mydb"/>
         <set-property property="user" value="root" />  
         <set-property property="password" value="password" />     
     </data-source>
  </data-sources>

0 comments:

Post a Comment

FaceBook Login

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

Total Pageviews

STATCOUNTER

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP