Struts2 + dojo + ajax for confirm button

2011-02-16 Thread Emi Lu

Good afternoon,

I found very good examples for ajax + asp:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx

For example, confirm button

May I know where I can find similar examples for
Struts2 + dojo + ajax for confirm button please?

Thanks a lot!
--
Lu Ying

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



Re: Struts2 + dojo + ajax for confirm button

2011-02-16 Thread Dave Newton
Please, please be aware that the S2 Dojo plugin is *deprecated*, for
good reasons. If you're just using raw Dojo, your best bet is the Dojo
documentation/samples.

Dave

On Wed, Feb 16, 2011 at 2:52 PM, Emi Lu em...@encs.concordia.ca wrote:
 Good afternoon,

 I found very good examples for ajax + asp:
 http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx

 For example, confirm button

 May I know where I can find similar examples for
 Struts2 + dojo + ajax for confirm button please?

 Thanks a lot!
 --
 Lu Ying

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



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



Re: Struts2 + dojo + ajax for confirm button

2011-02-16 Thread Emi Lu

On 02/16/2011 03:13 PM, Dave Newton wrote:

Please, please be aware that the S2 Dojo plugin is *deprecated*, for
good reasons. If you're just using raw Dojo, your best bet is the Dojo
documentation/samples.


Ok.

If dojo is deprecated, then how struts2 supports ajax?

--
Lu Ying




On Wed, Feb 16, 2011 at 2:52 PM, Emi Luem...@encs.concordia.ca  wrote:

Good afternoon,

I found very good examples for ajax + asp:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx

For example, confirm button

May I know where I can find similar examples for
Struts2 + dojo + ajax for confirm button please?

Thanks a lot!
--
Lu Ying

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





--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
em...@encs.concordia.ca+1 514 848-2424 x5884

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



Re: Struts2 + dojo + ajax for confirm button

2011-02-16 Thread Dave Newton
Either via the jQuery plugin, or by simply using whatever JS
library/framework you want.

Dave

On Wed, Feb 16, 2011 at 3:37 PM, Emi Lu em...@encs.concordia.ca wrote:
 On 02/16/2011 03:13 PM, Dave Newton wrote:

 Please, please be aware that the S2 Dojo plugin is *deprecated*, for
 good reasons. If you're just using raw Dojo, your best bet is the Dojo
 documentation/samples.

 Ok.

 If dojo is deprecated, then how struts2 supports ajax?

 --
 Lu Ying



 On Wed, Feb 16, 2011 at 2:52 PM, Emi Luem...@encs.concordia.ca  wrote:

 Good afternoon,

 I found very good examples for ajax + asp:

 http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx

 For example, confirm button

 May I know where I can find similar examples for
 Struts2 + dojo + ajax for confirm button please?

 Thanks a lot!
 --
 Lu Ying

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




 --
 Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
 em...@encs.concordia.ca        +1 514 848-2424 x5884


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



Re: Struts2 + dojo + ajax for confirm button

2011-02-16 Thread Emi Lu

Either via the jQuery plugin, or by simply using
whatever JS library/framework you want.


Thank you Dave!

--
Lu Ying






On Wed, Feb 16, 2011 at 3:37 PM, Emi Luem...@encs.concordia.ca  wrote:

On 02/16/2011 03:13 PM, Dave Newton wrote:


Please, please be aware that the S2 Dojo plugin is *deprecated*, for
good reasons. If you're just using raw Dojo, your best bet is the Dojo
documentation/samples.


Ok.

If dojo is deprecated, then how struts2 supports ajax?

--
Lu Ying




On Wed, Feb 16, 2011 at 2:52 PM, Emi Luem...@encs.concordia.cawrote:


Good afternoon,

I found very good examples for ajax + asp:

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx

For example, confirm button

May I know where I can find similar examples for
Struts2 + dojo + ajax for confirm button please?

Thanks a lot!
--
Lu Ying

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





--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
em...@encs.concordia.ca+1 514 848-2424 x5884




--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
em...@encs.concordia.ca+1 514 848-2424 x5884

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



File upload in struts2 using Ajax.

2009-10-05 Thread sharath karnati
Hi All,
 
   Anyone implemented struts2 file upload with Ajax? file upload will display 
progress bar for showing file upload status. 
 
   I tried below one but it is not working
 
   
http://www.struts2.org/ajax-file-upload-in-struts2-using-ajax-file-upload-plugin/
 
   Please send me links/documention for doing this.
 
   Thanks in advance.
 
Regards,
Sharath.


  

File upload in struts2 using Ajax.

2009-10-05 Thread sharath karnati
Hi All,
 
   Anyone implemented struts2 file upload with Ajax? file upload will display 
progress bar for showing file upload status. 
 
   I tried below one but it is not working
 
   
http://www.struts2.org/ajax-file-upload-in-struts2-using-ajax-file-upload-plugin/
 
   Please send me links/documention for doing this.
 
   Thanks in advance.
 
Regards,
Sharath.


  

Re: SPAM WARNING!: RE: Struts2 : Calling AJAX function on button click(ONLY)

2008-10-29 Thread Steven Yang
Hi
on thing i noticed is that you have a notifyTopics attribute on you submit
tag which i dont think is necessary and used wrong.
i havent used dojo for a long time, so i am not sure if they changed any api
or settings.
but just a reminder you might need to take a look.

you dont have to specify href on your div.
you can change it or assign a href in your onclick function like
dojo.byId(resultDiv).href = /example/result.action;

see if this help


Re: Struts2 : Calling AJAX function on button click(ONLY)

2008-10-29 Thread Roger
On Tuesday 28 October 2008 20:01:41 Kanade, Sayali wrote:
 Thanks for your reply, but not sure it answers my question.

 My question is: How can I prevent a div from refreshing its contents on
 page load? The div should only be refreshed on button click.

 My problem is that, my div loads on page load. It also reloads on submit
 button click, but it should ONLY load on submit click, not on page load.

 The action that executes in my div has to be only executed after the user
 selects a checkbox and clicks submit.

 Please help, I have browsed for this answer for hours!!!


You could tryusing a Javascript function to set your div to display:none on 
page load and re-set it when you want to display it.

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



RE: Struts2 : Calling AJAX function on button click(ONLY)

2008-10-29 Thread Kanade, Sayali
Thanks for all your help!
I tried changing the href of the div on button click but that doesn't
work. How I finally managed to do this was by passing a hidden form
field to action. The action only executes when the form field has a set
value. So on page load the Action doesn't get this value and the div jsp
doesn't get it and displays nothing.

What I was doing wrong was that my Form had a name parameter, the form
must have an id parameter to pass form fields. Also, my Action class
also behaves like a form bean, it needs to have a getter and setter for
the form fields.

As I said, new to Struts 2 and got all confused.

Thanks again,
Regards,
Sayali.
 
-Original Message-
From: Roger [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 29, 2008 7:56 AM
To: Struts Users Mailing List
Subject: Re: Struts2 : Calling AJAX function on button click(ONLY)

On Tuesday 28 October 2008 20:01:41 Kanade, Sayali wrote:
 Thanks for your reply, but not sure it answers my question.

 My question is: How can I prevent a div from refreshing its contents
on
 page load? The div should only be refreshed on button click.

 My problem is that, my div loads on page load. It also reloads on
submit
 button click, but it should ONLY load on submit click, not on page
load.

 The action that executes in my div has to be only executed after the
user
 selects a checkbox and clicks submit.

 Please help, I have browsed for this answer for hours!!!


You could tryusing a Javascript function to set your div to
display:none on 
page load and re-set it when you want to display it.

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



RE: Struts2 : Calling AJAX function on button click and passing form parameters to the same

2008-10-28 Thread Kanade, Sayali
Hi,

Can someone please help me out with the problem I mentioned below? I am
using Struts 2.0.11.2.

Any help will be greatly appreciated!!
Thanks!
Regards,
Sayali.
 
-Original Message-
From: Kanade, Sayali 
Sent: Monday, October 27, 2008 2:47 PM
To: user@struts.apache.org
Subject: SPAM WARNING!: Struts2 : Calling AJAX function on button click
and passing form parameters to the same

Hi All,

I am new to Struts 2, so please forgive me if this question is inane.

I have a very simple form which has some checkboxes and on the click of
the submit button of the form, I want to pass the values of the form to
an AJAX action.

CODE SNIPPET
STARTS#

script type=text/javascript
function getResult(){
 
//document.getElementById(diaryRecords).setAttribute(href,
/equipment.showHistory.action?serialNumber=+serialNumber);
//alert('In Get result');
buildValue = document.myForm.build.value;
//alert('buildValue : '+buildValue);
//dojo.event.topic.publish('/example/result.action',
buildValue);

document.myForm.hiddenbuild.value=buildValue;

//alert('document.myForm.hiddenbuild.value :
'+document.myForm.hiddenbuild.value)
}
/script

:
:

s:form action=/example/homepage.action method=post name=myForm
validate=true
   :
 :
td width=5% 
   input type=checkbox name=build /
   /td
:
:
tr
td s:submit theme=ajax targets=resultDiv
notifyTopics=/example/result.action formId=myForm
href=%{ajaxResultUrl} onclick=getResult() / /td
tds:reset
name=reset //td
/tr
/table
   /td

/tr
tr
td colspan=3
   s:url id=ajaxResultUrl
value=/example/result.action 
   s:param name=build value=%{'on'} /
