知识与知识间的交流

把自己在做菜鸟时的经验和知识分享给大家,让同样是菜鸟的你少走弯路。
posts - 11, comments - 11, trackbacks - 0, articles - 2
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

置顶随笔

1. 下载 Blazeds文件:

         a. http://sourceforge.net/adobe/blazeds/wiki/Downloads/  下拉网页找到  Release Builds 说明下的  Download the latest BlazeDS Release builds

            点击此链接

         b. 这个时间会弹出Adobe登陆用户界面,如果有用户就登陆一下,没有就点击边上的创建用户(Create an Adobe Account)

         c. 中转到 BlazeDS Terms of Use 页面,这个时候只能 选中 “I Agree” ,下一步

         d.新页面中将页面下拉到下图位置:(如果只是使用的话,建议下载binary Distribution这个版本的)

        

       e.将下载后的文件解压待用。。。。

2.新建JAVA web项目

      a. “文件”---“新建”------“其他”---Dynamic Web Project (动态WEb项目)                    

        

      b.新建项目BlazedsDemo参数如下(只供参考,只要能新建出项目即可)             

          

       c.在新项目下的Src文件中新增一个HelloWorld类              

HelloWorld
 1 package cn.riahome.java;
 2 
 3 public class HelloWorld
 4 {
 5 
 6     public HelloWorld() {  
 7     } 
 8     public String getHelloWorld(String name) {  
 9         return "Hello World!"+name;  
10     }
11 }

       d.将Blazeds刚解压出来的 blazeds\WEB-INF\lib 下的文件复制到 本项目下的WebContent下的WEB-INF\lib下

       e. blazeds\WEB-INF\flex 下的文件复制到本项目下的WebContent下的WEB-INF下

       f.  blazeds\WEB-INF 下的web.xml 替换本项目下的WebContent下的WEB-INF中的web.xml

      g. 在WEB-INF\flex\remoting-config.xml 中新增如下代码:                    

          <destination id="helloWorld">  
                <properties>
                    <source>cn.riahome.java.HelloWorld</source>
                </properties>
          </destination>

          修改后文件如下:               

Remoting-config文件
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <service id="remoting-service" 
 3     class="flex.messaging.services.RemotingService">
 4 
 5     <adapters>
 6         <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
 7     </adapters>
 8 
 9     <default-channels>
10         <channel ref="my-amf"/>
11     </default-channels>
12     <destination id="helloWorld">  
13         <properties>  
14             <source>cn.riahome.java.HelloWorld</source>  
15         </properties>  
16       </destination>
17 </service>

        注:  a.  destination节点的id名称是要被Flex端直接调用的

                       b. <source>cn.riahome.java.HelloWorld</source>  指定所对应的类

 

      h. 修改“构建路径”

            选中项目右击“属性”--在弹出框中选择“java构建路径”---选择"源代码"子项 如下图            

      

            注:将输出路径修改为:WebContent/WEB-INF/classes 系统会自动到Web-inf /classes 中找文件编译后的类文件

                           1.这里一定要设置,要不然项目运行时会提醒找不到此类的错误

3.新建Flex项目

                 a. “文件”---“新建”--“Flex项目” 填写信息如图:                     

      

          b.点击下一步                   

          

                  注:a. 根文件夹: 填写TomCat下的你程序发布的本地地址 如: C:\tomcat\webapps\demo\

                       b.根URL:  填写你程序运行起来的网页地址(如图)

                       c.上下文根目录: 填写网页地址中端口号后的名称  如上图中 “根URL” 端口号后的 BlazedsDemo

                       d.输出文件夹:与“根文件夹”相同

                      e.点击“完成” 建立项目

           c.配置新建项目的编译参数

                      a.右击项目--“属性” --- “Flex编译器” ---- 在右侧找到 “附加的编译器参数” 在下方框中 增加一段

                          "{你的tomcat发布地址下的}\WebContent\WEB-INF\flex\services-config.xml" (根据实际情况配置此文件所在位置)

   3.新建文件名index.mxml的文件其内容参考下面代码                       

