You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by red phoenix <ro...@gmail.com> on 2007/02/10 08:45:52 UTC

why Struts2 can't receive Jsp variable value by using Ajax1.2?

I have a text area and a text link in a jsp page,when I click this text
link,I will call struts2 action by using ajax,like follows:
/*-----jsp page-----*/
<html>
<script type="text/javascript">
var http = getHttpObject();
function getHttpObject(){
 var xmlhttp = false;
 if(window.XMLHttpRequest){
  xmlhttp = new XMLHttpRequest();
  if(xmlhttp.overrideMimeType){
   xmlhttp.overrideMimeType('text/xml');
   }
 }
 else{
  try{
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e){
   try{
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch(e){
    xmlhttp = false;
   }
  }
 }
 return xmlhttp;
}
function handleHttpResponse(){
 if(http.readyState == READY_STATE_COMPLETE){
  if(http.status == 200){
   var text = http.responseText;
   if(text != null || text.length >0)
      alert(text);
  }
  else{
   alert("error!!!");
   alert(http.status);
  }
 }
}
function test(){
 var t1=document.forms[0].abc.value;
 alert(t1);
 var url = "add.action";
 http.open("POST",url,false);
 http.onreadystatechange = handleHttpResponse;
 http.send(null);
}
</script>
<body>
<s:form action='add.action' method='post'>
 <table>
   <tr><td><s:textfield label="test1" name="abc"/></td></tr>
   </table>
   <a href="javascript:test()">tt</a>
</s:form>
</body>
</html>

/*----struts2 action----*/
public class TestAction extends ActionSupport{
 String abc;
 public String add() throws Exception {
  System.out.println("abc="+abc);
  return null;
 }
 public String getAbc(){
  return abc;
 }
 public void setAbc(String abc){
  this.abc=abc;
 }
}

I put some text in textfield and then I click tt link,it call struts2
action,it execute System.out.println("abc="+abc),it should show the text
value,but it shows null value!!!
abc=null

If I don't use ajax,and only use document.forms[0].submit(),struts2 can show
right value,like follows:
abc=the text you put

I am puzzled with it! Why struts2 can't get jsp page value by using ajax?
Anybody could tell me how to correct my above code?

Thanks in advance!

Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
I fully intend to jump in... but jump in to JWP, not S2.  Lots of items 
on the to-do list there that need to get done.  I also need to *finally* 
get the next version of DataVision out the door, that's been far too 
long in coming.  I'd like to contribute to S2, but I'm not at all sure 
what I have to offer at this point.

Frank

Musachy Barroso wrote:
> jump in when you finish your book :)
> 
> musachy
> 
> On 2/10/07, Frank W. Zammetti <fz...@omnytex.com> wrote:
>>
>> Sounds cool.  You can do most of that with APT today by the way (the
>> dojo widget part would have to be a custom handler though) without
>> having to use S2 (not that using S2 is a bad thing!).  I suppose I
>> should feel some sense of validation that the basic idea I presented 2+
>> years ago for S1 now makes it, roughly, into S2 :)
>>
>> Frank
>>
>>
>> Musachy Barroso wrote:
>> > Yes indeed! but with multiple targets, multiple sources, passing a 
>> form,
>> > with a form filter,  instantiating Dojo widgets on the returned text 
>> and
>> > topics. The code for the bind tag is already in S2, it just doesn't 
>> have
>> a
>> > tag yet.
>> >
>> > regards
>> > musachy
>> >
>> > On 2/10/07, Frank W. Zammetti <fz...@omnytex.com> wrote:
>> >>
>> >> Hey, that eventblind tag sounds pretty cool... familiar
>> >> (
>> >>
>> http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html 
>>
>> >>
>> >> ),
>> >> but cool ;) LOL
>> >>
>> >> Frank
>> >>
>> >> Musachy Barroso wrote:
>> >> > Dave is right. On top of that, S2 ships with Dojo, so you can just
>> do:
>> >> >
>> >> > dojo.io.bind({
>> >> >    url: "add.action",
>> >> >    formNode: dojo.byId("form1"),
>> >> >    load: function(type, data, evt){
>> >> >       //callback called after request is made
>> >> >    },
>> >> > });
>> >> >
>> >> > We will soon have a "eventbind" tag that will attach to any element,
>> on
>> >> any
>> >> > event, and will be able to make requests, populate targets, etc,
>> >> etc, to
>> >> > cover this basic scenarios.
>> >> >
>> >> > regards
>> >> > musachy
>> >> >
>> >> > On 2/10/07, Dave Newton <ne...@yahoo.com> wrote:
>> >> >>
>> >> >> --- red phoenix <ro...@gmail.com> wrote:
>> >> >> > [... taking the long road to Ajax, hey? ...]
>> >> >> > function test(){
>> >> >> >  var t1=document.forms[0].abc.value;
>> >> >> >  alert(t1);
>> >> >> >  var url = "add.action";
>> >> >> >  http.open("POST",url,false);
>> >> >> >  http.onreadystatechange = handleHttpResponse;
>> >> >> >  http.send(null);
>> >> >> > }
>> >> >>
>> >> >> I'll admit I've never bothered doing Ajax quite this
>> >> >> manually before, but you're not submitting the form,
>> >> >> but doesn't this just make a post request to the URL?
>> >> >>
>> >> >> Try something like:
>> >> >>
>> >> >>   var url = "add.action?abc=" + t1;
>> >> >>   http.open("GET",url,false);
>> >> >>
>> >> >> I would, however, *strongly* urge you to use any
>> >> >> number of *way*-easier ways to do Ajax, especially
>> >> >> considering that S2 ships w/ lots of Ajax support.
>> >> >>
>> >> >> > Why struts2 can't get jsp page value by using ajax?
>> >> >>
>> >> >> I think you have misrepresented the problem somewhat.
>> >> >>
>> >> >> d.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> ____________________________________________________________________________________ 
>>
>> >>
>> >> >>
>> >> >> No need to miss a message. Get email on-the-go
>> >> >> with Yahoo! Mail for Mobile. Get started.
>> >> >> http://mobile.yahoo.com/mail
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> >> For additional commands, e-mail: user-help@struts.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> Frank W. Zammetti
>> >> Founder and Chief Software Architect
>> >> Omnytex Technologies
>> >> http://www.omnytex.com
>> >> AIM/Yahoo: fzammetti
>> >> MSN: fzammetti@hotmail.com
>> >> Author of "Practical Ajax Projects With Java Technology"
>> >>   (2006, Apress, ISBN 1-59059-695-1)
>> >> Java Web Parts - http://javawebparts.sourceforge.net
>> >>   Supplying the wheel, so you don't have to reinvent it!
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>>
>> -- 
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>> AIM/Yahoo: fzammetti
>> MSN: fzammetti@hotmail.com
>> Author of "Practical Ajax Projects With Java Technology"
>>   (2006, Apress, ISBN 1-59059-695-1)
>> Java Web Parts - http://javawebparts.sourceforge.net
>>   Supplying the wheel, so you don't have to reinvent it!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

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

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


Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by Musachy Barroso <mu...@gmail.com>.
jump in when you finish your book :)

