易截截图软件、单文件、免安装、纯绿色、仅160KB

Flex和Java交互的乱码解决方案


今天做Flex时碰到flex和java交互的乱码问题,使用HTTPService无论是从Flex端传到Java端,还是反过来都乱码。调查了半天,终于搞定了。
 
 
以下是解决方案:
 
 
1.Flex端传到Java端
 
Flex端:encodeURIComponent(comment.text)
使用encodeURIComponent把参数转换为 application/x-www-form-urlencoded 格式
 
Java端:URLDecoder.decode(comment, "utf-8")
对 x-www-form-urlencoded 字符串解码
 
2.Java端传到Flex端
 
 
 
 
 
HttpServletResponse response = ServletActionContext.getResponse();
PrintWriter out = response.getWriter();
response.setContentType("text/html;charset=utf-8");

out.println(doc.asXML());
out.flush();
out.close();



HttpServletResponse response = ServletActionContext.getResponse();
ServletOutputStream out = response.getOutputStream();
response.setContentType("text/html;charset=utf-8");

out.write(doc.asXML().getBytes("UTF-8"));
out.flush();
out.close();  


相关文档:

java classLoader 原则

要理类加载体系结构,就必须清楚如下几点比较基本的原则:
1. classLoader是一种父子树形结构(注:这里不是指类继承的父子关系)
2. 父classLoader无法看到子classLoader加载的类
3、虚拟机遵守双亲委托加载原则,即任何子classLoader须首先委托父classLoader先加载需要的类,当父classLoader加载不到时再由子classLoa ......

Java Reflection 浅析1

Reflection 的简单应用,包括field, method,constructor的应用。
package com.gaoqian.reflection;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Typ ......

读JAVA网络编程精解 服务器与客户端通信一

文中引用了孙老师的代码,并注明。
import java.io.*;
import java.net.*;
public class EchoServer {
private int port=8888;
private ServerSocket serverSocket;
public EchoServer() throws IOException {
serverSocket = new ServerSocket(port);
System.out.println("服务器启动"); ......

Java传值和传引用: 张三和李四的故事


下面开讲故事: 
从前有个房间,房间里有份文档,房间还有一把钥匙。 这把钥匙在张三手里。 
这时李四来向张三要那份文档。 张三不太喜欢李四,但又怕耽误了
工作不好交代。于是张三就把房间里文档的文档复印了一份,然后把那个复印件交给了李四(这叫传值)。 
李四拿到文档后(复印件),胡乱修改一 ......

flex Bindable使用讲解

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
 <mx:Panel width="392" height="300" layout="absolute">
  <mx:Label x="19" y="10" text="{user}" width="171" height="20"/>
  <mx ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号