此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【thankyou2008】截止到2008-07-28 00:25:23的历史汇总数据(不包括此帖):
发帖的总数量:22                       发帖的总分数:1460                     每贴平均分数:66                       
回帖的总数量:36                       得分贴总数量:6                        回帖的得分率:16%                      
结贴的总数量:21                       结贴的总分数:1430                     
无满意结贴数:2                        无满意结贴分:140                      
未结的帖子数:1                        未结的总分数:30                       
结贴的百分比:95.45 %               结分的百分比:97.95 %                  
无满意结贴率:9.52  %               无满意结分率:9.79  %                  
值得尊敬

解决方案 »

  1.   

    将List放到作用域中,session或者application
    或者用singleton模式
      

  2.   

    axis你是想调用web services吗?
    axis不是可以自动生成web services吗
    会有一个**proxy的代理类
    你在action中直接调用proxy提供的方法就行
      

  3.   

    你的代码没用的web service ,可以使用web service 来远程调用方法。返回list类型。
      

  4.   

    我写好一个XML例子,用DOM4J解析时出现一个错误:The type org.jaxen.VariableContext cannot be resolved. It is indirectly referenced from required .class files 
    代码:XMLTableModel model=new XMLTableModel(definition,document); 
    错误是在这个代码上出现的,哪位高手麻烦给解释下 
      

  5.   

    大致的意思是org.jaxen下的变量内容的类型不能被识别,类文件引用不正确
      

  6.   

    首先axis和struts没什么关系 
    我想这个你应该明白吧 
    用axis可以把一个java方法发布成web services 
    这个很容易做到的 
    然后会得到一个wsdl的地址 
    再用axis通过刚才得到的wsdl地址生成一个客户端应该也不难做到 
    可以参考axis的例子 其中也就有一个代理类 
    这个类里提供了可以调用的方法 
    然后在用struts调用这个类就行了
      

  7.   

    private static SearchServiceLocator service = new SearchServiceLocator();
    public static List getList( String inputStr,int number){

    List list = new ArrayList();
    int end = number * 10;
    int start = ( number - 1) * 10;
    String oldStr = "<mk>" + inputStr + "</mk>";
    String newStr = "<font color='red'><strong>" + inputStr + "</strong></font>";

    //System.out.println( "end :" + end + "###" + "start :" + start);

    try{

    service.setMaintainSession(true);          //设置Cookie 自动接收处理 
    SearchServiceSoap_PortType client = service.getSearchServiceSoap();
    //超时设置   当搜索到更多记录时,速度很慢。
    Stub s = (Stub) client;
        s.setTimeout(5000);

    SearchResult result = client.doSearch( inputStr,end); 
    //System.out.println( result.getErrorMessage());

    if ( result.getItems() == null){
    return list;
    }
    SearchResultItem[] e = result.getItems();
    int n = 0;   //计数器

    for ( int i = 0; i < e.length; i++){

    if ( i < start){
    continue;
    }
    DocumentType d = new DocumentType();
    d.setTitle( e[i].getTitle());                     //标题 
    d.setSnippets( SocketClient.parseStr( e[i].getSnippets(), oldStr ,newStr));   //正文内容已做飘红处理
    int xg = (int) paseInt( e[i].getScore());
    d.setXg( xg);                        //相关度
    d.setFsize( e[i].getFileSizeKB());                  //文件大小
    d.setAuthor( e[i].getAuthor());           //作者
    String url = parseStr( e[i].getURL(),"\\\\","/");                             
    url = parseStr( url,"\\","/");
    //url = parseChinese( url);   //取消中文过滤
    System.out.println( url);
    d.setFpath( "file:/" + url);       //文件路径  file://dataserver/temp/中古合作/相关材料/关于北大生物技术公司筹办方案修改后.doc  (只有IE方能正确使用)
    list.add(d);
    n++;
      }

    }catch(ServiceException e){
    e.printStackTrace();
    } catch (RemoteException e) {
    e.printStackTrace();

    return list;
    }
    //身份验证
    public static boolean logOn( String userName, String userPass){

    boolean b = false;

    try {
    service.setMaintainSession(true);          //设置Cookie 自动接收处理 
    SearchServiceSoap_PortType client = service.getSearchServiceSoap();
    //超时设置  
    Stub s = (Stub) client;
        s.setTimeout(5000);

    WebResult say = client.logon( userName, userPass);
    //判断用户名和密码是否正确
    if ( say.getCode() != 0){
    System.out.println( say.getMsg());     //返回错误消息
    System.out.println( "用户名或密码错误");
    }else{
    b = true;
    }
    } catch (ServiceException e) {
    System.out.println( "服务器连接不稳定。");
    e.printStackTrace();
    } catch (RemoteException e) {
    System.out.println( "用户名或密码错误。");
    e.printStackTrace();
    }
    return b;
    }
    //游客身份登录
    public static void visitorLogOn(){

    try {
    Properties props = new Properties();
    String path = Thread.currentThread().getContextClassLoader().getResource("").getPath();  //得到当前进程所在的路径
    props.load(new FileInputStream( path + "config//server.properties"));
    //props.load(new FileInputStream("config//server.properties")); 

    service.setMaintainSession(true);          //设置Cookie 自动接收处理 
    SearchServiceSoap_PortType client = service.getSearchServiceSoap();
    //超时设置  
    Stub s = (Stub) client;
        s.setTimeout(5000);
    WebResult say = client.logon( props.getProperty( "userName"), props.getProperty( "userPass"));
    //判断用户名和密码是否正确
    if ( say.getCode() != 0){
    System.out.println( say.getMsg());     //返回错误消息
    System.out.println( "用户名或密码错误");
    }
    } catch (ServiceException e) {
    System.out.println( "服务器连接不稳定。");
    e.printStackTrace();
    } catch (RemoteException e) {
    System.out.println( "用户名或密码错误。");
    e.printStackTrace();
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
      

  8.   

    以上是未做过优化    利用webservice实现搜索只是一个debug版