/s:url
s:div theme=ajax id=resultDiv formId=myForm
loadingText=Loading Result... listenTopics=/example/result.action
href=%{ajaxResultUrl} /
/td
/tr
:
:
/s:form
##CODE SNIPPET
ENDS#

Now, I have two problems in this:
1. I am unable to pass the form parameters to the action. As you can see
that the form submits to homepage.action, but I want the AJAX call to
load from result.action. I have passed the formId to the div, but it
doesn't get the form parameters in the request. To work around this, I
am passing the value of build (build is a checkbox) as a param and
referencing the URL on the div as href.
2. The problem with pass as href : The result.action executes on page
load, I want it to execute on the submit button click and then display
the result.

Ideally, when I click submit, I want these form elements to be submitted
to result.action and the result will be displayed.

The code snippet above submits the build value as 'on' to the form and
the result is displayed on page load.

Please help, I wasn't able to get any good code examples doing this, it
would help immensely if I could get that.

Thanks for reading,
Regards,
Sayali.
 

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

WARNING! The attached email has been filtered as possible spam. Please
review at your own discretion. 

For additional info: http://infosec.web.gs.com/faqs/spam.shtml

Cogentrix users go to http://cgxapp/mailinfo for further instructions.

TIP: Don't unsubscribe from spam e-mail.  Unsubscribing confirms to the
spammer that a guessed e-mail address is real, and may cause you to
receive even more spam.

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



RE: Struts2 : Calling AJAX function on button click and passing form parameters to the same

2008-10-28 Thread Mileidys Gonzalez Prieto
Hi,
I don’t' know if I get the idea about what do u want to do, but I will try
to copy some codes about how I resolve something similar, using AjaxTags

ajax:htmlContent target=tabContent source=sendAfs doPost=true 
baseUrl=${pageContext.request.contextPath}/relatie/tabAfspraken.do

parameters=id=${rsKlantId},action=saveAfs,${paramsForm} /

in this case the id for my button is sendAfs and is sending my post
everything that is in the form. In my case is really a lot of fields and is
difficult to copy one by one, then for me was better to create a form that
will get all the fields:

Fields:
public String filterArtikelNr;
public String filterArtikel;
public String filterSoort;
public String filterMerk;
public String filterType;
public String filterVervallen;

Function for get an string with the parameters list in the form: 
paramaterName = {paramaterName}
This is the way for write the fields in Ajax
public String getParams(){
StringBuilder sb = new StringBuilder();
Field[] f = this.getClass().getFields();
for (Field field : f) {
sb.append(field.getName() + ={ + field.getName() +
},);
}
return sb.toString();
}

Mileidys González Prieto
Consultant
i-Frontier
 
Henck Arronstraat 16 | P.O.Box 12858 | Paramaribo, Suriname (SA)
Office: (597)-424073 | Mobile: (597)-8810219
www.i-frontier.net
-Original Message-
From: Kanade, Sayali [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2008 11:05 AM
To: user@struts.apache.org
Subject: RE: Struts2 : Calling AJAX function on button click and passing
form parameters to the same

Hi,

Can someone please help me out with the problem I mentioned below? I am
using Struts 2.0.11.2.

Any help will be greatly appreciated!!
Thanks!
Regards,
Sayali.
 
-Original Message-
From: Kanade, Sayali 
Sent: Monday, October 27, 2008 2:47 PM
To: user@struts.apache.org
Subject: SPAM WARNING!: Struts2 : Calling AJAX function on button click
and passing form parameters to the same

Hi All,

I am new to Struts 2, so please forgive me if this question is inane.

I have a very simple form which has some checkboxes and on the click of
the submit button of the form, I want to pass the values of the form to
an AJAX action.

CODE SNIPPET
STARTS#

script type=text/javascript
function getResult(){
 
//document.getElementById(diaryRecords).setAttribute(href,
/equipment.showHistory.action?serialNumber=+serialNumber);
//alert('In Get result');
buildValue = document.myForm.build.value;
//alert('buildValue : '+buildValue);
//dojo.event.topic.publish('/example/result.action',
buildValue);

document.myForm.hiddenbuild.value=buildValue;

//alert('document.myForm.hiddenbuild.value :
'+document.myForm.hiddenbuild.value)
}
/script

:
:

s:form action=/example/homepage.action method=post name=myForm
validate=true
   :
 :
td width=5% 
   input type=checkbox name=build /
   /td
:
:
tr
td s:submit theme=ajax targets=resultDiv
notifyTopics=/example/result.action formId=myForm
href=%{ajaxResultUrl} onclick=getResult() / /td
tds:reset
name=reset //td
/tr
/table
   /td

/tr
tr
td colspan=3
   s:url id=ajaxResultUrl
value=/example/result.action 
   s:param name=build value=%{'on'} /
/s:url
s:div theme=ajax id=resultDiv formId=myForm
loadingText=Loading Result... listenTopics=/example/result.action
href=%{ajaxResultUrl} /
/td
/tr
:
:
/s:form
##CODE SNIPPET
ENDS#

Now, I have two problems in this:
1. I am unable to pass the form parameters to the action. As you can see
that the form submits to homepage.action, but I want the AJAX call to
load from result.action. I have passed the formId to the div, but it
doesn't get the form parameters in the request. To work around this, I
am passing the value of build (build is a checkbox) as a param and
referencing the URL on the div as href.
2. The problem with pass as href : The result.action executes on page
load, I want it to execute on the submit button click and then display
the result.

Ideally, when I click submit, I want these form elements

RE: Struts2 : Calling AJAX function on button click(ONLY)

2008-10-28 Thread Kanade, Sayali
Thanks for your reply, but not sure it answers my question.

My question is: How can I prevent a div from refreshing its contents on page 
load? The div should only be refreshed on button click.

My problem is that, my div loads on page load. It also reloads on submit button 
click, but it should ONLY load on submit click, not on page load.

The action that executes in my div has to be only executed after the user 
selects a checkbox and clicks submit.

Please help, I have browsed for this answer for hours!!!

Regards,
Sayali.
 
-Original Message-
From: Mileidys Gonzalez Prieto [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2008 11:10 AM
To: Kanade, Sayali; user@struts.apache.org
Subject: RE: Struts2 : Calling AJAX function on button click and passing form 
parameters to the same

Hi,
I don't' know if I get the idea about what do u want to do, but I will try
to copy some codes about how I resolve something similar, using AjaxTags

ajax:htmlContent target=tabContent source=sendAfs doPost=true 
baseUrl=${pageContext.request.contextPath}/relatie/tabAfspraken.do

parameters=id=${rsKlantId},action=saveAfs,${paramsForm} /

in this case the id for my button is sendAfs and is sending my post
everything that is in the form. In my case is really a lot of fields and is
difficult to copy one by one, then for me was better to create a form that
will get all the fields:

Fields:
public String filterArtikelNr;
public String filterArtikel;
public String filterSoort;
public String filterMerk;
public String filterType;
public String filterVervallen;

Function for get an string with the parameters list in the form: 
paramaterName = {paramaterName}
This is the way for write the fields in Ajax
public String getParams(){
StringBuilder sb = new StringBuilder();
Field[] f = this.getClass().getFields();
for (Field field : f) {
sb.append(field.getName() + ={ + field.getName() +
},);
}
return sb.toString();
}

Mileidys González Prieto
Consultant
i-Frontier
 
Henck Arronstraat 16 | P.O.Box 12858 | Paramaribo, Suriname (SA)
Office: (597)-424073 | Mobile: (597)-8810219
www.i-frontier.net
-Original Message-
From: Kanade, Sayali [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2008 11:05 AM
To: user@struts.apache.org
Subject: RE: Struts2 : Calling AJAX function on button click and passing
form parameters to the same

Hi,

Can someone please help me out with the problem I mentioned below? I am
using Struts 2.0.11.2.

Any help will be greatly appreciated!!
Thanks!
Regards,
Sayali.
 
-Original Message-
From: Kanade, Sayali 
Sent: Monday, October 27, 2008 2:47 PM
To: user@struts.apache.org
Subject: SPAM WARNING!: Struts2 : Calling AJAX function on button click
and passing form parameters to the same

Hi All,

I am new to Struts 2, so please forgive me if this question is inane.

I have a very simple form which has some checkboxes and on the click of
the submit button of the form, I want to pass the values of the form to
an AJAX action.

CODE SNIPPET
STARTS#

script type=text/javascript
function getResult(){
 
//document.getElementById(diaryRecords).setAttribute(href,
/equipment.showHistory.action?serialNumber=+serialNumber);
//alert('In Get result');
buildValue = document.myForm.build.value;
//alert('buildValue : '+buildValue);
//dojo.event.topic.publish('/example/result.action',
buildValue);

document.myForm.hiddenbuild.value=buildValue;

//alert('document.myForm.hiddenbuild.value :
'+document.myForm.hiddenbuild.value)
}
/script

:
:

s:form action=/example/homepage.action method=post name=myForm
validate=true
   :
 :
td width=5% 
   input type=checkbox name=build /
   /td
:
:
tr
td s:submit theme=ajax targets=resultDiv
notifyTopics=/example/result.action formId=myForm
href=%{ajaxResultUrl} onclick=getResult() / /td
tds:reset
name=reset //td
/tr
/table
   /td

/tr
tr
td colspan=3
   s:url id=ajaxResultUrl
value=/example/result.action 
   s:param name=build value=%{'on'} /
