You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "bryan@xoscript.org" <br...@xoscript.org> on 2006/02/15 19:35:21 UTC

DynaActionForm form-property syntax?

Hi folks,

I am new to the user list. I have been developing with Struts for about 2
years. I have an open source ajax project that I am building an integration
piece now so that you can use it with Struts. I believe that my syntax for a
dynamic form property is correct (shown below). My question is this. XmlHttp
allows you to open an instance of a server. That server allows you to post
data by setting a request header of "Content-Type",
"application/x-www-form-urlencoded" using setRequestHeader. When the
parameters get sent to the server they show up as request.getAttribute...
instead of getParameter. how can I populate a dynamic form with posted data. I
am attaching the name/value pairs to the query string when I open the
connection to the server like so.

server = xmlhttpInstance;
server.open("post",name=value&etc=etc,false);

and then sending the data to the server like so.


					server.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
server.send(xmlString);

Might I be using xmlhttp incorrectly?

<form-bean name="ajaxForm" type="org.apache.struts.action.DynaActionForm">
  <form-property name="xmlString" type="java.lang.String"></form-property>
</form-bean>

Bryan LaPlante

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


Re: DynaActionForm form-property syntax?

Posted by "bryan@xoscript.org" <br...@xoscript.org>.
Never mind, I am goofy in the head. I looked at my code to send the request
via xmlHttp and I was appending my params to the end of the location string
instead of putting them in the body of the request, now all is working fine. I
had a couple of other saintly people help me out on this group and the
struts-xoscript (ajax) integration is working like a charm. I was anxious to
see what the process time would look like and I am happy to say they are still
around the 15 to 30 millisecond round trip as before I did the integration.
Nice job on Struts part for not adding too much over head.

Thanks for your help.

Bryan LaPlante

---------- Original Message -----------
From: Laurie Harper <la...@holoweb.net>
To: user@struts.apache.org
Sent: Fri, 17 Feb 2006 16:19:56 -0500
Subject: Re: DynaActionForm form-property syntax?

> bryan@xoscript.org wrote:
> > Hi folks,
> > 
> > I am new to the user list. I have been developing with Struts for about 2
> > years. I have an open source ajax project that I am building an integration
> > piece now so that you can use it with Struts. I believe that my syntax for a
> > dynamic form property is correct (shown below). My question is this. XmlHttp
> > allows you to open an instance of a server. That server allows you to post
> > data by setting a request header of "Content-Type",
> > "application/x-www-form-urlencoded" using setRequestHeader. When the
> > parameters get sent to the server they show up as request.getAttribute...
> > instead of getParameter. how can I populate a dynamic form with posted data. I
> 
> I'm not sure how you came to that conclusion... Request parameters 
> should show up as... request parameters. request.getAttribute doesn't 
> have anything to do with the request parameters.
> 
> > am attaching the name/value pairs to the query string when I open the
> > connection to the server like so.
> > 
> > server = xmlhttpInstance;
> > server.open("post",name=value&etc=etc,false);
> > 
> > and then sending the data to the server like so.
> > 
> > 
> > 					server.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
> > server.send(xmlString);
> > 
> > Might I be using xmlhttp incorrectly?
> 
> Possibly, though I don't see an obvious problem. Start by using a 
> browser to simply send GET requests until you're sure you have the 
> Struts-app side of things working. The try doing gets with 
> XmlHttpRequest. Once that's working, you can switch to POSTs and get 
> that going.
> 
> L.
> 
> > 
> > <form-bean name="ajaxForm" type="org.apache.struts.action.DynaActionForm">
> >   <form-property name="xmlString" type="java.lang.String"></form-property>
> > </form-bean>
> > 
> > Bryan LaPlante
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
------- End of Original Message -------

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


Re: DynaActionForm form-property syntax?

Posted by Laurie Harper <la...@holoweb.net>.
bryan@xoscript.org wrote:
> Hi folks,
> 
> I am new to the user list. I have been developing with Struts for about 2
> years. I have an open source ajax project that I am building an integration
> piece now so that you can use it with Struts. I believe that my syntax for a
> dynamic form property is correct (shown below). My question is this. XmlHttp
> allows you to open an instance of a server. That server allows you to post
> data by setting a request header of "Content-Type",
> "application/x-www-form-urlencoded" using setRequestHeader. When the
> parameters get sent to the server they show up as request.getAttribute...
> instead of getParameter. how can I populate a dynamic form with posted data. I

I'm not sure how you came to that conclusion... Request parameters 
should show up as... request parameters. request.getAttribute doesn't 
have anything to do with the request parameters.

> am attaching the name/value pairs to the query string when I open the
> connection to the server like so.
> 
> server = xmlhttpInstance;
> server.open("post",name=value&etc=etc,false);
> 
> and then sending the data to the server like so.
> 
> 
> 					server.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
> server.send(xmlString);
> 
> Might I be using xmlhttp incorrectly?

Possibly, though I don't see an obvious problem. Start by using a 
browser to simply send GET requests until you're sure you have the 
Struts-app side of things working. The try doing gets with 
XmlHttpRequest. Once that's working, you can switch to POSTs and get 
that going.

L.

> 
> <form-bean name="ajaxForm" type="org.apache.struts.action.DynaActionForm">
>   <form-property name="xmlString" type="java.lang.String"></form-property>
> </form-bean>
> 
> Bryan LaPlante


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