Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Textarea Tag: 
 

html:textarea Tag -is use to create a textarea element. This tag is only valid when nested inside a form tag body.

 

Textarea Tag<html:textarea>:

Information on Textarea Tag

                         

html:textarea Tag -is use to create  a textarea element. This tag is only valid when nested inside a form tag body.

 

 

 

 

 

 

 


Name Description
name The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized.
property Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String.
readonly Set to true if this input field should be read only.
value Value to which this field should be initialized.

Example Illustrating the use of the Textarea<html:textarea> tag.

Here you will learn to use the Struts Html<html:textarea> tag. 
We will cover an example that will show a working of<html:textarea> tag.


Example code
Creating Form Bean :
Develop a simple Form Bean class TextAreaActionForm.java.

package ActionForm;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class TextAreaActionForm extends org.apache.struts.action.ActionForm {
    
     private String message;
  
    public String getMessage() {
        return message;
    }
    
    public void setMessage(String string) {
        message = string;
    }
       
    public TextAreaActionForm() {
        super();
  }

}
 

Creating an Action Class  :
Develop a simple action  class TextAreaAction.java.

package action;

import ActionForm.TextAreaActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

public class TextAreaAction extends Action {
       
    private final static String SUCCESS = "success";
    
    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        if(form!=null){
            TextAreaActionForm texAreaActionForm=(TextAreaActionForm)form;
            String message=texAreaActionForm.getMessage();
            System.out.println("raj"+message);
        }
        
        return mapping.findForward(SUCCESS);
        
    }
}

Defining form Bean in struts-config.xml file
Add the following entry in the struts-config.xml file for defining the form bean :

<form-bean name="TextAreaActionForm" type="ActionForm.TextAreaActionForm"/>

Developing the Action Mapping in the struts-config.xml 
Here, Action mapping helps to select FormBean and Action  etc, from the  class for specific requests.

<action input="/" name="TextAreaActionForm" path="/TextAreaAction" 
    scope=
"session" type="action.TextAreaAction" validate="false">

<forward name="success" path="/HtmlTextAreaOutPut.jsp"/>

</action> 

Developing the HtmlTextAreaTag .jsp page
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <th align="right"><font color="#33FF99">HTML:TEXTAREA EXAMPLE</font>
    </th><br/>>

</head>
<body bgcolor="#999933">

<font color="#33FF99">Please Enter the Message------</font><br/>

<h4><font color="#33FF99">Message </font><h4><br/>
<html:form action="TextAreaAction">
<table border="2">

<td align="left">
    <html:textarea property="message"/><br/>
</td>
</tr>
<tr>
    <td align="left">
        <html:submit/>
    </td>
    </td>
</tr>
</table>
</html:form>


</body>
</html>

Developing the HtmlTextAreaOutPut.jsp page :

Add the following line in the index.jsp to call the form.
<a href="HtmlTextAreaTag.jsp">HtmlTextAreaTagDemo</a><br/> 

Building and Testing the Example  :
Build and deploy and Test  the application .
Open the browser and navigate to the HtmlTextAreaTag .jsp page. 
Your browser displays the following page.

Now write any data in to the textarea of  HtmlTextAreaTag .jsp , and click submit button .


Output: 


HtmlTextAreaTag .jsp  page and O/P displays the working of  <html:textarea> tag. 

                         
» View all related tutorials
Related Tags: html c ide orm text form nested textarea tag this id element tar create tex for to ext e area

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

When I put "Hello Friend" in textarea it shows ->
"Hello Friend" as o/p...

Posted by Rahul on Friday, 12.12.08 @ 00:10am | #82665

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.