/s:url
s:div theme=ajax id=resultDiv formId=myForm
loadingText=Loading Result... listenTopics=/example/result.action
href=%{ajaxResultUrl} /
/td

RE: SPAM WARNING!: RE: Struts2 : Calling AJAX function on button click(ONLY)

2008-10-28 Thread Kanade, Sayali
Hi,

Still stuck here, can anyone please provide examples of populating a div by 
calling an action after page load on button click??
Is this supposed to be this hard?? :(

Any help would be appreciated.

Thanks!
Regards,
Sayali.

-Original Message-
From: Kanade, Sayali 
Sent: Tuesday, October 28, 2008 2:02 PM
To: Mileidys Gonzalez Prieto; user@struts.apache.org
Subject: SPAM WARNING!: RE: Struts2 : Calling AJAX function on button 
click(ONLY) 

Thanks for your reply, but not sure it answers my question.

My question is: How can I prevent a div from refreshing its contents on page 
load? The div should only be refreshed on button click.

My problem is that, my div loads on page load. It also reloads on submit button 
click, but it should ONLY load on submit click, not on page load.

The action that executes in my div has to be only executed after the user 
selects a checkbox and clicks submit.

Please help, I have browsed for this answer for hours!!!

Regards,
Sayali.
 
-Original Message-
From: Mileidys Gonzalez Prieto [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2008 11:10 AM
To: Kanade, Sayali; user@struts.apache.org
Subject: RE: Struts2 : Calling AJAX function on button click and passing form 
parameters to the same

Hi,
I don't' know if I get the idea about what do u want to do, but I will try
to copy some codes about how I resolve something similar, using AjaxTags

ajax:htmlContent target=tabContent source=sendAfs doPost=true 
baseUrl=${pageContext.request.contextPath}/relatie/tabAfspraken.do

parameters=id=${rsKlantId},action=saveAfs,${paramsForm} /

in this case the id for my button is sendAfs and is sending my post
everything that is in the form. In my case is really a lot of fields and is
difficult to copy one by one, then for me was better to create a form that
will get all the fields:

Fields:
public String filterArtikelNr;
public String filterArtikel;
public String filterSoort;
public String filterMerk;
public String filterType;
public String filterVervallen;

Function for get an string with the parameters list in the form: 
paramaterName = {paramaterName}
This is the way for write the fields in Ajax
public String getParams(){
StringBuilder sb = new StringBuilder();
Field[] f = this.getClass().getFields();
for (Field field : f) {
sb.append(field.getName() + ={ + field.getName() +
},);
}
return sb.toString();
}

Mileidys González Prieto
Consultant
i-Frontier
 
Henck Arronstraat 16 | P.O.Box 12858 | Paramaribo, Suriname (SA)
Office: (597)-424073 | Mobile: (597)-8810219
www.i-frontier.net
-Original Message-
From: Kanade, Sayali [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2008 11:05 AM
To: user@struts.apache.org
Subject: RE: Struts2 : Calling AJAX function on button click and passing
form parameters to the same

Hi,

Can someone please help me out with the problem I mentioned below? I am
using Struts 2.0.11.2.

Any help will be greatly appreciated!!
Thanks!
Regards,
Sayali.
 
-Original Message-
From: Kanade, Sayali 
Sent: Monday, October 27, 2008 2:47 PM
To: user@struts.apache.org
Subject: SPAM WARNING!: Struts2 : Calling AJAX function on button click
and passing form parameters to the same

Hi All,

I am new to Struts 2, so please forgive me if this question is inane.

I have a very simple form which has some checkboxes and on the click of
the submit button of the form, I want to pass the values of the form to
an AJAX action.

CODE SNIPPET
STARTS#

script type=text/javascript
function getResult(){
 
//document.getElementById(diaryRecords).setAttribute(href,
/equipment.showHistory.action?serialNumber=+serialNumber);
//alert('In Get result');
buildValue = document.myForm.build.value;
//alert('buildValue : '+buildValue);
//dojo.event.topic.publish('/example/result.action',
buildValue);

document.myForm.hiddenbuild.value=buildValue;

//alert('document.myForm.hiddenbuild.value :
'+document.myForm.hiddenbuild.value)
}
/script

:
:

s:form action=/example/homepage.action method=post name=myForm
validate=true
   :
 :
td width=5% 
   input type=checkbox name=build /
   /td
:
:
tr
td s:submit theme=ajax targets=resultDiv
notifyTopics=/example/result.action formId=myForm
href=%{ajaxResultUrl} onclick=getResult() / /td
tds:reset
name=reset //td
/tr
/table

Struts2 : Calling AJAX function on button click and passing form parameters to the same

2008-10-27 Thread Kanade, Sayali
Hi All,

I am new to Struts 2, so please forgive me if this question is inane.

I have a very simple form which has some checkboxes and on the click of
the submit button of the form, I want to pass the values of the form to
an AJAX action.

CODE SNIPPET
STARTS#

script type=text/javascript
function getResult(){
 
//document.getElementById(diaryRecords).setAttribute(href,
/equipment.showHistory.action?serialNumber=+serialNumber);
//alert('In Get result');
buildValue = document.myForm.build.value;
//alert('buildValue : '+buildValue);
//dojo.event.topic.publish('/example/result.action',
buildValue);

document.myForm.hiddenbuild.value=buildValue;

//alert('document.myForm.hiddenbuild.value :
'+document.myForm.hiddenbuild.value)
}
/script

:
:

s:form action=/example/homepage.action method=post name=myForm
validate=true
   :
 :
td width=5% 
   input type=checkbox name=build /
   /td
:
:
tr
td s:submit theme=ajax targets=resultDiv
notifyTopics=/example/result.action formId=myForm
href=%{ajaxResultUrl} onclick=getResult() / /td
tds:reset
name=reset //td
/tr
/table
   /td

/tr
tr
td colspan=3
   s:url id=ajaxResultUrl
value=/example/result.action 
   s:param name=build value=%{'on'} /
/s:url
s:div theme=ajax id=resultDiv formId=myForm
loadingText=Loading Result... listenTopics=/example/result.action
href=%{ajaxResultUrl} /
/td
/tr
:
:
/s:form
##CODE SNIPPET
ENDS#

Now, I have two problems in this:
1. I am unable to pass the form parameters to the action. As you can see
that the form submits to homepage.action, but I want the AJAX call to
load from result.action. I have passed the formId to the div, but it
doesn't get the form parameters in the request. To work around this, I
am passing the value of build (build is a checkbox) as a param and
referencing the URL on the div as href.
2. The problem with pass as href : The result.action executes on page
load, I want it to execute on the submit button click and then display
the result.

Ideally, when I click submit, I want these form elements to be submitted
to result.action and the result will be displayed.

The code snippet above submits the build value as 'on' to the form and
the result is displayed on page load.

Please help, I wasn't able to get any good code examples doing this, it
would help immensely if I could get that.

Thanks for reading,
Regards,
Sayali.
 

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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-20 Thread MyAshok

Hi all,

Thanks for all your response.

Finally i isolated the problem and found that the problem is with the ajax
submit of the same div. (i.e) my form and the submit targets to the same
div. This scenerio creates the problem that the values in the jsp is not
populated to the action by autowiring.

login.jsp

div id=id1
s:form id=myform action=login 
s:textfield name=username/
s:submit type=submit theme=ajax targets=id1/
/div

In struts.xml, result type=successlogin.jsp/result




How can i sort out this issue.

I tried with simple samples and searched as much as possible. But i cant get
a clear solution.
Waiting for some clear solution.

Thanks again to all.

With Regards,
Ashok




Jeromy Evans - Blue Sky Minds wrote:
 
 Martin Gainty wrote:

 var xmlhttp=dojo.hostenv.getXmlhttpObject()
 var response= xmlhttp.responseXML;
 var parsed_response=SomeXMLParser(response);
 document.getElementByTagId(div).innerHtml = parsed_response;
 --
 /script

 yes/no?
 Martin 
   
 
 That would work, but dojo already includes code to invoke the right XML 
 parser depending on the browser and includes code to strip the 
 javascript out of the parsed response and execute it after updating the 
 DOM.  So it's best to reuse that code (which is behaviour of the widget) 
 rather than rewrite an 80% complete solution.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p19065871.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-20 Thread Jeromy Evans

MyAshok wrote:

Hi all,

Thanks for all your response.

Finally i isolated the problem and found that the problem is with the ajax
submit of the same div. (i.e) my form and the submit targets to the same
div. This scenerio creates the problem that the values in the jsp is not
populated to the action by autowiring.

  


That sounds an awful lot like the previously mentioned Dojo/IE bug.

Turn off the loading text (showLoadingText=false) on the widget that 
generates the request and see how you go.



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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-20 Thread MyAshok

Hi Jeromy,


We got it. Its working fine.

Thank you very much for the quick reply.

Can you tell me whats might be the problem with my IE.

Regards,
Ashok.







Jeromy Evans - Blue Sky Minds wrote:
 
 MyAshok wrote:
 Hi all,

 Thanks for all your response.

 Finally i isolated the problem and found that the problem is with the
 ajax
 submit of the same div. (i.e) my form and the submit targets to the same
 div. This scenerio creates the problem that the values in the jsp is not
 populated to the action by autowiring.

   
 
 That sounds an awful lot like the previously mentioned Dojo/IE bug.
 
 Turn off the loading text (showLoadingText=false) on the widget that 
 generates the request and see how you go.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p19067009.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-20 Thread Dave Newton