musachy

On 2/10/07, Frank W. Zammetti <fz...@omnytex.com> wrote:
>
> Sounds cool.  You can do most of that with APT today by the way (the
> dojo widget part would have to be a custom handler though) without
> having to use S2 (not that using S2 is a bad thing!).  I suppose I
> should feel some sense of validation that the basic idea I presented 2+
> years ago for S1 now makes it, roughly, into S2 :)
>
> Frank
>
>
> Musachy Barroso wrote:
> > Yes indeed! but with multiple targets, multiple sources, passing a form,
> > with a form filter,  instantiating Dojo widgets on the returned text and
> > topics. The code for the bind tag is already in S2, it just doesn't have
> a
> > tag yet.
> >
> > regards
> > musachy
> >
> > On 2/10/07, Frank W. Zammetti <fz...@omnytex.com> wrote:
> >>
> >> Hey, that eventblind tag sounds pretty cool... familiar
> >> (
> >>
> http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html
> >>
> >> ),
> >> but cool ;) LOL
> >>
> >> Frank
> >>
> >> Musachy Barroso wrote:
> >> > Dave is right. On top of that, S2 ships with Dojo, so you can just
> do:
> >> >
> >> > dojo.io.bind({
> >> >    url: "add.action",
> >> >    formNode: dojo.byId("form1"),
> >> >    load: function(type, data, evt){
> >> >       //callback called after request is made
> >> >    },
> >> > });
> >> >
> >> > We will soon have a "eventbind" tag that will attach to any element,
> on
> >> any
> >> > event, and will be able to make requests, populate targets, etc,
> >> etc, to
> >> > cover this basic scenarios.
> >> >
> >> > regards
> >> > musachy
> >> >
> >> > On 2/10/07, Dave Newton <ne...@yahoo.com> wrote:
> >> >>
> >> >> --- red phoenix <ro...@gmail.com> wrote:
> >> >> > [... taking the long road to Ajax, hey? ...]
> >> >> > function test(){
> >> >> >  var t1=document.forms[0].abc.value;
> >> >> >  alert(t1);
> >> >> >  var url = "add.action";
> >> >> >  http.open("POST",url,false);
> >> >> >  http.onreadystatechange = handleHttpResponse;
> >> >> >  http.send(null);
> >> >> > }
> >> >>
> >> >> I'll admit I've never bothered doing Ajax quite this
> >> >> manually before, but you're not submitting the form,
> >> >> but doesn't this just make a post request to the URL?
> >> >>
> >> >> Try something like:
> >> >>
> >> >>   var url = "add.action?abc=" + t1;
> >> >>   http.open("GET",url,false);
> >> >>
> >> >> I would, however, *strongly* urge you to use any
> >> >> number of *way*-easier ways to do Ajax, especially
> >> >> considering that S2 ships w/ lots of Ajax support.
> >> >>
> >> >> > Why struts2 can't get jsp page value by using ajax?
> >> >>
> >> >> I think you have misrepresented the problem somewhat.
> >> >>
> >> >> d.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >>
> ____________________________________________________________________________________
> >>
> >> >>
> >> >> No need to miss a message. Get email on-the-go
> >> >> with Yahoo! Mail for Mobile. Get started.
> >> >> http://mobile.yahoo.com/mail
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@struts.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >> AIM/Yahoo: fzammetti
> >> MSN: fzammetti@hotmail.com
> >> Author of "Practical Ajax Projects With Java Technology"
> >>   (2006, Apress, ISBN 1-59059-695-1)
> >> Java Web Parts - http://javawebparts.sourceforge.net
> >>   Supplying the wheel, so you don't have to reinvent it!
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: fzammetti@hotmail.com
> Author of "Practical Ajax Projects With Java Technology"
>   (2006, Apress, ISBN 1-59059-695-1)
> Java Web Parts - http://javawebparts.sourceforge.net
>   Supplying the wheel, so you don't have to reinvent it!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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

Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Sounds cool.  You can do most of that with APT today by the way (the 
dojo widget part would have to be a custom handler though) without 
having to use S2 (not that using S2 is a bad thing!).  I suppose I 
should feel some sense of validation that the basic idea I presented 2+ 
years ago for S1 now makes it, roughly, into S2 :)

