View Full Version: Struts

Pages :[ 1 ]

MongKiat
22 November 2007, 01:24
1) How to use Struts tag such as logic, bean, html tags?
http://www.javapassion.com/j2ee/StrutsTags_speakernoted.pdf
Few types of tags:
-Bean tags
-Html tags
-Logic tags

How to use tags:
They are defined in web.xml using <taglib> element, eg.
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
To use a tag:
<type of tag:method/>
Example:

<bean:write name="dvd" property="title" scope="request"/></bean:write>
-Retrieve the name and title using bean.

MongKiat
22 November 2007, 01:26
2) How to integrate Struts with AJAX or DOJO toolkit?
Information

Ajax integrates very easily with Struts.

An Ajax request can call any Struts action by simply sending the request to the correct URL.

Once there, the Ajax request is handled the same as any other HTTP request.

This, of course, means that the Ajax request has the same access to the Struts
Validation routines, form beans, and actions, and the benefits provided by each.

Struts and Ajax work very well together , and existing Struts applications can be easily
extended by adding Ajax functionality.

In many cases Ajax-style interactions can be added to an existing Struts application by
adding an Action that reuses existing functionality.


3) How to use Struts to validate user inputs?
Using struts – Action Form Beans
• Represents a form within the JSP page. Provide ease of use in accessing and validating of data submitted by the user.
• Return errors message if data submitted by user is not correct
• When user submits data via a form, the struts controller extracts the value and store them in an ActionForm. The values can then be retrieved by the application via the action form.
• Similarly, when displaying data to the user, the controller will retrieve the value from the Action Form and populate them to the HTML form.


4) How to integrate Struts with Hibernate?
Create new j2ee web project

Right click on project in package view add the hibernate capabilities

Check the hibernate libraries to the project ans select to create a new hibernate mapping file
The hibernate file holds the configuration of your hibernate settings and mappings

Ensure that the "Append hibernate 2.1 libraries to project classpath?" checkbox is checked


5) Using Web Services from Struts.
You can augment a well-architected Struts application to support Web services in future development. As noted, the Struts framework clearly demarcates a View, a Controller, and a Model. The Model contains all the business logic necessary to retrieve data from a persistent data store. You can build a simple Web service layer -- call it the WSManager layer -- so that the Model can either provide or subscribe to a Web service. An application that uses this architecture combines the best aspects of component-based development and the World Wide Web, as illustrated in the picture. The following sections discuss in detail the different components used in this architecture, paying particularly close attention to the WSManager layer, since that is the truly new portion of this architecture.

MongKiat
22 November 2007, 01:29
Here's the picture for question 5.

user posted image

free poker
01 April 2008, 19:07
QUOTE (MongKiat @ Nov 22 2007, 06:24 AM)
blooomz-4ychwz6-tw6q7cae-0 <a href="http://www.cys.ru/forward.html?url=bestsslscripts.com/cys/soma.html#2">soma</a>
http://www.archive.org/search.php?query=fr...slots.html%3E#1
casinos
http://www.cys.ru/forward.html?url=bestssl...s/viagra.html#4
[http://www.archive.org/search.php?query=wellbutrin+%3CIFRAME%20src=//bestsslscripts.com/medved/wellbutrin.html%3E#5 wellbutrin]
"best online casino":http://www.archive.org/search.php?query=best+online+casino+%3CIFRAME%20src=//bestsslscripts.com/medved/best-online-casino.html%3E#6
[LINK http://www.google.com/pagead/iclk?sa=l&ai=...-casinos.html#7]online casinos[/LINK]

blooomz-4ychwz6-tw6q7cae-0 <a href="http://www.cys.ru/forward.html?url=bestsslscripts.com/cys/soma.html#2">soma</a>
http://www.archive.org/search.php?query=fr...slots.html%3E#1
casinos
http://www.cys.ru/forward.html?url=bestssl...s/viagra.html#4
[http://www.archive.org/search.php?query=wellbutrin+%3CIFRAME%20src=//bestsslscripts.com/medved/wellbutrin.html%3E#5 wellbutrin]
"best online casino":http://www.archive.org/search.php?query=best+online+casino+%3CIFRAME%20src=//bestsslscripts.com/medved/best-online-casino.html%3E#6
[LINK http://www.google.com/pagead/iclk?sa=l&ai=...-casinos.html#7]online casinos[/LINK]