index.mxml
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
 3                xmlns:s="library://ns.adobe.com/flex/spark" 
 4                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
 5     
 6     <fx:Declarations>
 7         <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 8         <s:RemoteObject id="remoteObject"
 9             destination="helloWorld"  
10             result="resultHandler(event)" fault="faultHandler(event)"  
11             />
12     </fx:Declarations>
13     
14     <fx:Script>
15         <![CDATA[
16             import mx.controls.Alert;
17             import mx.rpc.events.FaultEvent;
18             import mx.rpc.events.ResultEvent;     
19             
20             private function resultHandler(event:ResultEvent):void {     
21                 Alert.show(event.result.toString(), "成功");     
22             }     
23             
24             private function faultHandler(event:FaultEvent):void {     
25                 Alert.show(event.fault.toString(), "失败");     
26             }    
27             
28             protected function button1_clickHandler(event:MouseEvent):void
29             {
30                 remoteObject.getHelloWorld("zhaoyashan");        
31             }
32         ]]>
33     </fx:Script>
34     <s:Button label="发送消息" click="button1_clickHandler(event)" x="256.5" y="197"/>   
35 </s:Application>

注:    

   a. <s:RemoteObject id="remoteObject"
     destination="helloWorld"          //对应Blazeds中配置 remoting-config.xml的Destination 名称
     result="resultHandler(event)"   // 执行成功执行

              fault="faultHandler(event)"      //执行失败执行
    />

        b. remoteObject.getHelloWorld("zhaoyashan");  //对应Java类中的getHelloWorld方法,有参数时可以直接传入

 

总结:将详细过程写在这里了,还有什么不懂的请留言,如有错误请多多指出,我会更加完善让其他新手,少走一点弯路。

                                                                  2012-5-24

            

 

 

 

 

 

posted @ 2012-05-23 22:54 赵亚山 阅读(497) 评论(0) 编辑

2012年5月23日

1. 下载 Blazeds文件:

         a. http://sourceforge.net/adobe/blazeds/wiki/Downloads/  下拉网页找到  Release Builds 说明下的  Download the latest BlazeDS Release builds

            点击此链接

         b. 这个时间会弹出Adobe登陆用户界面,如果有用户就登陆一下,没有就点击边上的创建用户(Create an Adobe Account)

         c. 中转到 BlazeDS Terms of Use 页面,这个时候只能 选中 “I Agree” ,下一步

         d.新页面中将页面下拉到下图位置:(如果只是使用的话,建议下载binary Distribution这个版本的)

        

       e.将下载后的文件解压待用。。。。

2.新建JAVA web项目

      a. “文件”---“新建”------“其他”---Dynamic Web Project (动态WEb项目)                    

        

      b.新建项目BlazedsDemo参数如下(只供参考,只要能新建出项目即可)             

          

       c.在新项目下的Src文件中新增一个HelloWorld类              

HelloWorld
 1 package cn.riahome.java;
 2 
 3 public class HelloWorld
 4 {
 5 
 6     public HelloWorld() {  
 7     } 
 8     public String getHelloWorld(String name) {  
 9         return "Hello World!"+name;  
10     }
11 }

       d.将Blazeds刚解压出来的 blazeds\WEB-INF\lib 下的文件复制到 本项目下的WebContent下的WEB-INF\lib下

       e. blazeds\WEB-INF\flex 下的文件复制到本项目下的WebContent下的WEB-INF下

       f.  blazeds\WEB-INF 下的web.xml 替换本项目下的WebContent下的WEB-INF中的web.xml

      g. 在WEB-INF\flex\remoting-config.xml 中新增如下代码:                    

          <destination id="helloWorld">  
                <properties>
                    <source>cn.riahome.java.HelloWorld</source>
                </properties>
          </destination>

          修改后文件如下:               

Remoting-config文件
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <service id="remoting-service" 
 3     class="flex.messaging.services.RemotingService">
 4 
 5     <adapters>
 6         <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
 7     </adapters>
 8 
 9     <default-channels>