Frank


Musachy Barroso wrote:
> Yes indeed! but with multiple targets, multiple sources, passing a form,
> with a form filter,  instantiating Dojo widgets on the returned text and
> topics. The code for the bind tag is already in S2, it just doesn't have a
> tag yet.
> 
> regards
> musachy
> 
> On 2/10/07, Frank W. Zammetti <fz...@omnytex.com> wrote:
>>
>> Hey, that eventblind tag sounds pretty cool... familiar
>> (
>> http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html 
>>
>> ),
>> but cool ;) LOL
>>
>> Frank
>>
>> Musachy Barroso wrote:
>> > Dave is right. On top of that, S2 ships with Dojo, so you can just do:
>> >
>> > dojo.io.bind({
>> >    url: "add.action",
>> >    formNode: dojo.byId("form1"),
>> >    load: function(type, data, evt){
>> >       //callback called after request is made
>> >    },
>> > });
>> >
>> > We will soon have a "eventbind" tag that will attach to any element, on
>> any
>> > event, and will be able to make requests, populate targets, etc, 
>> etc, to
>> > cover this basic scenarios.
>> >
>> > regards
>> > musachy
>> >
>> > On 2/10/07, Dave Newton <ne...@yahoo.com> wrote:
>> >>
>> >> --- red phoenix <ro...@gmail.com> wrote:
>> >> > [... taking the long road to Ajax, hey? ...]
>> >> > function test(){
>> >> >  var t1=document.forms[0].abc.value;
>> >> >  alert(t1);
>> >> >  var url = "add.action";
>> >> >  http.open("POST",url,false);
>> >> >  http.onreadystatechange = handleHttpResponse;
>> >> >  http.send(null);
>> >> > }
>> >>
>> >> I'll admit I've never bothered doing Ajax quite this
>> >> manually before, but you're not submitting the form,
>> >> but doesn't this just make a post request to the URL?
>> >>
>> >> Try something like:
>> >>
>> >>   var url = "add.action?abc=" + t1;
>> >>   http.open("GET",url,false);
>> >>
>> >> I would, however, *strongly* urge you to use any
>> >> number of *way*-easier ways to do Ajax, especially
>> >> considering that S2 ships w/ lots of Ajax support.
>> >>
>> >> > Why struts2 can't get jsp page value by using ajax?
>> >>
>> >> I think you have misrepresented the problem somewhat.
>> >>
>> >> d.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> ____________________________________________________________________________________ 
>>
>> >>
>> >> No need to miss a message. Get email on-the-go
>> >> with Yahoo! Mail for Mobile. Get started.
>> >> http://mobile.yahoo.com/mail
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>>
>> -- 
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>> AIM/Yahoo: fzammetti
>> MSN: fzammetti@hotmail.com
>> Author of "Practical Ajax Projects With Java Technology"
>>   (2006, Apress, ISBN 1-59059-695-1)
>> Java Web Parts - http://javawebparts.sourceforge.net
>>   Supplying the wheel, so you don't have to reinvent it!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

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

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


Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by Musachy Barroso <mu...@gmail.com>.
Yes indeed! but with multiple targets, multiple sources, passing a form,
with a form filter,  instantiating Dojo widgets on the returned text and
topics. The code for the bind tag is already in S2, it just doesn't have a
tag yet.