- On Wed, 8/20/08, MyAshok wrote:
 Can you tell me whats might be the problem with my IE.

It's IE.

Dave


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-20 Thread Jeromy Evans

Dave Newton wrote:

- On Wed, 8/20/08, MyAshok wrote:
  

Can you tell me whats might be the problem with my IE.



It's IE.

Dave

  


He he he.

I don't know for certain, but I think it's due to IE's non-standard 
event-handling (event ordering) and Dojo's/widget's failure to 
accommodate that in this specific case.
In effect, the DOM is updated with the loading text before the code 
reads the values from the form; The result is that the body of the 
request is empty.


Here's the interesting details: 
http://www.quirksmode.org/js/events_order.html


It's the responsibility of the widget to accommodate it, but it's better 
to use the indicator attribute instead of the loading text anyway.


I've lost count of how many times we've responded to questions about 
this this frequently encountered problem.





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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-20 Thread Musachy Barroso
Indeed, can't wait for 2.1 to come out, at least this setting will be
set to false by default.

On Wed, Aug 20, 2008 at 8:07 PM, Jeromy Evans
[EMAIL PROTECTED] wrote:
 Dave Newton wrote:

 - On Wed, 8/20/08, MyAshok wrote:


 Can you tell me whats might be the problem with my IE.


 It's IE.

 Dave



 He he he.

 I don't know for certain, but I think it's due to IE's non-standard
 event-handling (event ordering) and Dojo's/widget's failure to accommodate
 that in this specific case.
 In effect, the DOM is updated with the loading text before the code reads
 the values from the form; The result is that the body of the request is
 empty.

 Here's the interesting details:
 http://www.quirksmode.org/js/events_order.html

 It's the responsibility of the widget to accommodate it, but it's better to
 use the indicator attribute instead of the loading text anyway.

 I've lost count of how many times we've responded to questions about this
 this frequently encountered problem.




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





-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-18 Thread Jeromy Evans

MyAshok wrote:

I do have the same issue. on click of submit, the loadingtext  is displaying
but the result in a new page as i am redirect to a action. 


Any solutions? please asap.

action name=activateSubscriber class=subscriberAction
method=activateSubscriber
result name=success 
type=redirect-actionviewPartners/result
/action
Waiting for reply..

  


If it's performing a full-page redirect, then your form did a plain old 
post/get to the action, not ajax.
You will need to isolate why the request wasn't sent via XHR.  That 
means it's a client-side problem, not a struts.xml problem.


As a guess, without any context, if you've only tested in IE so far, 
turn off the loadingText message. 




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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-18 Thread MyAshok


Thanks Evans,

In IE, instead of loading text it shows [object error]. But it redirects to
a new page.

In Firefox, neither showing loading text nor object error. It redirects to a
new page.


s:submit  theme=ajax value=Activate id=activate
showLoadingText=false targets=targetid
onclick=javascript:activatePartnerSubscriber();  /

script 
--

function activatePartnerSubscriber() {

subCount =  document.getElementById('subCount').value;

var count = selectedCheckBoxCount();
if (count = 1) {

document.getElementById('SubscriberForm').action
='/myproj/activate.action';

document.getElementById('SubscriberForm').submit();
} else {
alert(Please select atleast one Subscriber);
}
}

I am unable to find where the ajax request is missing. Please Give some
ideas to proceed.

with hope,
Ashok




Jeromy Evans - Blue Sky Minds wrote:
 
 MyAshok wrote:
 I do have the same issue. on click of submit, the loadingtext  is
 displaying
 but the result in a new page as i am redirect to a action. 

 Any solutions? please asap.

 action name=activateSubscriber class=subscriberAction
  method=activateSubscriber
  result name=success 
 type=redirect-actionviewPartners/result
  /action
 Waiting for reply..

   
 
 If it's performing a full-page redirect, then your form did a plain old 
 post/get to the action, not ajax.
 You will need to isolate why the request wasn't sent via XHR.  That 
 means it's a client-side problem, not a struts.xml problem.
 
 As a guess, without any context, if you've only tested in IE so far, 
 turn off the loadingText message. 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p19030271.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-18 Thread Dave Newton
I'd be immediately suspicious of your manual form submission; as a guess I'd 
say that bypasses the normal form submission process, making it a non-XHR 
request.

Off-the-cuff guess, though.

Dave


--- On Mon, 8/18/08, MyAshok [EMAIL PROTECTED] wrote:

 From: MyAshok [EMAIL PROTECTED]
 Subject: Re: struts2: simple ajax form - returns value to a new page (not to 
 a DIV)
 To: user@struts.apache.org
 Date: Monday, August 18, 2008, 8:08 AM
 Thanks Evans,
 
 In IE, instead of loading text it shows [object error]. But
 it redirects to
 a new page.
 
 In Firefox, neither showing loading text nor object error.
 It redirects to a
 new page.
 
 
 s:submit  theme=ajax
 value=Activate id=activate
 showLoadingText=false
 targets=targetid
 onclick=javascript:activatePartnerSubscriber();
  /
 
 script 
 --
 
   function activatePartnerSubscriber() {
 
   subCount =
   document.getElementById('subCount').value;
   
   var count = selectedCheckBoxCount();
   if (count = 1) {
   
   document.getElementById('SubscriberForm').action
 ='/myproj/activate.action';
 
   document.getElementById('SubscriberForm').submit();
   } else {
   alert(Please select atleast one Subscriber);
   }
   }
 
 I am unable to find where the ajax request is missing.
 Please Give some
 ideas to proceed.
 
 with hope,
 Ashok
 
 
 
 
 Jeromy Evans - Blue Sky Minds wrote:
  
  MyAshok wrote:
  I do have the same issue. on click of submit, the
 loadingtext  is
  displaying
  but the result in a new page as i am redirect to a
 action. 
 
  Any solutions? please asap.
 
  action name=activateSubscriber
 class=subscriberAction
 method=activateSubscriber
 result name=success
 type=redirect-actionviewPartners/result
 /action
  Waiting for reply..
 

  
  If it's performing a full-page redirect, then your
 form did a plain old 
  post/get to the action, not ajax.
  You will need to isolate why the request wasn't
 sent via XHR.  That 
  means it's a client-side problem, not a struts.xml
 problem.
  
  As a guess, without any context, if you've only
 tested in IE so far, 
  turn off the loadingText message. 
  
  
  
 
 -
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
  
  
  
 
 -- 
 View this message in context:
 http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p19030271.html
 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]



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-18 Thread Jeromy Evans

Dave Newton wrote:

I'd be immediately suspicious of your manual form submission; as a guess I'd 
say that bypasses the normal form submission process, making it a non-XHR 
request.

Off-the-cuff guess, though.

Dave
  


Absolutely positive that's it.

This line:

document.getElementById('SubscriberForm').submit();

performs a plain only non-ajax request.

MyAshok, see the dojo ajax recipes for how to cause an ajax submit using 
the publish/subscribe event model.




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



RE: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-18 Thread Martin Gainty

you can send your action to javascript function
and use dojo to talk  to the XMLHttpRequest object
parse the XML response
and then set innerHtml of the div tag to the parsed_response

script language=JavaScript


!-- Begin


function doit() 


