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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Div (Ajax Tag) tag Example 
 

In this section, you will learn about the div tag. The div tag is an Ajax component that is used with Ajax that refreshes the content of a particular section without refreshing the entire page.

 

Div (Ajax Tag) tag Example

                         

In this section, you will learn about the div tag. The div tag is an Ajax component that is used with Ajax that refreshes the content of a particular section without refreshing the entire page.

The div tag when used with Ajax refreshes the content of a particular section without refreshing the entire page.

HTML <DIV /> tag created by Ajax div tag includes it's content and is used to obtain it's content through a remote XMLHttpRequest call through the dojo framework.

THE FOLLOWING ATTRIBUTES ARE VALID IF AJAX IS CONFIGURED

  • href: Set 'href' as a url tag reference value.
  • errorText: If a request makes any error then 'errorText' is displayed.
  • afterLoading: Use 'notifyTopics' since 'afterLoading' has been Deprecated.
  • executeScripts: Setting the value of 'executeScripts' to true allows the javascript sections to execute in the returned text. 
  • loadingText: On making the request the 'targets' element displays the text 'loadingText'.
  • listenTopics: The comma separated list 'listenTopics' is the list of topic names that is used to trigger a request.
  • handler: The function that takes care of any AJAX request is termed as 'handler'. The function uses Dojo's widget and dom node as parameters to be passed).
  • formId: The fields of the formId are used to serialize and pass as the parameters in the request.
  • formFilter: The function 'formFilter' is used to filter the fields that are to be serialized which receives the elements as parameters and returns true if the element is included.
  • targets: Here 'targets' is the list of ids to be updated with the text returned from request.
  • notifyTopics: 'notifyTopics' is nothing but the list of topic names separated by commas to be published. It takes three parameters.
    1. data: is the html or json object while type = 'error' or type = 'error'
    2. type: it should be of the type 'before' before requesting, 'load' whenever request succeeds and 'error' whenever the request fails.
    3. request: it requests for the javascript objects if type='error' or
      type='load'.
  • showErrorTransportText: 'showErrorTransportText' displays the errors on target.
  • indicator

The attribute 'updateFreq' refreshes after a certain time period, specified in miliseconds.

The attribute 'autoStart' starts the timer automatically while sets to true which is the default value.

The attribute 'startTimerListenTopics' is used to start the timer whenever 'startTimerListenTopic' is the comma-separated list of topics.

The attribute ''stopTimerListenTopics' is used to start the timer whenever ''stopTimerListenTopics' is the comma-separated list of topics.

'showLoadingText' displays the loaded text on targets while 'separateScript' runs each script in each scope that is unique for each Div.

Add the following code snippet into the struts.xml file.
strurts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

    <!-- Rose India Struts Tutorials -->
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />
<include file="struts-default.xml"/>    

    <!-- Add packages here -->

  <package name="roseindia" namespace="/roseindia" extends="struts-default">

     <action name="div">
        <result>/pages/div.jsp</result>
     </action>

  </package>


</struts>

Create a jsp using the tag <s:div>.
                                                                                             

div.jsp

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

<html>
    <head>
        <title>Enter first and last name</title>
    <s:head theme="ajax" debug="false"/>
    </head>
    <body>
    <s:url id="test" value="/pages/mask.jsp" />
    <s:div
      id="one"
      theme="ajax"
      href="%{test}">
    </s:div>
    </body>
</html>

mask.jsp

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

<html>
    <head>
        <title>Enter first and last name</title>
        <s:head theme="ajax" debug="false"/>

    </head>
    <body>
    <s:div id="maskValue" >
    <div style="position:absolute;top:10; left:20; width:300; 
height:175;background-color:#E5E5E5;"
>
    <h3>Enter first and last name:</h3>
      <s:form theme="ajax" action="doMask">
        <s:textfield name="firstname" label="Firstname" />
        <s:textfield name="lastname" label="Lastname" />
        <s:submit value="Submit" theme="ajax" targets="maskValue" />
      </s:form>
    </div>
    <br>
    
    <div id="8" style="position:absolute;top:10; left:350; 
width:300; height:160;background-color:#E5E5E5;"
>
      <h3>Output: </h3>
      Firstname : <s:property value="firstname" />
      <br><br>
      Lastname :  <s:property value="lastname" />
      </div>
    </s:div>
    </body>
</html>

Output:

                         

» View all related tutorials
Related Tags: html text ui sed textarea tag tar render tex to ext e area use ml m end s at htm

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

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

nice u giving more examples for beginners

Posted by prabhu on Saturday, 11.15.08 @ 03:03am | #81694

above mentioned example is resulting in undefined error after clicking the submit buton, please advice me incase there is something wrong or if i need to add something in above mentioned code.

Posted by devisharan on Tuesday, 02.5.08 @ 17:06pm | #47301

What does the action "doMask" do in Mask.jsp?

Posted by Cynthiadave on Saturday, 12.29.07 @ 01:46am | #44082

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.