regards
musachy

On 2/10/07, Frank W. Zammetti <fz...@omnytex.com> wrote:
>
> Hey, that eventblind tag sounds pretty cool... familiar
> (
> http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html
> ),
> but cool ;) LOL
>
> Frank
>
> Musachy Barroso wrote:
> > Dave is right. On top of that, S2 ships with Dojo, so you can just do:
> >
> > dojo.io.bind({
> >    url: "add.action",
> >    formNode: dojo.byId("form1"),
> >    load: function(type, data, evt){
> >       //callback called after request is made
> >    },
> > });
> >
> > We will soon have a "eventbind" tag that will attach to any element, on
> any
> > event, and will be able to make requests, populate targets, etc, etc, to
> > cover this basic scenarios.
> >
> > regards
> > musachy
> >
> > On 2/10/07, Dave Newton <ne...@yahoo.com> wrote:
> >>
> >> --- red phoenix <ro...@gmail.com> wrote:
> >> > [... taking the long road to Ajax, hey? ...]
> >> > function test(){
> >> >  var t1=document.forms[0].abc.value;
> >> >  alert(t1);
> >> >  var url = "add.action";
> >> >  http.open("POST",url,false);
> >> >  http.onreadystatechange = handleHttpResponse;
> >> >  http.send(null);
> >> > }
> >>
> >> I'll admit I've never bothered doing Ajax quite this
> >> manually before, but you're not submitting the form,
> >> but doesn't this just make a post request to the URL?
> >>
> >> Try something like:
> >>
> >>   var url = "add.action?abc=" + t1;
> >>   http.open("GET",url,false);
> >>
> >> I would, however, *strongly* urge you to use any
> >> number of *way*-easier ways to do Ajax, especially
> >> considering that S2 ships w/ lots of Ajax support.
> >>
> >> > Why struts2 can't get jsp page value by using ajax?
> >>
> >> I think you have misrepresented the problem somewhat.
> >>
> >> d.
> >>
> >>
> >>
> >>
> >>
> >>
> ____________________________________________________________________________________
> >>
> >> No need to miss a message. Get email on-the-go
> >> with Yahoo! Mail for Mobile. Get started.
> >> http://mobile.yahoo.com/mail
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: fzammetti@hotmail.com
> Author of "Practical Ajax Projects With Java Technology"
>   (2006, Apress, ISBN 1-59059-695-1)
> Java Web Parts - http://javawebparts.sourceforge.net
>   Supplying the wheel, so you don't have to reinvent it!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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

Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by Dave Newton <ne...@yahoo.com>.
--- "Frank W. Zammetti" wrote:
> familiar [...] but cool

...except for that whole
doesn't-need-another-XML-config-file bit ;) Heck, I
get irritated with DWR's config file, and most
everything is one element w/ no attributes. But I'm
generally crabby.

Dave



 
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

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


Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hey, that eventblind tag sounds pretty cool... familiar 
(http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html), 
but cool ;) LOL

Frank

