无常

无常
posts - 5, comments - 8, trackbacks - 0, articles - 0

2005年8月9日

 

       <logic:iterate id="data" name="data" scope="request" indexId="indexid">
        
<tr align="center">
          
<td>${pageScope.indexid + 1}</td>
          
<td>           
            
<bean:write name="data" property="sfmlmc"/>
          
</td>
          
<td>
            
<bean:write name="data" property="hdbz"/>&nbsp;
          
</td>
        
</tr>
      
</logic:iterate>

posted @ 2005-08-09 19:00 无常 阅读(3078) | 评论 (1)编辑 收藏

2005年5月20日

 

package wc.sms;

import java.io.IOException;
import javax.wireless.messaging.
*;
import javax.microedition.io.
*;

/**
 * 发送文本短信息的方法
 
*/

public class SMSUtil implements Runnable
{
    
/**
     * 给指定号码发送短信息
     * 
     * @param content
     *            短信息内容
     * @param phoneNumber
     *            手机号码
     * @return 发送成功返回true,否则返回false
     
*/

    
public static void send(String content, String phoneNumber)
    
{
        Thread t 
= new Thread(new SMSUtil(content, phoneNumber));
        t.start();
    
    }


    
private String content;
    
private String phoneNumber;

    
/**
     * 构造
     * 
     * @param content
     *            消息内容
     * @param phoneNumber
     *            接收号码
     
*/

    
private SMSUtil(String content, String phoneNumber)
    
{
        super();
        
this.content = content;
        
this.phoneNumber = phoneNumber;
    }


    
/*
     * (non-Javadoc)
     * 
     * @see java.lang.Runnable#run()
     
*/

    
public void run()
    
{
        
//地址
        String address = "sms://+" + phoneNumber;
        
//建立连接
        MessageConnection conn = null;
        
try
        
{
            conn 
= (MessageConnection) Connector.open(address);
            
//设置短信息类型为文本
            TextMessage msg = (TextMessage) conn
                    .newMessage(MessageConnection.TEXT_MESSAGE);
            
//设置信息内容
            msg.setPayloadText(content);
            
//发送
            conn.send(msg);
            conn.close();
        }

        
catch (Exception e)
        
{
            e.printStackTrace();
        }

        
finally
        
{
            
if (conn != null)
            
{
                
try
                
{
                    conn.close();
                }

                
catch (IOException e1)
                
{
                    e1.printStackTrace();
                }

            }

        }

    }

}

发是发出去了,可以对方收不到:(

难道这个问题是真的?
但是发现只有这个程序发出的短消息才能被另外一部安装了这个程序的手机接收到。
用手机内置的功能发出的短消息却不能被这个程序接收到。



posted @ 2005-05-20 12:05 无常 阅读(569) | 评论 (0)编辑 收藏

越来越搞不懂Eclipse中的java.io.UTFDataFormatException

 

昨天以为这个问题搞定了,现在又有新的状况

一直没有修改过项目的属性,多加了几个class,程序中也没用到中文字符串。

不知为什么再次执行后就出现这个错误了,用的是WTK2.2,执行后手机模拟器闪了一下就退出了,控制台出现下面的错误。

 

正在通过存储根 DefaultColorPhone 来运行

java.io.UTFDataFormatException: invalid byte 11011110

    at com.sun.cldc.i18n.j2me.UTF_8_Reader.read(+281)

    at java.io.Reader.read(+11)

    at java.io.InputStreamReader.read(+11)

    at com.sun.midp.midletsuite.JadProperties.readLine(+15)

    at com.sun.midp.midletsuite.JadProperties.partialLoad(+63)

    at com.sun.midp.midletsuite.JadProperties.load(+8)

    at com.sun.midp.dev.DevMIDletSuiteImpl.create(+190)

    at com.sun.midp.dev.DevMIDletSuiteImpl.create(+62)

    at com.sun.midp.main.Main.runLocalClass(+20)

    at com.sun.midp.main.Main.main(+116)

Execution completed.

700765 bytecodes executed

0 thread switches

738 classes in the system (including system classes)

3501 dynamic objects allocated (91984 bytes)

1 garbage collections (0 bytes collected)

 

这里肯定不是程序的问题!因为把打包后的.jad.jar在moto sdk的模拟器上运行就没问题!另外一个方法,新建一个J2ME Midlet Suite,把这个项目的所有程序和资源文件导过去就正常了!

但加了几个class之后,多写了些代码,这个项目也出现这样的问题了。

 

 

posted @ 2005-05-20 08:57 无常 阅读(4788) | 评论 (3)编辑 收藏

2005年5月19日

Together6.3 for Eclipse3.0.x在win2003中安装时要注意

在安装时会找不到eclipse的安装目录,
解决方法:用win2000兼容模式执行安装文件!

具体操作:
右键点Borland Together EC的文件->属性->兼容性->选中“使用兼容模式运行这个程序”,选win2000

搞定

posted @ 2005-05-19 11:43 无常 阅读(382) | 评论 (0)编辑 收藏

原来用jbuilder2005带的j2mewtk2.1一直都好好的。
早上过来下了个WTK2.2,装了之后在Eclipse中死活不能调试j2me程序,在Eclipse中启动不了模拟器
莫名其妙地出现下面的错误:(
正在通过存储根 DefaultColorPhone 来运行

java.io.UTFDataFormatException: invalid first byte 10110111
 at com.sun.cldc.i18n.j2me.UTF_8_Reader.read(+194)
 at java.io.Reader.read(+11)
 at java.io.InputStreamReader.read(+11)
 at com.sun.midp.midletsuite.JadProperties.readLine(+15)
 at com.sun.midp.midletsuite.JadProperties.partialLoad(+63)
 at com.sun.midp.midletsuite.JadProperties.load(+8)
 at com.sun.midp.dev.DevMIDletSuiteImpl.create(+190)
 at com.sun.midp.dev.DevMIDletSuiteImpl.create(+62)
 at com.sun.midp.main.Main.runLocalClass(+20)
 at com.sun.midp.main.Main.main(+116)
Execution completed.
693086 bytecodes executed
0 thread switches
738 classes in the system (including system classes)
3455 dynamic objects allocated (90996 bytes)
1 garbage collections (0 bytes collected)

 

尝试把项目的编码改成utf-8,竟然编译都提示出错了,郁闷ing...
继续找解决方法


....
...
再把这个项目改用wtk2.1,也不行,还是一样的错误
新建一个项目(用WTK2.1WTK2.2都行),再把刚才出错项目的代码和资源导入,居然成功了!

莫名其妙!

还有一个不明的地方就是,装了WTK2.2之后会把.jad文件与模拟器关联,但有时双击.jad执行时会出现这个错误(.JAD都是用eclipse生成的)。

com.sun.kvem.midletsuite.InvalidJadException: Reason = 22
��Ӧ�ó�������� MUST ������: MIDlet-1


.....
气死气死,原来是因为这个原因!

j2megame项目中的j2megame.jad里配置有2Midletes,有一个是原来测试用的,后来把那个测试class删了,但忘了删.jad中的配置:(

WTK22Eclipse没有关系,错怪他们了:(

 

 

 

posted @ 2005-05-19 10:42 无常 阅读(2203) | 评论 (4)编辑 收藏