struts 1.2: calling an action by javascript

View: New views
18 Messages — Rating Filter:   Alert me  

struts 1.2: calling an action by javascript

by Ingo Villnow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

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 :-(

thanks & greetings from Berlin


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

Re: struts 1.2: calling an action by javascript

by fawix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

try this

<script language="javascript">
function submitForm(){

//do the verification you want to...

    form.submit();
}

</script>

<s:select onchange="submitForm()" .... />

On 10/31/07, Ingo Villnow <ingo.villnow@...> wrote:

>
> Hello,
>
> 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 :-(
>
> thanks & greetings from Berlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>

Re: struts 1.2: calling an action by javascript

by Frank W. Zammetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...


Re: struts 1.2: calling an action by javascript

by Frank W. Zammetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...


Parent Message unknown Re: struts 1.2: calling an action by javascript

by Frank W. Zammetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...


Re: struts 1.2: calling an action by javascript

by Ingo Villnow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you, I am going to use the javawebparts.ajaxparts taglib in any
way, now i try to find the cook book :-) thanks

Frank W. Zammetti schrieb:

> 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@...

Re: struts 1.2: calling an action by javascript

by Ingo Villnow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

GREAT Thank you very much!!

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@...

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

by Ingo Villnow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...

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

by Ingo Villnow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...

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

by Frank W. Zammetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...


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

by Ingo Villnow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I referred to the manual and there it suggested to use "parameter"
instead, like this:

<requestHandler type="std:QueryString"
target="/ajax.do">
<parameter>value=name</parameter>
</requestHandler>

then you can use: String value = (String) request.getParameter("value");

Now i have another problem :-)) I want to use the "std:FormManipulator"
als ResponseHandler, but I have problems with the correct
XML-Response-Format and i don't find any code example for that.
I am generating the form by using the struts-tags <html:form>,<html:txt>
and so on. And with the FormManipulator i think i can manipulate the
generated form.

The other way maybe is that i generate my form like <html type="text"
value="<% ..... %>" after the <ajax:event> called my action and my
action puts me a bean into the request.

Greetings, Ingo


Frank W. Zammetti schrieb:

> 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
>

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

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

by Frank W. Zammetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would suggest joining the JWP mailing list and re-posting this
question there... the form manipulator handler was written by a member
of the JWP team named Herman, and I know he'd be able to help you out
quickly.  I think though that there is an example of that handler in the
JWP sample application that comes with the distribution, if memory
serves, you may want to check that out first.  If it's no help, moving
to the JWP mailing list would probably be a good idea at this point
since this isn't so much Struts-related any more.

Frank

Ingo Villnow wrote:

> I referred to the manual and there it suggested to use "parameter"
> instead, like this:
>
> <requestHandler type="std:QueryString"
> target="/ajax.do">
> <parameter>value=name</parameter>
> </requestHandler>
>
> then you can use: String value = (String) request.getParameter("value");
>
> Now i have another problem :-)) I want to use the "std:FormManipulator"
> als ResponseHandler, but I have problems with the correct
> XML-Response-Format and i don't find any code example for that.
> I am generating the form by using the struts-tags <html:form>,<html:txt>
> and so on. And with the FormManipulator i think i can manipulate the
> generated form.
>
> The other way maybe is that i generate my form like <html type="text"
> value="<% ..... %>" after the <ajax:event> called my action and my
> action puts me a bean into the request.
>
> Greetings, Ingo
>
>
> Frank W. Zammetti schrieb:
>> 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
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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@...


Re: struts 1.2: calling an action by javascript

by Friend Here :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


<html:select onchange = "submit();" >
function submit()
{
  populate values ..........then
  document.action.value  = " /url ";
  document[0].forms[0].submit();  
}

Ingo Villnow wrote:
Hello,

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 :-(

thanks & greetings from Berlin


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

Re: struts 1.2: calling an action by javascript

by prasad.dls :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is select box. u make this as html select

<select name="contentId" id="contentId" onchange="getPage(<%=companyId%>,'./xxx.do?step=<bean:message key="link.xxxx.xxxxx"/>&contentId=');">

This is javascript
--
function getPage(ccid,url){
        var cId = document.getElementById("contentId").value;
        document.location.href = url+cId+'&xxxId='+ccid;
}

by using this u can get what u want.

Ingo Villnow wrote:
Hello,

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 :-(

thanks & greetings from Berlin


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Thanks & Regards, D.L.S.Prasad Sr. Software Engineer

Re: struts 1.2: calling an action by javascript

by lavanyaonnet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I too have littile bit knolwledge in javascript, plz try this

<script language="javascript">
        function submitFunction(){
        document.forms(0).submit();
        }        
        </script>

<script language="javascript">
        function submitaddFunction(){
        document.forms(1).submit();
        }        
        </script>

just call the above function in ur button tag.



Ingo Villnow wrote:
Hello,

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 :-(

thanks & greetings from Berlin


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

Re: struts 1.2: calling an action by javascript

by dvdface :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ingo Villnow wrote:
Hello,

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 :-(

thanks & greetings from Berlin


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
you can use DWR to achieve this job

Re: struts 1.2: calling an action by javascript

by Sachint () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, you can do so by using AJAX, you need to invoke a Javascript function that makes an AJAX call to the action.

Thanks,
Sachin

http://technologistics.blogspot.com/2008/11/calling-struts-action-by-javascript.html

Ingo Villnow wrote:
Hello,

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 :-(

thanks & greetings from Berlin


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

RE: struts 1.2: calling an action by javascript

by mgainty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Good Morning-

What you're looking for is a technology called Direct Web Remoting take a look at StrutsCreator at
http://directwebremoting.org/dwr/server/struts

HTH
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.


> Date: Fri, 31 Oct 2008 02:44:49 -0700
> From: sachin_kt@...
> To: user@...
> Subject: Re: struts 1.2: calling an action by javascript
>
>
> Yes, you can do so by using AJAX, you need to invoke a Javascript function
> that makes an AJAX call to the action.
>
> Thanks,
> Sachin
>
> Ingo Villnow wrote:
> >
> > Hello,
> >
> > 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 :-(
> >
> > thanks & greetings from Berlin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@...
> > For additional commands, e-mail: user-help@...
> >
>
> --
> View this message in context: http://www.nabble.com/struts-1.2%3A-calling-an-action-by-javascript-tp13510349p20262635.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>

_________________________________________________________________
Store, manage and share up to 5GB with Windows Live SkyDrive.
http://skydrive.live.com/welcome.aspx?provision=1?ocid=TXT_TAGLM_WL_skydrive_102008