Musachy Barroso wrote:
> Dave is right. On top of that, S2 ships with Dojo, so you can just do:
> 
> dojo.io.bind({
>    url: "add.action",
>    formNode: dojo.byId("form1"),
>    load: function(type, data, evt){
>       //callback called after request is made
>    },
> });
> 
> We will soon have a "eventbind" tag that will attach to any element, on any
> event, and will be able to make requests, populate targets, etc, etc, to
> cover this basic scenarios.
> 
> regards
> musachy
> 
> On 2/10/07, Dave Newton <ne...@yahoo.com> wrote:
>>
>> --- red phoenix <ro...@gmail.com> wrote:
>> > [... taking the long road to Ajax, hey? ...]
>> > function test(){
>> >  var t1=document.forms[0].abc.value;
>> >  alert(t1);
>> >  var url = "add.action";
>> >  http.open("POST",url,false);
>> >  http.onreadystatechange = handleHttpResponse;
>> >  http.send(null);
>> > }
>>
>> I'll admit I've never bothered doing Ajax quite this
>> manually before, but you're not submitting the form,
>> but doesn't this just make a post request to the URL?
>>
>> Try something like:
>>
>>   var url = "add.action?abc=" + t1;
>>   http.open("GET",url,false);
>>
>> I would, however, *strongly* urge you to use any
>> number of *way*-easier ways to do Ajax, especially
>> considering that S2 ships w/ lots of Ajax support.
>>
>> > Why struts2 can't get jsp page value by using ajax?
>>
>> I think you have misrepresented the problem somewhat.
>>
>> d.
>>
>>
>>
>>
>>
>> ____________________________________________________________________________________ 
>>
>> No need to miss a message. Get email on-the-go
>> with Yahoo! Mail for Mobile. Get started.
>> http://mobile.yahoo.com/mail
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

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

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


Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by Musachy Barroso <mu...@gmail.com>.
Dave is right. On top of that, S2 ships with Dojo, so you can just do:

dojo.io.bind({
    url: "add.action",
    formNode: dojo.byId("form1"),
    load: function(type, data, evt){
       //callback called after request is made
    },
});

We will soon have a "eventbind" tag that will attach to any element, on any
event, and will be able to make requests, populate targets, etc, etc, to
cover this basic scenarios.

regards
musachy

On 2/10/07, Dave Newton <ne...@yahoo.com> wrote:
>
> --- red phoenix <ro...@gmail.com> wrote:
> > [... taking the long road to Ajax, hey? ...]
> > function test(){
> >  var t1=document.forms[0].abc.value;
> >  alert(t1);
> >  var url = "add.action";
> >  http.open("POST",url,false);
> >  http.onreadystatechange = handleHttpResponse;
> >  http.send(null);
> > }
>
> I'll admit I've never bothered doing Ajax quite this
> manually before, but you're not submitting the form,
> but doesn't this just make a post request to the URL?
>
> Try something like:
>
>   var url = "add.action?abc=" + t1;
>   http.open("GET",url,false);
>
> I would, however, *strongly* urge you to use any
> number of *way*-easier ways to do Ajax, especially
> considering that S2 ships w/ lots of Ajax support.
>
> > Why struts2 can't get jsp page value by using ajax?
>
> I think you have misrepresented the problem somewhat.
>
> d.
>
>
>
>
>
> ____________________________________________________________________________________
> No need to miss a message. Get email on-the-go
> with Yahoo! Mail for Mobile. Get started.
> http://mobile.yahoo.com/mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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

Re: why Struts2 can't receive Jsp variable value by using Ajax1.2?

Posted by Dave Newton <ne...@yahoo.com>.
--- red phoenix <ro...@gmail.com> wrote:
> [... taking the long road to Ajax, hey? ...]
> function test(){
>  var t1=document.forms[0].abc.value;
>  alert(t1);
>  var url = "add.action";
>  http.open("POST",url,false);
>  http.onreadystatechange = handleHttpResponse;
>  http.send(null);
> }

I'll admit I've never bothered doing Ajax quite this
manually before, but you're not submitting the form,
but doesn't this just make a post request to the URL?

Try something like:

  var url = "add.action?abc=" + t1;
  http.open("GET",url,false);

I would, however, *strongly* urge you to use any
number of *way*-easier ways to do Ajax, especially
considering that S2 ships w/ lots of Ajax support.

> Why struts2 can't get jsp page value by using ajax?

I think you have misrepresented the problem somewhat.

d.



 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

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