How can you add a DataSource in your struts-config file?
The first component that we configure is a DataSource.
<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" />
What is Tile controllers? How will you create your own Tile Controllers?
If you are putting too much java code into your Tile layout, or you have to put the same Java code into every Action that forwards to a page that uses a particular Tile layout, then you should use the Tile Controller.
The Controller class is similar to an Action. You can map model objects into scope so that the Tile can display the items. To write a Tile Controller, follow these steps:
* Create a class that implements org.apache.struts.tiles.Controller.
* Implement the perform method.
* In the perform method, do something with the model and map the results into scope so that Tile can use it. Reply
What is the difference between tiles:importAttribute and tiles:useAttribute tag in the Tiles framework?
The tiles:importAttribute tag imports all of the attributes in Tile scope into page scope. It is similar to the tiles:useAttribute tag. It is lazy, dirty and cheap.Reply
What is the difference between the jsp:include tag and tiles:insert tag?
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. Reply
How will you use the the JSP Tile definition in your struts application?
To use a Tile definition, follow these steps:
* Import the Tiles taglib with taglib directive.
* Include the JSP page that creates the definition by using jsp:include.
* Use the tiles:insert tag, but specify the definition bean name and scope instead of the Tile layout page.
* Use the tiles:put attribute to specify the title and content but not header and footer parameters.Reply
How will you create the the JSP Tile definition?
Definitions specify default parameters for Tile layouts. You can create definitions in JSP or XML. To create a JSP Tile Definition, follow the following steps:
* Import the Tiles tag library using the taglib directive.
* Ensure that the definition is created only once using the logic:notPresent tag.
* Define the definition with the tiles:definition tag and pass the JSP that defines the Tile layout and the scope of the newly created definition.
* Define the default parameters with the tiles:put tag.Reply
How will you use the Tile layout in your struts application?
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.Reply
How will you create a Tile layout view in your struts application?
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.Reply
What is the tiles framework in struts?
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.Reply
What is for <html:errors/> tag provided by Struts specific JSP tag library.
The <html:errors/> tag is used to display the ActionError objects stored in ActionErrors collection.Reply