You already have the code, you posted it! :)  If you're having some
*specific* problem, you'll find many helpful people here, but just saying
"my code doesn't work, please help" won't elicit too many (helpful)
replies.

Frank

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
and "JavaScript, DOM Scripting and Ajax Projects"
 (2007, Apress, ISBN 1-59059-816-4)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Wed, October 10, 2007 3:13 pm, aarthy wrote:
>
> Can someone  provide me with an example code.I need to implement ajax in
> my
> struts project, when html link is clicked.
>
>
>
> ghodgins wrote:
>>
>> Not to detract at all from the great JWP project but you can also do
>> this with AjaxTags.
>>
>> The ajax:select tag is described here:
>> http://ajaxtags.sourceforge.net/usage.html
>>
>> I used ajax:select to call an action that returned XML using the handy
>> AjaxXmlBuilder that came with AjaxTags.
>>
>> Cheers,
>> Grant
>>
>>
>> -----Original Message-----
>> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, October 10, 2007 11:31 AM
>> To: Struts Users Mailing List
>> Cc: Struts Users Mailing List
>> Subject: Re: Ajax Call from a html link
>>
>> Just an FYI, that article is a little outdated... APT's feature set is a
>> bit larger than the article talks about now for one thing, although in
>> glancing over it again, I don't see anything that's not applicable now.
>>
>> Also note that the link to Rick Reumann's article is no longer valid, it
>> is now here:
>> http://www.learntechnology.net/content/ajax/ajax_select_alter.jsp ...
>> Rick also updated that article for APT fairly recently, so it's even
>> better than it was.
>>
>> Lastly, I didn't provide a link to my own book in that article!  D'oh!
>> Here's one: http://apress.com/book/search?searchterm=zammetti&act=search
>> ...
>> chapters 4 and 6 there are what's of interest, although as the note in
>> the article says, they aren't based on the latest version, so although
>> the underlying concepts are pretty much the same, some of the details
>> are slightly different now.
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>> AIM/Yahoo: fzammetti
>> MSN: [EMAIL PROTECTED]
>> Author of "Practical Ajax Projects With Java Technology"
>>  (2006, Apress, ISBN 1-59059-695-1)
>> and "JavaScript, DOM Scripting and Ajax Projects"
>>  (2007, Apress, ISBN 1-59059-816-4)
>> Java Web Parts - http://javawebparts.sourceforge.net
>>  Supplying the wheel, so you don't have to reinvent it!
>>
>> On Wed, October 10, 2007 12:50 pm, Ted Husted wrote:
>>> I believe this exact example is included with the AjaxParts Taglib,
>>> which works well with Struts (1 or 2). If anyone is going to be using
>>> Ajax and JSP tags together, AjaxParts is a great way to go  (and easy
>>> to learn!).
>>>
>>>  * http://www.omnytex.com/articles/apt/
>>>
>>> HTH, Ted.
>>> <http://husted.com/ted/blog>
>>>
>>>
>>> On 10/10/07, aarthy <[EMAIL PROTECTED]> wrote:
>>>>
>>>> I have a jsp page named "tvshow.jsp", wherein I am populating the
>>>> characters dropdown as and when the TV Show dropdown value changes ,
>>>> by calling the javascript in the "onchange()" of the select box.
>>>> have added a html link, and I want to call the same function from my
>>>> action class and I need to populate the character dropdown by
>>>> clicking the html link. I am stuck up with this issue.Character
>>>> dropdown is not populated with the data from tha action class. Need
>>>> some help on this please!
>>>>
>>>> <%@ page import="java.util.*"%>
>>>> <%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
>>>> <%@ taglib uri="http://struts.apache.org/tags-logic"; prefix="logic"
>>>> %> <script language="javascript">  function retrieveURL(url) {
>>>>     if (window.XMLHttpRequest) { // Non-IE browsers
>>>>       req = new XMLHttpRequest();
>>>>       req.onreadystatechange = processStateChange;
>>>>       try {
>>>>         req.open("GET", url, true);
>>>>
>>>>       } catch (e) {
>>>>         alert(e);
>>>>       }
>>>>       req.send(null);
>>>>     } else if (window.ActiveXObject) { // IE
>>>>       req = new ActiveXObject("Microsoft.XMLHTTP");
>>>>       if (req) {
>>>>         req.onreadystatechange = processStateChange;
>>>>         req.open("GET", url, true);
>>>>         req.send();
>>>>
>>>>       }
>>>>     }
>>>>   }
>>>>
>>>>   function processStateChange() {
>>>>     if (req.readyState == 4) { // Complete
>>>>       if (req.status == 200) { // OK response
>>>>         document.getElementById("characters").innerHTML =
>>>> req.responseText;
>>>>             } else {
>>>>         alert("Problem: " + req.statusText);
>>>>       }
>>>>     }
>>>>   }
>>>>
>>>> </script>
>>>>
>>>>
>>>> <form action="ShowCharacters">
>>>> /jsp/tvshow.jsp Click here
>>>>
>>>>                 TV Show:
>>>>                 <select name="TVShowSelect"
>>>> onChange="retrieveURL('ShowCharacters.do?tvShow=' + this.value);">
>>>>                 <option value="Lissie Maguire"> Lissie Maguire
>> </option>
>>>>                         <option value="That's so Raven"> That's so
>>>> Raven </option>
>>>>                         <option value="Dhoom machale"> Dhoom machale
>>>> </option>
>>>>                 </select>
>>>>
>>>>                 <br>
>>>>                 Characters:
>>>>         </form>
>>>>
>>>> ShowCharacters.jsp
>>>>
>>>> <[EMAIL PROTECTED] import="java.util.ArrayList"%>
>>>>
>>>> <%@ taglib uri="http://struts.apache.org/tags-bean"; prefix="bean" %>
>>>> <%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
>>>> <%@ taglib uri="http://struts.apache.org/tags-logic"; prefix="logic"
>>>> %>
>>>>
>>>> <select name="TVShowSelect">
>>>> <%  ArrayList ch =
>>>> (ArrayList)request.getSession().getAttribute("characters");
>>>>     String[] s = new String[ch.size()];
>>>>     ch.toArray(s);
>>>>     for (int i = 0; i < s.length; i++) {
>>>>         String name = s[i];
>>>> %>
>>>>         <option><%=name%></option>
>>>> <%  }
>>>> %>
>>>> </select>
>>>>
>>>> Thanks
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>> ----Notice Regarding Confidentiality----
>> This email, including any and all attachments, (this "Email") is
>> intended
>> only for the party to whom it is addressed and may contain information
>> that is confidential or privileged.  Sierra Systems Group Inc. and its
>> affiliates accept no responsibility for any loss or damage suffered by
>> any
>> person resulting from any unauthorized use of or reliance upon this
>> Email.
>> If you are not the intended recipient, you are hereby notified that any
>> dissemination, copying or other use of this Email is prohibited.  Please
>> notify us of the error in communication by return email and destroy all
>> copies of this Email.  Thank you.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Ajax-Call-from-a-html-link-tf4601558.html#a13142624
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to