10         <channel ref="my-amf"/>
11     </default-channels>
12     <destination id="helloWorld">  
13         <properties>  
14             <source>cn.riahome.java.HelloWorld</source>  
15         </properties>  
16       </destination>
17 </service>

        注:  a.  destination节点的id名称是要被Flex端直接调用的

                       b. <source>cn.riahome.java.HelloWorld</source>  指定所对应的类

 

      h. 修改“构建路径”

            选中项目右击“属性”--在弹出框中选择“java构建路径”---选择"源代码"子项 如下图            

      

            注:将输出路径修改为:WebContent/WEB-INF/classes 系统会自动到Web-inf /classes 中找文件编译后的类文件

                           1.这里一定要设置,要不然项目运行时会提醒找不到此类的错误

3.新建Flex项目

                 a. “文件”---“新建”--“Flex项目” 填写信息如图:                     

      

          b.点击下一步                   

          

                  注:a. 根文件夹: 填写TomCat下的你程序发布的本地地址 如: C:\tomcat\webapps\demo\

                       b.根URL:  填写你程序运行起来的网页地址(如图)

                       c.上下文根目录: 填写网页地址中端口号后的名称  如上图中 “根URL” 端口号后的 BlazedsDemo

                       d.输出文件夹:与“根文件夹”相同

                      e.点击“完成” 建立项目

           c.配置新建项目的编译参数

                      a.右击项目--“属性” --- “Flex编译器” ---- 在右侧找到 “附加的编译器参数” 在下方框中 增加一段

                          "{你的tomcat发布地址下的}\WebContent\WEB-INF\flex\services-config.xml" (根据实际情况配置此文件所在位置)

   3.新建文件名index.mxml的文件其内容参考下面代码                       

index.mxml
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
 3                xmlns:s="library://ns.adobe.com/flex/spark" 
 4                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
 5     
 6     <fx:Declarations>
 7         <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 8         <s:RemoteObject id="remoteObject"
 9             destination="helloWorld"  
10             result="resultHandler(event)" fault="faultHandler(event)"  
11             />
12     </fx:Declarations>
13     
14     <fx:Script>
15         <![CDATA[
16             import mx.controls.Alert;
17             import mx.rpc.events.FaultEvent;
18             import mx.rpc.events.ResultEvent;     
19             
20             private function resultHandler(event:ResultEvent):void {     
21                 Alert.show(event.result.toString(), "成功");     
22             }     
23             
24             private function faultHandler(event:FaultEvent):void {     
25                 Alert.show(event.fault.toString(), "失败");     
26             }    
27             
28             protected function button1_clickHandler(event:MouseEvent):void
29             {
30                 remoteObject.getHelloWorld("zhaoyashan");        
31             }
32         ]]>
33     </fx:Script>
34     <s:Button label="发送消息" click="button1_clickHandler(event)" x="256.5" y="197"/>   
35 </s:Application>

注:    

   a. <s:RemoteObject id="remoteObject"
     destination="helloWorld"          //对应Blazeds中配置 remoting-config.xml的Destination 名称
     result="resultHandler(event)"   // 执行成功执行

              fault="faultHandler(event)"      //执行失败执行
    />

        b. remoteObject.getHelloWorld("zhaoyashan");  //对应Java类中的getHelloWorld方法,有参数时可以直接传入

 

总结:将详细过程写在这里了,还有什么不懂的请留言,如有错误请多多指出,我会更加完善让其他新手,少走一点弯路。

                                                                  2012-5-24

            

 

 

 

 

 

posted @ 2012-05-23 22:54 赵亚山 阅读(497) 评论(0) 编辑

2012年2月10日

一个demo让你掌握Android的各种Service:
http://www.apkbus.com/android-19645-1-1.html
android开发教程专题
http://dev.apkbus.com/ 

Android 动画效果专题研究:


http://www.apkbus.com/android-729-1-1.html

盘点Android 所有Dialog大合集:
http://www.apkbus.com/android-18549-1-1.html

一个帖子学会Android开发四大组件 :

http://www.apkbus.com/android-18204-1-1.html

