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]



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]