JavaBeat
Struts Tutorials | Hibernate Tutorials | JSP Tutorials | Servlet Tutorials | EJB Tutorials | Struts Resources | Spring Resources | Hibernate Resources
Struts Home Articles Resources Tutorials FAQs Forums

1. Introduction to the Apache Struts

2. Introduction to the Struts Controller

3. Introduction to the Struts Action Class

4. Using Struts ActionFrom Class

5. Using Struts HTML Tags

6. Introduction to Struts Validator Framework

7. Client Side Address Validation in Struts

8. Developing Application with Struts Tiles

9. Using tiles-defs.xml in Tiles Application

10. Struts DynaActionForm

11. Struts File Upload

Struts provides HTML tag library for easy creation of user interfaces. In this lesson I will show you what all Struts HTML Tags are available to the JSP for the development of user interfaces.

To use the Struts HTML Tags we have to include the following line in our JSP file:

<%@ taglib uri="/tags/struts-html" prefix="html" %>

above code makes available the tag to the jsp.


Struts HTML Tags
<html:message key="thekey"/> Looks up the message corresponding to the given key in the message resources and displays it.
<html:password property="prop" size="10"/> Tag creates the password field. The string is stored in the property named prop in the form bean.
<html:text property="text1" size="5"/> Tag creates the text field. The string is retrieved from and later stored in the property named text1 in the form bean.
<html:submit>Submit</html:submit> Tag creates a submit button with the provided content as the button text. 
<html:reset>Reset</html:reset> Tag creates a reset button with the provided content as the button text. 
<html:errors/> Tag prints all the available error on the page.
<html:file property="fileSelectionBox"/> Tag creates the file upload element on the form. The property must be of the type org.apache.struts.upload.FormFile.
<html:checkbox property="myCheckBox"/> Tag creates check box on the form.
<html:hidden property="hiddenfield"/> Tag creates the hidden html element on the form.
<html:radio value="abc" property="myCheckBox"/> Tag creates the check box on the form.
<html:select multiple="true" property="selectBox"> Tag creates list box on the form. The property selectBox must be an array of supported data-types, and the user may select several entries. Use <html:options> to specify the entries.
<html:textarea property="myTextArea" value="Hello Struts" /> Tag creates the text area on the form.
<html:form action="/Address" method="post"> Tag is used to create the HTML Form for posting the data on the server.
<html:base/> Tag generates the base tag. <BASE ...> tells the browser to pretend that the current page is located at some URL other than where the browser found it. Any relative reference will be calculated from the URL given by <BASE HREF="..."> instead of the actual URL. <BASE ...> goes in the <HEAD> section.
<html:html> Tag renders an HTML <html> Element.


In the Address.jsp we have used some of the above tags. In the future sections I will show you more examples of the Struts HTML tags.



Sponsors
Webmaster Hosting Forum
Java Jobs
MyVideoLib
India News
Internet Advances
Latest QnA
Describe the lifecycle of a receiver application in order to receive a message?
Messages are not successful until they have been acknowledged. What are the types of acknowledgments?
What happens to messages if a transaction is rolled back?
What is the Role of the JMS Provider?
What is JMS administered object ?

JavaBeat Media (2004-2008), India
javabeat | planetoss | links directory | advertise
Copyright (2004 - 2008), JavaBeat