近百个Android开源项目,覆盖Android每个领域 

http://www.apkbus.com/android-17627-1-1.html

[Android实例] 基本控件及基本动画效果demo:

http://www.apkbus.com/android-7043-1-2.html

新版Android开发教程&笔记(1-12):

http://www.apkbus.com/android-624-1-1.html

Android 开发从入门到精通:

http://www.apkbus.com/android-13919-1-1.html

Android腾讯微薄客户端开发教程汇总:

http://www.apkbus.com/android-13749-1-1.html 

《Android学习指南》:

http://www.apkbus.com/android-830-1-1.html

71道Android开发面试题目:

http://www.apkbus.com/android-19649-1-1.html


一个Demo让你掌握所有的android控件:

http://www.apkbus.com/android-2077-1-1.html

posted @ 2012-02-10 10:49 赵亚山 阅读(7) 评论(0)  编辑

2012年1月31日

运行jsf页面出现javax.faces.application.ViewExpiredException - /*.jsp No saved view state could be found for the view identifier: /*.jsp问题的解决方法
 
出现此问题的原因我也不是太清楚,看了相关资料说是因为session的保存时间造成了。所以下面的两个方法都是针对时间来修正。
在web.xml中新增下列节点

方法1.   

View Code
1  <web-app>
2 <context-param>
3 <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
4 <param-value>true</param-value>
5 </context-param>
6 </web-app>
方法2.
  增加保存时间为600分钟
View Code
1  <web-app>       
2 <session-config>
3 <session-timeout>600</session-timeout>
4 </session-config>
5 </web-app>

 
 

posted @ 2012-01-31 23:58 赵亚山 阅读(70) 评论(0) 编辑

2012年1月15日

要使用Servlet一定要继承于HttpServlet
HttpHello类,切记要继承HttpServlet
 1 import java.io.IOException;
2 import javax.servlet.ServletException;
3 import javax.servlet.http.HttpServlet;
4 import javax.servlet.http.HttpServletRequest;
5 import javax.servlet.http.HttpServletResponse;
6
7 public class HttpHello extends HttpServlet {
8 private static final long serialVersionUID = 1L;
9
10 public HttpHello() {
11 super();
12 }
13
14 protected void doGet(HttpServletRequest request,
15 HttpServletResponse response) throws ServletException, IOException {
16 response.getWriter().write("Hello, world!");
17 }
18
19 protected void doPost(HttpServletRequest request,
20 HttpServletResponse response) throws ServletException, IOException {
21 doGet(request, response);
22 }
23
24 }

然后在\WebContent\WEB-INF 下的Web.xml中进行下面的配置操作(如果没有就自己创建一个)

          

web.xml
 1 <?xml version="1.0" encoding="UTF-8"?>
2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
3 <display-name>DemoWeb</display-name>
4 <welcome-file-list>
5 <welcome-file>index.jsp</welcome-file>
6 </welcome-file-list>
7 <servlet>
8 <servlet-name>HttpHello</servlet-name><!-- 名称起的和类名一样-->
9 <servlet-class>test.HttpHello</servlet-class> <!-- 类所在的路径 -->
10 </servlet>
11 <servlet-mapping>
12 <servlet-name>HttpHello</servlet-name> <!-- 要和上面的名称相同 HttpHello -->
13 <url-pattern>/HttpHello</url-pattern>
14 </servlet-mapping>
15
16 </web-app>

注:生成出来的HttpHello.class文件一定要在\WebContent\WEB-INF \classes文件夹下

tomcat配置正确的情况下。

          直接访问 http://localhost:8080/项目名称/HttpHello 就可以看到效果了(本例显示的是Hello!world)

posted @ 2012-01-15 03:24 赵亚山 阅读(69) 评论(0) 编辑

1.首先我们自定义一个类;
TestBean自定义类
 1 package com.founder.bms; 
2 public class TestBean {
3 private String name = null;
4 public TestBean(String strName_p){
5 this.name=strName_p;
6 }
7 public void setName(String strName_p){
8 this.name=strName_p;
9 }
10 public String getName(){
11 return this.name;
12 }
13 }

2. 在Jsp中使用示例

jsp中使用示例
 1 <%@ page import="com.founder.bms.TestBean" %>
2 <%@ page language="java" contentType="text/html; charset=UTF-8"
3 pageEncoding="UTF-8"%>
4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <html>
6 <head>
7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8 <title>Insert title here</title>
9 </head>
10 <body>
11 <center>
12 <%
13 TestBean testBean=new TestBean("This is a test java bean.");
14 %>
15 Java bean name is: <%=testBean.getName()%>
16 </center>
17 </body>
18 </html>

注:容易遇到的问题是,

         a.  在运行网页提示找不到这个类。

       解决方法:   将此类放入包中,如:com.xxx.xx (最好放在名称为com的包下,我自己放在test名称包中出错)  并且确保你生成类放在了本项目的WebContent\WEB-INF\classes\  文件夹下,(如果是新手这个是一定要放的切记)

      b.在jsp中类的导入方法

              1. <%@ page import="com.founder.bms.TestBean" %>  一定要加

       

                       

posted @ 2012-01-15 03:09 赵亚山 阅读(118) 评论(0) 编辑

2012年1月10日

打包命令:
Windows:

D:\WebSer\Flash Media Server 3\applications\test\main>"D:\WebSer\Flash Media Ser
ver 3\tools\far.exe" -package -archive main -files Application.xml main.asc

注:我在使用的时候一直提示我缺少 zlib.dll和其他多个Dll文件,其实这些文件Fms安装目录下都是有的。可以用对相应的dll文件进行搜索,然后将搜索到的dll文件复制到C:\windows\system文件夹下就可以,解决dll文件缺失


Linux:
$ /usr/local/fms/tools/far -package -archive main -files Application.xml main.asc


默认是SharedObject远程共享对象和StreamRecord录制都不允许的。
Application.xml改成如下:

<Application>

<SharedObjManager>
<ClientAccess override="yes">true</ClientAccess>
</SharedObjManager>

<StreamManager>
<StreamRecord override="yes">true</StreamRecord>
</StreamManager>

</Application>

保存之后再打包一下,替换main.far,OK!问题解决了,可以录制了。

posted @ 2012-01-10 12:05 赵亚山 阅读(73) 评论(0)  编辑

2011年9月8日

摘要: http://www.spicefactory.org/parsley/download.php 官网阅读全文

posted @ 2011-09-08 22:56 赵亚山 阅读(14) 评论(0) 编辑

2011年5月19日

摘要: 代码中: foreach (Control c1 in c.Controls)不能删除,但是我不知道为什么,请知道的兄台指教一下,这里谢谢了。 遍历其他控件的方法,也可以用相同方法。 1 foreach (System.Web.UI.Control c in this.Controls) //遍历所有控件 3 { 5 TextBox txt=null; //定义一个文本框控件 7 if (c.GetType().Name == "HtmlForm") //判断是否为HtmlForm控件(为了减少不必要的循环) 9 { foreach (Control c1 in c.Con阅读全文

posted @ 2011-05-19 12:36 赵亚山 阅读(126) 评论(0) 编辑

2011年4月1日

摘要: 操作步骤:1、安装可以支持"-vsdoc.js"Intellisense文件的补丁 下载地址:http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=17362、下载JQuery库,包括-vsdoc.js。 下载地址:http://docs.jquery.com/Downloading_jQuery阅读全文

posted @ 2011-04-01 10:47 赵亚山 阅读(160) 评论(0) 编辑

2011年2月7日

摘要: 我只在IE浏览器中测试成功了,在谷歌浏览中没有测试成功,其他浏览器没有测试。操作步骤如下: 1. javascript代码中插入:debugger,如下: <script type="text/javascript"> debugger; </script>2.将IE浏览器中的“禁止脚本调试”这一项的勾给去掉。然后在点击vs中的调试即可。阅读全文

posted @ 2011-02-07 10:30 赵亚山 阅读(4087) 评论(10) 编辑