将datagrids arraycollection发送到Java Servlet

时间:2022-01-26 05:28:31

I have an arraycollection in datagrid and i want to pass it to the servlet using . Is there any way to do that? Here my problem is, i can send arraycollection through SEND() of HTTPSERVICE, but when to receive it in HTTPRequestObject of servlet, request.getParameter('paramName') will return String. So how can i receive the same arraycollection from flex to the servlet's request object?

我在datagrid中有一个arraycollection,我想使用它将它传递给servlet。有没有办法做到这一点?我的问题是,我可以通过HTTPSERVICE的SEND()发送arraycollection,但是当在servlet的HTTPRequestObject中接收它时,request.getParameter('paramName')将返回String。那么如何从flex接收相同的arraycollection到servlet的请求对象呢?

Here

[Bindable]

public var dataAC:ArrayCollection = new ArrayCollection();

public var dataAC:ArrayCollection = new ArrayCollection();

will be my variable to hold arraycollection.

将是我的变量来保存arraycollection。

When i am doing this,

我这样做的时候

mx:HTTPService id="fileformatServlet" result="fileformatServlet_resultHandler(event)" fault="fileformatServlet_faultHandler(event)" showBusyCursor="true"

mx:HTTPService id =“fileformatServlet”result =“fileformatServlet_resultHandler(event)”fault =“fileformatServlet_faultHandler(event)”showBusyCursor =“true”

and fileformatServlet.send("arrayCollection":dataAC);

Now on java side, request.getparameter("arrayCollection") will return a string not an arraycollection.Typecast is also not possible.

现在在java方面,request.getparameter(“arrayCollection”)将返回一个字符串而不是一个arraycollection.Typecast也是不可能的。

so what should i do now?

那我现在该怎么办?

1 个解决方案

#1


0  

Http request parameters are always pass as String. You have to serialize the Array in some format.

Http请求参数始终作为String传递。您必须以某种格式序列化阵列。

For example you can use Json forma t and deserialize it in java. FlexJavaJson

例如,您可以使用Json格式并在java中反序列化它。 FlexJavaJson

#1


0  

Http request parameters are always pass as String. You have to serialize the Array in some format.

Http请求参数始终作为String传递。您必须以某种格式序列化阵列。

For example you can use Json forma t and deserialize it in java. FlexJavaJson

例如,您可以使用Json格式并在java中反序列化它。 FlexJavaJson