{

var xmlhttp=dojo.hostenv.getXmlhttpObject()
var response= xmlhttp.responseXML;
var parsed_response=SomeXMLParser(response);
document.getElementByTagId(div).innerHtml = parsed_response;
--
/script

yes/no?
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: Mon, 18 Aug 2008 21:18:44 +1000
 From: [EMAIL PROTECTED]
 To: user@struts.apache.org
 Subject: Re: struts2: simple ajax form - returns value to a new page (not to 
 a DIV)
 
 MyAshok wrote:
  I do have the same issue. on click of submit, the loadingtext  is displaying
  but the result in a new page as i am redirect to a action. 
 
  Any solutions? please asap.
 
  action name=activateSubscriber class=subscriberAction
  method=activateSubscriber
  result name=success 
  type=redirect-actionviewPartners/result
  /action
  Waiting for reply..
 

 
 If it's performing a full-page redirect, then your form did a plain old 
 post/get to the action, not ajax.
 You will need to isolate why the request wasn't sent via XHR.  That 
 means it's a client-side problem, not a struts.xml problem.
 
 As a guess, without any context, if you've only tested in IE so far, 
 turn off the loadingText message. 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

_
Get ideas on sharing photos from people like you.  Find new ways to share.
http://www.windowslive.com/explore/photogallery/posts?ocid=TXT_TAGLM_WL_Photo_Gallery_082008

Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-18 Thread Jeromy Evans

Martin Gainty wrote:


var xmlhttp=dojo.hostenv.getXmlhttpObject()
var response= xmlhttp.responseXML;
var parsed_response=SomeXMLParser(response);
document.getElementByTagId(div).innerHtml = parsed_response;
--
/script

yes/no?
Martin 
  


That would work, but dojo already includes code to invoke the right XML 
parser depending on the browser and includes code to strip the 
javascript out of the parsed response and execute it after updating the 
DOM.  So it's best to reuse that code (which is behaviour of the widget) 
rather than rewrite an 80% complete solution.



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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-08-17 Thread MyAshok

I do have the same issue. on click of submit, the loadingtext  is displaying
but the result in a new page as i am redirect to a action. 

Any solutions? please asap.

action name=activateSubscriber class=subscriberAction
method=activateSubscriber
result name=success 
type=redirect-actionviewPartners/result
/action
Waiting for reply..


Jeromy Evans - Blue Sky Minds wrote:
 
 View the html source in the browser.
 
 The head should contain a script like this one from the struts2-showcase:
 
 script type=text/javascript
 // Dojo configuration
 djConfig = {
 baseRelativePath: /struts2-showcase/struts/dojo,
 isDebug: false,
 bindEncoding: UTF-8,
 debugAtAllCosts: true // not needed, but allows the Venkman
 debugger to work with the includes
 };
 /script
 script type=text/javascript
 src=/struts2-showcase/struts/dojo/dojo.js/script
 script type=text/javascript
 src=/struts2-showcase/struts/simple/dojoRequire.js/script
 
 script type=text/javascript
 src=/struts2-showcase/struts/ajax/dojoRequire.js/script
 script type=text/javascript
 src=/struts2-showcase/struts/CommonFunctions.js/script
 
 
 In FireBug, you should see all those scripts being found.
 
 xianwinwin wrote:

 Check that dojo is setup in the head of your page (view the html)
 how do I do that?

 Thank you!


 Jeromy Evans - Blue Sky Minds wrote:
   
 Use the FireBug plugin for FF.

 Check that dojo is setup in the head of your page (view the html) and 
 that all of the resources it requires are loaded (using the net tab). 
 Ensure that struts filter is receiving requests for the /struts/*
 resources.

 xianwinwin wrote:
 
 :-( 
 I think I have an issue with the ajax configuration (I'm not sure).
 How can I verify that my theme=ajax is configured properly?

 thank you!





 Jeromy Evans - Blue Sky Minds wrote:
   
   
 No, it seems fine now.

 Turn on debugging:

 s:head theme=ajax debug=true/

 Also use FireBug to see if there's any javascript errors reported.


 xianwinwin wrote:
 
 
 thanks you for the reply. I added the code:

 s:head theme=ajax/

 on top, plus

 s:submit value=GO2 showLoadingText=false  theme=ajax
 targets=two
 /

 but I get the same result - it goes to an empty page with the result
 and
 not
 to the DIV?
 :-(

 any idea?





 xianwinwin wrote:
   
   
   
 Hi all,
 I'm trying to return a result to DIV in a form (in the example
 id='two')

 this is my form:

 div id='two' style=border: 1px solid yellow;initial
 content/div
 s:form
 id='theForm2'
 cssStyle=border: 1px solid green;
 action='testing_AjaxRemoteForm'
 method='post'
 theme=ajax

 input type='text' name='data' value='Struts User'

 s:submit value=GO2 theme=ajax targets=theForm2/

 /s:form

 when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
 'activated' (showing the 'data' the user has input)

 public String AjaxRemoteForm()
 {
 System.out.println(active ajax test 1 with data: 
 +data);
 return test.ajax.2;
 }

 and routed to AjaxResult3.jsp:

 action name=testing_*  method={1}
 class=com.struts.user.account.TestingAction  
 result name=test.1   
 type=tilestest_1/result
 result
 name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
 interceptor-ref name=user/
 /action



 The result comes in a NEW page with the 'data' value the user has
 input



 AjaxResult3.jsp 
 -
 %@ taglib prefix=s uri=/struts-tags %

 %
 request.setAttribute(decorator, none);
 response.setHeader(Cache-Control,no-cache); //HTTP 1.1
 response.setHeader(Pragma,no-cache); //HTTP 1.0
 response.setDateHeader (Expires, 0); //prevents caching at the
 proxy
 server
 %

 The value you entered was: s:property value=data/br/




 Q: How can I incorporate the 'data' value in the DIV and not in a
 new
 page?

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



 

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

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p19026280.html
Sent from the Struts - User mailing list archive at Nabble.com

Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-20 Thread xianwinwin

:-( 
I think I have an issue with the ajax configuration (I'm not sure).
How can I verify that my theme=ajax is configured properly?

thank you!





Jeromy Evans - Blue Sky Minds wrote:
 
 No, it seems fine now.
 
 Turn on debugging:
 
 s:head theme=ajax debug=true/
 
 Also use FireBug to see if there's any javascript errors reported.
 
 
 xianwinwin wrote:
 thanks you for the reply. I added the code:

 s:head theme=ajax/

 on top, plus

 s:submit value=GO2 showLoadingText=false  theme=ajax targets=two
 /

 but I get the same result - it goes to an empty page with the result and
 not
 to the DIV?
 :-(

 any idea?





 xianwinwin wrote:
   
 Hi all,
 I'm trying to return a result to DIV in a form (in the example id='two')

 this is my form:

 div id='two' style=border: 1px solid yellow;initial content/div
 s:form
 id='theForm2'
 cssStyle=border: 1px solid green;
 action='testing_AjaxRemoteForm'
 method='post'
 theme=ajax

 input type='text' name='data' value='Struts User'

 s:submit value=GO2 theme=ajax targets=theForm2/

 /s:form

 when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
 'activated' (showing the 'data' the user has input)

 public String AjaxRemoteForm()
 {
 System.out.println(active ajax test 1 with data: +data);
 return test.ajax.2;
 }

 and routed to AjaxResult3.jsp:

 action name=testing_*  method={1}
 class=com.struts.user.account.TestingAction  
 result name=test.1   
 type=tilestest_1/result
 result 
 name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
 interceptor-ref name=user/
 /action



 The result comes in a NEW page with the 'data' value the user has input



 AjaxResult3.jsp 
 -
 %@ taglib prefix=s uri=/struts-tags %

 %
 request.setAttribute(decorator, none);
 response.setHeader(Cache-Control,no-cache); //HTTP 1.1
 response.setHeader(Pragma,no-cache); //HTTP 1.0
 response.setDateHeader (Expires, 0); //prevents caching at the
 proxy
 server
 %

 The value you entered was: s:property value=data/br/




 Q: How can I incorporate the 'data' value in the DIV and not in a new
 page?

 

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

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15595878.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-20 Thread bhaarat Sharma
you can try the following.
change:
div id=\'two\' style=\border: 1px solid yellow;\initial content/div
to
s:div id=\two\ theme=\ajax\ (close this tag after your /s:form
tag, so that the whole form will be inside the div tag. )

also change:
s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/
to
 s:submit value=\GO2\ theme=\ajax\ targets=\two\/

also nowhere in your page (where users enter data) do i see how you
would be displaying the information to the user...even if data wasnt
being submitted to a new page. you can try the following somewhere
inside the s:div tag:
s:actionmessage/

ofcourse then in your action you will have to do:
addActionMessage(\Put w/e data you want in here\);

Hopefully it works out for your..



On 2/19/08, xianwinwin [EMAIL PROTECTED] wrote:

 Hi all,
 I\'m trying to return a result to DIV in a form (in the example id=\'two\')

 this is my form:

 div id=\'two\' style=\border: 1px solid yellow;\initial content/div
 s:form
 id=\'theForm2\'
 cssStyle=\border: 1px solid green;\
 action=\'testing_AjaxRemoteForm\'
 method=\'post\'
 theme=\ajax\

 input type=\'text\' name=\'data\' value=\'Struts User\'

 s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/

 /s:form

 when the user clicks the GO2 -- the action, AjaxRemoteForm,  is \'activated\'
 (showing the \'data\' the user has input)

 public String AjaxRemoteForm()
 {
 System.out.println(\active ajax test 1 with data: \+data);
 return \test.ajax.2\;
 }

 and routed to AjaxResult3.jsp:

 action name=\testing_*\  method=\{1}\
 class=\com.struts.user.account.TestingAction\
 result name=\test.1\   
 type=\tiles\test_1/result
 result 
 name=\test.ajax.2\/pages/welcome/AjaxResult3.jsp/result
 interceptor-ref name=\user\/
 /action



 The result comes in a NEW page with the \'data\' value the user has input



 \AjaxResult3.jsp\
 -
 %@ taglib prefix=\s\ uri=\/struts-tags\ %

 %
 request.setAttribute(\decorator\, \none\);
 response.setHeader(\Cache-Control\,\no-cache\); //HTTP 1.1
 response.setHeader(\Pragma\,\no-cache\); //HTTP 1.0
 response.setDateHeader (\Expires\, 0); //prevents caching at the proxy
 server
 %

 The value you entered was: s:property value=\data\/br/




 Q: How can I incorporate the \'data\' value in the DIV and not in a new page?
 --
 View this message in context: 
 http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15562626.html
 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]



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-20 Thread xianwinwin

thank you for your reply.

I made the changes - still no good.

I took one step backwards and I suspect that my theme=ajax doesn't work
properly. 
I tried to use a simple TABS and the result on the screen was text (the
names of the tabs).

Do you think that what causing the problem? 
How can I tell if I have the theme=ajax installed correctly? 



omnipresent wrote:
 
 you can try the following.
 change:
 div id=\'two\' style=\border: 1px solid yellow;\initial content/div
 to
 s:div id=\two\ theme=\ajax\ (close this tag after your /s:form
 tag, so that the whole form will be inside the div tag. )
 
 also change:
 s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/
 to
 s:submit value=\GO2\ theme=\ajax\ targets=\two\/
 
 also nowhere in your page (where users enter data) do i see how you
 would be displaying the information to the user...even if data wasnt
 being submitted to a new page. you can try the following somewhere
 inside the s:div tag:
 s:actionmessage/
 
 ofcourse then in your action you will have to do:
 addActionMessage(\Put w/e data you want in here\);
 
 Hopefully it works out for your..
 
 
 
 On 2/19/08, xianwinwin [EMAIL PROTECTED] wrote:
 
 Hi all,
 I\'m trying to return a result to DIV in a form (in the example
 id=\'two\')

 this is my form:

 div id=\'two\' style=\border: 1px solid yellow;\initial content/div
 s:form
 id=\'theForm2\'
 cssStyle=\border: 1px solid green;\
 action=\'testing_AjaxRemoteForm\'
 method=\'post\'
 theme=\ajax\

 input type=\'text\' name=\'data\' value=\'Struts User\'

 s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/

 /s:form

 when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
 \'activated\'
 (showing the \'data\' the user has input)

 public String AjaxRemoteForm()
 {
 System.out.println(\active ajax test 1 with data:
 \+data);
 return \test.ajax.2\;
 }

 and routed to AjaxResult3.jsp:

 action name=\testing_*\  method=\{1}\
 class=\com.struts.user.account.TestingAction\
 result name=\test.1\  
 type=\tiles\test_1/result
 result
 name=\test.ajax.2\/pages/welcome/AjaxResult3.jsp/result
 interceptor-ref name=\user\/
 /action



 The result comes in a NEW page with the \'data\' value the user has input



 \AjaxResult3.jsp\
 -
 %@ taglib prefix=\s\ uri=\/struts-tags\ %

 %
 request.setAttribute(\decorator\, \none\);
 response.setHeader(\Cache-Control\,\no-cache\); //HTTP 1.1
 response.setHeader(\Pragma\,\no-cache\); //HTTP 1.0
 response.setDateHeader (\Expires\, 0); //prevents caching at the
 proxy
 server
 %

 The value you entered was: s:property value=\data\/br/




 Q: How can I incorporate the \'data\' value in the DIV and not in a new
 page?
 --
 View this message in context:
 http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15562626.html
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15598163.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-20 Thread Jeromy Evans

Use the FireBug plugin for FF.

Check that dojo is setup in the head of your page (view the html) and 
that all of the resources it requires are loaded (using the net tab). 
Ensure that struts filter is receiving requests for the /struts/* resources.


xianwinwin wrote:
:-( 
I think I have an issue with the ajax configuration (I'm not sure).

How can I verify that my theme=ajax is configured properly?

thank you!





Jeromy Evans - Blue Sky Minds wrote:
  

No, it seems fine now.

Turn on debugging:

s:head theme=ajax debug=true/

Also use FireBug to see if there's any javascript errors reported.


xianwinwin wrote:


thanks you for the reply. I added the code:

s:head theme=ajax/

on top, plus

s:submit value=GO2 showLoadingText=false  theme=ajax targets=two
/

but I get the same result - it goes to an empty page with the result and
not
to the DIV?
:-(

any idea?





xianwinwin wrote:
  
  

Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

div id='two' style=border: 1px solid yellow;initial content/div
s:form
id='theForm2'
cssStyle=border: 1px solid green;
action='testing_AjaxRemoteForm'
method='post'
theme=ajax

input type='text' name='data' value='Struts User'

s:submit value=GO2 theme=ajax targets=theForm2/

/s:form

when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
'activated' (showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println(active ajax test 1 with data: +data);
return test.ajax.2;
}

and routed to AjaxResult3.jsp:

action name=testing_*  method={1}
class=com.struts.user.account.TestingAction 
result name=test.1  
type=tilestest_1/result
result 
name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
interceptor-ref name=user/
/action



The result comes in a NEW page with the 'data' value the user has input



AjaxResult3.jsp 
-

%@ taglib prefix=s uri=/struts-tags %

%
request.setAttribute(decorator, none);
response.setHeader(Cache-Control,no-cache); //HTTP 1.1
response.setHeader(Pragma,no-cache); //HTTP 1.0
response.setDateHeader (Expires, 0); //prevents caching at the
proxy
server
%

The value you entered was: s:property value=data/br/




Q: How can I incorporate the 'data' value in the DIV and not in a new
page?



  
  

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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-20 Thread xianwinwin



Check that dojo is setup in the head of your page (view the html)
how do I do that?

Thank you!


Jeromy Evans - Blue Sky Minds wrote:
 
 Use the FireBug plugin for FF.
 
 Check that dojo is setup in the head of your page (view the html) and 
 that all of the resources it requires are loaded (using the net tab). 
 Ensure that struts filter is receiving requests for the /struts/*
 resources.
 
 xianwinwin wrote:
 :-( 
 I think I have an issue with the ajax configuration (I'm not sure).
 How can I verify that my theme=ajax is configured properly?

 thank you!





 Jeromy Evans - Blue Sky Minds wrote:
   
 No, it seems fine now.

 Turn on debugging:

 s:head theme=ajax debug=true/

 Also use FireBug to see if there's any javascript errors reported.


 xianwinwin wrote:
 
 thanks you for the reply. I added the code:

 s:head theme=ajax/

 on top, plus

 s:submit value=GO2 showLoadingText=false  theme=ajax
 targets=two
 /

 but I get the same result - it goes to an empty page with the result
 and
 not
 to the DIV?
 :-(

 any idea?





 xianwinwin wrote:
   
   
 Hi all,
 I'm trying to return a result to DIV in a form (in the example
 id='two')

 this is my form:

 div id='two' style=border: 1px solid yellow;initial content/div
 s:form
 id='theForm2'
 cssStyle=border: 1px solid green;
 action='testing_AjaxRemoteForm'
 method='post'
 theme=ajax

 input type='text' name='data' value='Struts User'

 s:submit value=GO2 theme=ajax targets=theForm2/

 /s:form

 when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
 'activated' (showing the 'data' the user has input)

   public String AjaxRemoteForm()
   {
   System.out.println(active ajax test 1 with data: +data);
   return test.ajax.2;
   }

 and routed to AjaxResult3.jsp:

 action name=testing_*  method={1}
 class=com.struts.user.account.TestingAction
   result name=test.1   
 type=tilestest_1/result
   result 
 name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
 interceptor-ref name=user/
 /action



 The result comes in a NEW page with the 'data' value the user has
 input



 AjaxResult3.jsp 
 -
 %@ taglib prefix=s uri=/struts-tags %

 %
 request.setAttribute(decorator, none);
 response.setHeader(Cache-Control,no-cache); //HTTP 1.1
 response.setHeader(Pragma,no-cache); //HTTP 1.0
 response.setDateHeader (Expires, 0); //prevents caching at the
 proxy
 server
 %

 The value you entered was: s:property value=data/br/




 Q: How can I incorporate the 'data' value in the DIV and not in a new
 page?

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

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15601041.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-20 Thread Jeromy Evans

View the html source in the browser.

The head should contain a script like this one from the struts2-showcase:

script type=text/javascript
   // Dojo configuration
   djConfig = {
   baseRelativePath: /struts2-showcase/struts/dojo,
   isDebug: false,
   bindEncoding: UTF-8,
   debugAtAllCosts: true // not needed, but allows the Venkman debugger to 
work with the includes
   };
/script
script type=text/javascript
   src=/struts2-showcase/struts/dojo/dojo.js/script
script type=text/javascript
   src=/struts2-showcase/struts/simple/dojoRequire.js/script

script type=text/javascript
   src=/struts2-showcase/struts/ajax/dojoRequire.js/script
script type=text/javascript
   src=/struts2-showcase/struts/CommonFunctions.js/script


In FireBug, you should see all those scripts being found.

xianwinwin wrote:


Check that dojo is setup in the head of your page (view the html)
how do I do that?

Thank you!


Jeromy Evans - Blue Sky Minds wrote:
  

Use the FireBug plugin for FF.

Check that dojo is setup in the head of your page (view the html) and 
that all of the resources it requires are loaded (using the net tab). 
Ensure that struts filter is receiving requests for the /struts/*

resources.

xianwinwin wrote:

:-( 
I think I have an issue with the ajax configuration (I'm not sure).

How can I verify that my theme=ajax is configured properly?

thank you!





Jeromy Evans - Blue Sky Minds wrote:
  
  

No, it seems fine now.

Turn on debugging:

s:head theme=ajax debug=true/

Also use FireBug to see if there's any javascript errors reported.


xianwinwin wrote:



thanks you for the reply. I added the code:

s:head theme=ajax/

on top, plus

s:submit value=GO2 showLoadingText=false  theme=ajax
targets=two
/

but I get the same result - it goes to an empty page with the result
and
not
to the DIV?
:-(

any idea?





xianwinwin wrote:
  
  
  

Hi all,
I'm trying to return a result to DIV in a form (in the example
id='two')

this is my form:

div id='two' style=border: 1px solid yellow;initial content/div
s:form
id='theForm2'
cssStyle=border: 1px solid green;
action='testing_AjaxRemoteForm'
method='post'
theme=ajax

input type='text' name='data' value='Struts User'

s:submit value=GO2 theme=ajax targets=theForm2/

/s:form

when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
'activated' (showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println(active ajax test 1 with data: +data);
return test.ajax.2;
}

and routed to AjaxResult3.jsp:

action name=testing_*  method={1}
class=com.struts.user.account.TestingAction 
result name=test.1  
type=tilestest_1/result
result 
name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
interceptor-ref name=user/
/action



The result comes in a NEW page with the 'data' value the user has
input



AjaxResult3.jsp 
-

%@ taglib prefix=s uri=/struts-tags %

%
request.setAttribute(decorator, none);
response.setHeader(Cache-Control,no-cache); //HTTP 1.1
response.setHeader(Pragma,no-cache); //HTTP 1.0
response.setDateHeader (Expires, 0); //prevents caching at the
proxy
server
%

The value you entered was: s:property value=data/br/




Q: How can I incorporate the 'data' value in the DIV and not in a new
page?




  
  
  

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






  


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



struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread xianwinwin

Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

div id='two' style=border: 1px solid yellow;initial content/div
s:form
id='theForm2'
cssStyle=border: 1px solid green;
action='testing_AjaxRemoteForm'
method='post'
theme=ajax

input type='text' name='data' value='Struts User'

s:submit value=GO2 theme=ajax targets=theForm2/

/s:form

when the user clicks the GO2 -- the action, AjaxRemoteForm,  is 'activated'
(showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println(active ajax test 1 with data: +data);
return test.ajax.2;
}

and routed to AjaxResult3.jsp:

action name=testing_*  method={1}
class=com.struts.user.account.TestingAction  
result name=test.1   
type=tilestest_1/result
result 
name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
interceptor-ref name=user/
/action



The result comes in a NEW page with the 'data' value the user has input



AjaxResult3.jsp 
-
%@ taglib prefix=s uri=/struts-tags %

%
request.setAttribute(decorator, none);
response.setHeader(Cache-Control,no-cache); //HTTP 1.1
response.setHeader(Pragma,no-cache); //HTTP 1.0
response.setDateHeader (Expires, 0); //prevents caching at the proxy
server
%

The value you entered was: s:property value=data/br/




Q: How can I incorporate the 'data' value in the DIV and not in a new page?
-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15562626.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread Jeromy Evans
Your code looks valid, but have you included the s:head theme=ajax/ 
tag in your head section?
It looks like the default event is executing (submit form for new page) 
rather than Dojo using ajax to post it.


Also, as your target is theForm2, add showLoadingText=false to your 
submit button.
Without that setting, unfortunately, IE writes the loading text over the 
target (your form) before it's even posted.


xianwinwin wrote:

Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

div id='two' style=border: 1px solid yellow;initial content/div
s:form
id='theForm2'
cssStyle=border: 1px solid green;
action='testing_AjaxRemoteForm'
method='post'
theme=ajax

input type='text' name='data' value='Struts User'

s:submit value=GO2 theme=ajax targets=theForm2/

/s:form

when the user clicks the GO2 -- the action, AjaxRemoteForm,  is 'activated'
(showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println(active ajax test 1 with data: +data);
return test.ajax.2;
}

and routed to AjaxResult3.jsp:

action name=testing_*  method={1}
class=com.struts.user.account.TestingAction 
result name=test.1  
type=tilestest_1/result
result 
name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
interceptor-ref name=user/
/action



The result comes in a NEW page with the 'data' value the user has input



AjaxResult3.jsp 
-

%@ taglib prefix=s uri=/struts-tags %

%
request.setAttribute(decorator, none);
response.setHeader(Cache-Control,no-cache); //HTTP 1.1
response.setHeader(Pragma,no-cache); //HTTP 1.0
response.setDateHeader (Expires, 0); //prevents caching at the proxy
server
%

The value you entered was: s:property value=data/br/




Q: How can I incorporate the 'data' value in the DIV and not in a new page?
  


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread xianwinwin

thanks you for the reply. I added the code:

s:head theme=ajax/

on top, plus

s:submit value=GO2 showLoadingText=false  theme=ajax targets=two /

but I get the same result - it goes to an empty page with the result and not
to the DIV?
:-(

any idea?





xianwinwin wrote:
 
 Hi all,
 I'm trying to return a result to DIV in a form (in the example id='two')
 
 this is my form:
 
 div id='two' style=border: 1px solid yellow;initial content/div
 s:form
 id='theForm2'
 cssStyle=border: 1px solid green;
 action='testing_AjaxRemoteForm'
 method='post'
 theme=ajax
 
 input type='text' name='data' value='Struts User'
 
 s:submit value=GO2 theme=ajax targets=theForm2/
 
 /s:form
 
 when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
 'activated' (showing the 'data' the user has input)
 
   public String AjaxRemoteForm()
   {
   System.out.println(active ajax test 1 with data: +data);
   return test.ajax.2;
   }
 
 and routed to AjaxResult3.jsp:
 
 action name=testing_*  method={1}
 class=com.struts.user.account.TestingAction
   result name=test.1   
 type=tilestest_1/result
   result 
 name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
 interceptor-ref name=user/
 /action
 
 
 
 The result comes in a NEW page with the 'data' value the user has input
 
 
 
 AjaxResult3.jsp 
 -
 %@ taglib prefix=s uri=/struts-tags %
 
 %
 request.setAttribute(decorator, none);
 response.setHeader(Cache-Control,no-cache); //HTTP 1.1
 response.setHeader(Pragma,no-cache); //HTTP 1.0
 response.setDateHeader (Expires, 0); //prevents caching at the proxy
 server
 %
 
 The value you entered was: s:property value=data/br/
 
 
 
 
 Q: How can I incorporate the 'data' value in the DIV and not in a new
 page?
 

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15579982.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: struts2: simple ajax form - returns value to a new page (not to a DIV)

2008-02-19 Thread Jeromy Evans

No, it seems fine now.

Turn on debugging:

s:head theme=ajax debug=true/

Also use FireBug to see if there's any javascript errors reported.


xianwinwin wrote:

thanks you for the reply. I added the code:

s:head theme=ajax/

on top, plus

s:submit value=GO2 showLoadingText=false  theme=ajax targets=two /

but I get the same result - it goes to an empty page with the result and not
to the DIV?
:-(

any idea?





xianwinwin wrote:
  

Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

div id='two' style=border: 1px solid yellow;initial content/div
s:form
id='theForm2'
cssStyle=border: 1px solid green;
action='testing_AjaxRemoteForm'
method='post'
theme=ajax

input type='text' name='data' value='Struts User'

s:submit value=GO2 theme=ajax targets=theForm2/

/s:form

when the user clicks the GO2 -- the action, AjaxRemoteForm,  is
'activated' (showing the 'data' the user has input)

public String AjaxRemoteForm()
{
System.out.println(active ajax test 1 with data: +data);
return test.ajax.2;
}

and routed to AjaxResult3.jsp:

action name=testing_*  method={1}
class=com.struts.user.account.TestingAction 
result name=test.1  
type=tilestest_1/result
result 
name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result
interceptor-ref name=user/
/action



The result comes in a NEW page with the 'data' value the user has input



AjaxResult3.jsp 
-

%@ taglib prefix=s uri=/struts-tags %

%
request.setAttribute(decorator, none);
response.setHeader(Cache-Control,no-cache); //HTTP 1.1
response.setHeader(Pragma,no-cache); //HTTP 1.0
response.setDateHeader (Expires, 0); //prevents caching at the proxy
server
%

The value you entered was: s:property value=data/br/




Q: How can I incorporate the 'data' value in the DIV and not in a new
page?




  


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



Struts2 with AJAX

2007-09-08 Thread animesh saxena
Hi,
   I am using a very basic AJAX code snippet with struts. No it's not
dojo. 

req = new XMLHttpRequest();
var url='http://localhost:8084/StrutsAjax/example/SearchAJAX.action';
req.open(POST,url,true);
req.onreadystatechange=searchResults;
req.send(null);   

in searchResults() function I just wnt to see req.responseText;

If I want to return some response from server side if I use something
crude like this

response.getOutputStream().print(htmlAnimesh/html);

It messes up struts and I get lots of exceptions in responseText.

I want to return some string from the server side which is accessible by
javascript code. It can be JSON or anything.

What should be the code on server side / my action class (execute
method) to return something to client side? Any suggestions??



Thanks,

Animesh


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



Re: Struts2 with AJAX

2007-09-08 Thread Nuwan Chandrasoma

Hi,

In your action class you have to return null after you write the 
response for eg:-


 public String ajax() throws Exception {

 respone.getWriter().println(hello);

 respone.getWriter().close();

 return null;

 }

and also i dont think you need to specify the full URL when you are 
doing the ajax call.,


Thanks,

Nuwan


animesh saxena wrote:

Hi,
   I am using a very basic AJAX code snippet with struts. No it's not
dojo. 


req = new XMLHttpRequest();
var url='http://localhost:8084/StrutsAjax/example/SearchAJAX.action';
req.open(POST,url,true);
req.onreadystatechange=searchResults;
req.send(null);   


in searchResults() function I just wnt to see req.responseText;

If I want to return some response from server side if I use something
crude like this

response.getOutputStream().print(htmlAnimesh/html);

It messes up struts and I get lots of exceptions in responseText.

I want to return some string from the server side which is accessible by
javascript code. It can be JSON or anything.

What should be the code on server side / my action class (execute
method) to return something to client side? Any suggestions??



Thanks,

Animesh


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



Re: Struts2 with AJAX file upload??

2006-12-16 Thread Don Brown

No, I don't see why you would need to.  If your page is creating the
proper multipart request, Struts should be able to handle it as long
as the target action uses an interceptor stack that contains the file
upload interceptor.

Don

On 12/15/06, Nagraj Rao [EMAIL PROTECTED] wrote:

well i had this tag in my struts-config.xml after all the acion mappings
controller
multipartClass=net.kencochrane.upload.ExtendedMultiPartRequestHandler /

Do i need to override the fileupload interceptor in this case??

- Original Message -
From: Don Brown [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Saturday, December 16, 2006 12:22 AM
Subject: Re: Struts2 with AJAX file upload??


 What do you mean by trying to find controller tags in struts.xml?  How
 do you have it implemented in Struts 1?

 Don

 On 12/15/06, Nagraj Rao [EMAIL PROTECTED] wrote:
 Hi guys

 I want to implement AJAX file upload in Struts2. tried searching over on
 the net, but couldn't find much. I have an AJAX based file uploader
 working in Struts1.x but i'm not able to migrate it to Struts2 due to
 some uncommon controller mappings (such as i'm not finding any conroller
 tags to be placed inside my struts.xml).

 Needed some pointers for the same. Please help. Any suggestions will be
 appreciated.

 regards,
 Nagraj


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




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



Struts2 with AJAX file upload??

2006-12-15 Thread Nagraj Rao
Hi guys

I want to implement AJAX file upload in Struts2. tried searching over on the 
net, but couldn't find much. I have an AJAX based file uploader working in 
Struts1.x but i'm not able to migrate it to Struts2 due to some uncommon 
controller mappings (such as i'm not finding any conroller tags to be placed 
inside my struts.xml). 

Needed some pointers for the same. Please help. Any suggestions will be 
appreciated.

regards,
Nagraj

Re: Struts2 with AJAX file upload??

2006-12-15 Thread Don Brown

What do you mean by trying to find controller tags in struts.xml?  How
do you have it implemented in Struts 1?

Don

On 12/15/06, Nagraj Rao [EMAIL PROTECTED] wrote:

Hi guys

I want to implement AJAX file upload in Struts2. tried searching over on the 
net, but couldn't find much. I have an AJAX based file uploader working in 
Struts1.x but i'm not able to migrate it to Struts2 due to some uncommon 
controller mappings (such as i'm not finding any conroller tags to be placed 
inside my struts.xml).

Needed some pointers for the same. Please help. Any suggestions will be 
appreciated.

regards,
Nagraj



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



Re: Struts2 with AJAX file upload??

2006-12-15 Thread Nagraj Rao

well i had this tag in my struts-config.xml after all the acion mappings
controller 
multipartClass=net.kencochrane.upload.ExtendedMultiPartRequestHandler /


Do i need to override the fileupload interceptor in this case??

- Original Message - 
From: Don Brown [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Saturday, December 16, 2006 12:22 AM
Subject: Re: Struts2 with AJAX file upload??



What do you mean by trying to find controller tags in struts.xml?  How
do you have it implemented in Struts 1?

Don

On 12/15/06, Nagraj Rao [EMAIL PROTECTED] wrote:

Hi guys

I want to implement AJAX file upload in Struts2. tried searching over on 
the net, but couldn't find much. I have an AJAX based file uploader 
working in Struts1.x but i'm not able to migrate it to Struts2 due to 
some uncommon controller mappings (such as i'm not finding any conroller 
tags to be placed inside my struts.xml).


Needed some pointers for the same. Please help. Any suggestions will be 
appreciated.


regards,
Nagraj



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



Struts2 and Ajax pb

2006-12-07 Thread walidito

Hi,
I hava followed one of the showcase example (
http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp
) tu run a first an independently-refreshed zone of my webpage.
As the example doen't provide with the corresponding Action Class, i didn't
succeed in making interact any action with my new ajax element (div tag).
For information, I had put this  s:head theme=ajax debug=true/ in the
header of my jsp.
and this code in my body
s:div
 id=twoseconds
cssStyle=border: 1px solid yellow;
href=/dashboard/actions/AjaxTest.action
theme=ajax
updateFreq=2000
errorText=There was an error
loadingText=loading...s:property value=message/
/s:div

And the sample action is :
public class AjaxTestAction  {

String message;

public String execute() throws Exception
{
 setMessage(hello !!!);
return SUCCESS; 
}

public void setMessage(String message){
this.message = message;
}

}


So, as a result, I see well the refreshment, but always  the there was an
error message.

Can anyone help please ?
-- 
View this message in context: 
http://www.nabble.com/Struts2-and-Ajax-pb-tf2776562.html#a7745973
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: Struts2 and Ajax pb

2006-12-07 Thread Dave Newton
walidito [mailto:[EMAIL PROTECTED]
   href=/dashboard/actions/AjaxTest.action

Do you have a mapping to that action?

Dave


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



Re: Struts2 and Ajax pb

2006-12-07 Thread Musachy Barroso
First try putting the full url for your action on your browser , and 
make sure you are getting the expected page, just to get any ajax 
problem out of the way. After you get that working, try the div, which 
should work.


regards
musachy
walidito wrote:

Hi,
I hava followed one of the showcase example (
http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp
) tu run a first an independently-refreshed zone of my webpage.
As the example doen't provide with the corresponding Action Class, i didn't
succeed in making interact any action with my new ajax element (div tag).
For information, I had put this  s:head theme=ajax debug=true/ in the
header of my jsp.
and this code in my body
s:div
 id=twoseconds
cssStyle=border: 1px solid yellow;
href=/dashboard/actions/AjaxTest.action
theme=ajax
updateFreq=2000
errorText=There was an error
loadingText=loading...s:property value=message/
/s:div

And the sample action is :
public class AjaxTestAction  {

String message;

public String execute() throws Exception
{
 setMessage(hello !!!);
return SUCCESS; 
}

public void setMessage(String message){
this.message = message;
}

}


So, as a result, I see well the refreshment, but always  the there was an
error message.

Can anyone help please ?
  



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



RE: Struts2 and Ajax pb

2006-12-07 Thread walidito

Thank you !
Actually I had a mapping, but this mapping was wrong.
now I' m facing a new pb,
my div zone is continuously showing an error message (the error messages
adds  at the end of the page, and doesn't replace the previous one, which
make it a real mess...)
this is the message :
widget ID collision on ID: twoseconds



Dave Newton-3 wrote:
 
 walidito [mailto:[EMAIL PROTECTED]
  href=/dashboard/actions/AjaxTest.action
 
 Do you have a mapping to that action?
 
 Dave
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts2-and-Ajax-pb-tf2776562.html#a7746317
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: Struts2 and Ajax pb

2006-12-07 Thread walidito

Ok ok, I begin to see what is the exact pb :
I my action mapping I've putted :
result name=input/JSPs/Error.jsp/result
result name=success/JSPs/Menu.jsp/result
so it must create an ugly loop...
By the way, what should I put it this action mapping ? nothing ? 
thank you.


walidito wrote:
 
 Thank you !
 Actually I had a mapping, but this mapping was wrong.
 now I' m facing a new pb,
 my div zone is continuously showing an error message (the error messages
 adds  at the end of the page, and doesn't replace the previous one, which
 make it a real mess...)
 this is the message :
 widget ID collision on ID: twoseconds
 
 
 
 Dave Newton-3 wrote:
 
 walidito [mailto:[EMAIL PROTECTED]
 href=/dashboard/actions/AjaxTest.action
 
 Do you have a mapping to that action?
 
 Dave
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts2-and-Ajax-pb-tf2776562.html#a7746431
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: STRUTS2 and AJAX

2006-11-30 Thread Don Brown

On 11/20/06, Juan Espinosa [EMAIL PROTECTED] wrote:

I dont understand when you say in the latest trunk, (i have to improve my
english) did it mean in the next version.


Yes, the next version will be 2.0.2


Plugins - i have a question ! sitemesh has a plugin like spring ??


Yes.

Don



Thanks for your answers...

Regards,
Juan Espinosa


-Mensaje original-
De: Don Brown [mailto:[EMAIL PROTECTED]
Enviado el: Lunes, 20 de Noviembre de 2006 02:05 p.m.
Para: Struts Users Mailing List
Asunto: Re: STRUTS2 and AJAX

On 11/20/06, Juan Espinosa [EMAIL PROTECTED] wrote:
 Hi to all i have two questions...

 First question... is possible to remove spring dependecies in struts2
 or spring stuff (jars, applicationContext.xml and ContextLoadListener)
 are neccesary to run struts2

Spring is 100% optional.  In fact, in the latest code in trunk, the Spring
stuff has its own plugin jar, which can be easily excluded.

 Second question or advise... i want to give a try to ajax, i want some
 parts of me site to be updated without reloading the whole page, for
 example. I need some advise where to start, struts2 ajax support, etc...

The easiest way is to download the showcase example application and play
with the ajax examples.  Note, however, not all are guaranteed to work right
now as they are receiving a lot of attention (Dojo 0.4
upgrade)

Don


 well thats all, thanks for helping me.



 Regards,

 Juan Espinosa




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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.10/541 - Release Date: 20/11/2006



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



STRUTS2 and AJAX

2006-11-21 Thread Juan Espinosa
Hi to all i have two questions...

First question... is possible to remove spring dependecies in struts2 or
spring stuff (jars, applicationContext.xml and ContextLoadListener) are
neccesary to run struts2 

Second question or advise... i want to give a try to ajax, i want some parts
of me site to be updated without reloading the whole page, for example. I
need some advise where to start, struts2 ajax support, etc...

well thats all, thanks for helping me.

 

Regards,

Juan Espinosa