« Return to Thread: struts 1.2: calling an action by javascript

Re: struts 1.2: calling an action by ajax (javawebparts)

by Frank W. Zammetti :: Rate this Message:

Reply to Author | View in Thread

Can you tell where that error is coming from?  I don't recognize it as
an APT error, so I'm guessing Struts, but I don't recall ever seeing
that before.

You know what... what happens if you remove the <?xml> and <!DOCTYPE>
tags?  Does it work then?

Frank

Ingo Villnow wrote:

> ok, the Text in the index-result is working now, but i want to use the
> actions and when i use parameters like
> "/employee.do?task=update&ajax=getEmployee" then there comes an error
> message "The reference to entity "ajax" must end with the ';' delimiter."
>
> Ingo Villnow schrieb:
>> Hello,
>>
>> now i am using the javawebparts.ajaxparts and when i put all the things
>> in a whole jsp-site, than the ajax is working:
>>
>> <%@ taglib prefix="ajax" uri="javawebparts/ajaxparts/taglib" %>
>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>>     pageEncoding="ISO-8859-1"%>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
>> <title>Insert title here</title>
>> </head>
>> <body>
>> <form action="#">
>> <input id="btn" type="button" value="TESTBUTTON"/><ajax:event
>> ajaxRef="employee/update" attachTo="btn"/>
>> </form>
>> <div id="result-div">
>>
>> </div>
>> <ajax:enable/>
>> </body>
>> </html>
>>
>> But when i am using it with struts-tiles than it doesn't work :-( - i
>> think that's because the target in the ajax-config is not found. I don't
>> now why. Without tiles, the target
>> will be found. The index-result.txt is in the same directory as the
>> jsp-site.
>>
>> <ajaxConfig>
>>     <group ajaxRef="employee">
>>         <element ajaxRef="update">
>>             <event type="onclick">
>>                 <requestHandler type="std:SimpleRequest"
>>                     target="index-result.txt">
>>                     <parameter />
>>                 </requestHandler>
>>                 <responseHandler type="std:InnerHTML">
>>                     <parameter>result-div</parameter>
>>                 </responseHandler>
>>             </event>
>>         </element>
>>     </group>
>> </ajaxConfig>
>>
>> When i use an action as a target, it doesn't work, too (e.g.
>> target="action.do?parameter=xxx¶m2=yyy). I use the DispatchAction,
>> so with the parameter I can delegate or specifiy the method, which will
>> be called in my action...
>>
>> Any ideas?
>>
>> Thank's a lot!!
>>
>> Greetings from Berlin
>>
>>
>> Frank W. Zammetti schrieb:
>>  
>>> I should also point out the presentation Ted Husted did at The Ajax
>>> Experience last week which dealt largely with APT.  The slides for that
>>> presentation are here:
>>>
>>> http://ajaxexperience.techtarget.com/images/Presentations/Husted_Ted_RetrofittingStruts.pdf
>>>
>>> I'm not quite sure how long they will stay posted there though, so get it
>>> while it's hot :)
>>>
>>> Frank
>>>
>>> On Wed, October 31, 2007 10:48 am, Frank W. Zammetti wrote:
>>>  
>>>    
>>>> On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote:
>>>>    
>>>>      
>>>>> i want to call an action by javascript, when a value in a <html:select>
>>>>> field changes. I want to fill my <html:form> with the data provided by
>>>>> the action. Any ideas? I don't know a lot of javascript :-(
>>>>>      
>>>>>        
>>>> There's a couple if ways you could do that... one would be to call the
>>>> submit() method of the form object, which every form in HTML has, then
>>>> re-render the page with the updated data in the form.  That's of course
>>>> going to refresh the entire page, which I suspect isn't what you want.
>>>>
>>>> So, AJAX is probably what you want.  Now, how you go about doing that,
>>>> well, there's a few hundred options :)  Because you don't know a lot of
>>>> Javascript, you might want to consider the AjaxParts Taglib (APT) from
>>>> Java Web Parts (JWP):
>>>>
>>>> http://javawebparts.sourceforge.net
>>>>
>>>> Direct to APT:
>>>>
>>>> http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html
>>>>
>>>> If you go to the download page, the cookbook has some examples that are
>>>> very much along the lines of what you're asking for.  If you go that
>>>> route, we'll be more than happy on the JWP mailing list, or forums.
>>>>
>>>> Otherwise, prototype (http://www.prototypejs.org) is a good, simple
>>>> option, but you will be writing some Javascript.
>>>>
>>>>    
>>>>      
>>>>> thanks & greetings from Berlin
>>>>>      
>>>>>        
>>>> hth,
>>>> Frank
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@...
>>>> For additional commands, e-mail: user-help@...
>>>>
>>>>
>>>>    
>>>>      
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@...
>>> For additional commands, e-mail: user-help@...
>>>
>>>
>>>  
>>>    
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.14/1100 - Release Date: 10/30/2007 6:26 PM

--
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@...
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!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

 « Return to Thread: struts 1.2: calling an action by javascript