小编raj*_*i..的帖子

找不到匹配的编辑器或转换策略

我是春天的新手.我得到了这个例外.我用谷歌搜索但我没有找到确切的解决方案,任何人都可以指出哪里是错误..

APP-context.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
    <bean class="com.listinjection.Course" id="course">

        <property name="course">
            <list value-type="java.lang.String">

                <value>c</value>
                <value>c++</value>
                <value>java</value>
                <value>web services</value>

            </list>
        </property>
    </bean>

    <bean class="com.mapinjection.University" id="university">
        <property name="university">
            <map key-type="java.lang.String" value-type="com.mapinjection.Course">
                <entry key="java" value-ref="course">
                </entry>
            </map>
        </property>
    </bean>
</beans>
Run Code Online (Sandbox Code Playgroud)

Course.java

    package com.mapinjection;

import java.util.List;

public class Course {
    private List<String> course;

    public void setCourse(List<String> course) {
        this.course = course;
    }

    public void display(){
        System.out.println("list of courses are:");
        for(String s:course){
            System.out.println(s);
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

University.java

    package com.mapinjection;

import java.util.Map; …
Run Code Online (Sandbox Code Playgroud)

java spring

8
推荐指数
1
解决办法
4万
查看次数

java.sql.SQLException:列索引超出范围,0 <1

我想显示数据库中的所有图像.我编写了代码但是显示错误java.sql.SQLException:列索引超出范围,0 <1.下面是我的数据库表

| application_name | varchar(45)  | 
| application_id   | varchar(10)  | 
| application_path | varchar(500) | 
| application_icon | blob         | 
Run Code Online (Sandbox Code Playgroud)

我想只显示images.below是我的servlet代码

IconDownload.java

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            response.setContentType("image/jpeg");
            PrintWriter out=response.getWriter();
            try {
                Connection connection= DBUtil.getConnection();
                PreparedStatement preparedStatement=connection.prepareStatement("select application_icon  from application_master");
                ResultSet resultSet=preparedStatement.executeQuery();
                System.out.println("resultSet"+resultSet);
                out.print("<h1>photo</h1>");
                while (resultSet.next()) {
                    out.print("<img width='200' height='200' src="+resultSet.getBlob(0)+ ">  </img>" );
}
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch …
Run Code Online (Sandbox Code Playgroud)

java mysql servlets

7
推荐指数
1
解决办法
2万
查看次数

允许方括号的正则表达式

下面是我的代码,它允许特殊字符、数字、字符(上下)。这个程序运行良好。我的方括号问题。

public class MatchingSpecificCharacters {
    public static void main(String[] args) {

        String reg = "[A-Za-z0-9!$-~`?/@#%^*&()_+=<>.,';:|\" ]*";
        String line = "as[]d";

        System.out.println(line.matches(reg));


    }
}
Run Code Online (Sandbox Code Playgroud)

输出

真的

在程序中,我使用 [] 方括号将所有字符、数字、特殊字符括起来。我没有使用额外的方括号作为特殊章程,但程序允许它。谁能告诉我为什么它允许方括号。如果我错了,请纠正我。

java regex

2
推荐指数
1
解决办法
2218
查看次数

迭代器和枚举之间的区别

看下面的代码

import java.util.Enumeration;
import java.util.Vector;

public class Modification_On_Eumeration {
    public static void main(String[] args) {
        Vector<Integer> vector = new Vector<Integer>();
        vector.add(1);
        vector.add(2);
        System.out.println(vector);
        Enumeration<Integer> enumeration = vector.elements();
        while (enumeration.hasMoreElements()) {
            Integer integer = (Integer) enumeration.nextElement();
            System.out.print(integer);
        }
        System.out.println();
        System.out.println("first loop finished");
        vector.add(3);
        while (enumeration.hasMoreElements()) {
            Integer integer1 = (Integer) enumeration.nextElement();
            System.out.println(integer1);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

上面的代码工作正常,输出是:

[1, 2]
12
first loop finished
3
Run Code Online (Sandbox Code Playgroud)

现在看下面的代码:

import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;

public class Fail_Safe_Iterator {
    public static void main(String[] args) {
        CopyOnWriteArrayList<Integer> copyOnWriteArrayList=new CopyOnWriteArrayList<Integer>(); …
Run Code Online (Sandbox Code Playgroud)

java collections iterator enumeration

1
推荐指数
1
解决办法
371
查看次数

识别两个不同的线程

我正在学习java中的多线程.我怀疑是,有两种不同的线程,如果它们下面有相同的名称是我的代码

package com.rajeev.test2;

    public class Test11 extends Thread {
        public static void main(String[] args) {
            System.out.println(Thread.currentThread());
            new Test11().start();
            new Test12();
        }
        @Override
        public void run() {
            Thread.currentThread().setName("ram");
            System.out.println(Thread.currentThread());
        }
    }
    class Test12 extends Thread{

        static{
            new Test12().start();
        }
        @Override
        public void run() {
            Thread.currentThread().setName("ram");
            System.out.println(Thread.currentThread());
        }
    }
Run Code Online (Sandbox Code Playgroud)

产量

Thread[main,5,main]
Thread[ram,5,main]
Thread[ram,5,main]
Run Code Online (Sandbox Code Playgroud)

我知道它们是两个具有相同名称的不同线程,所以如何知道它们是不同的线程而不更改名称?

java multithreading

1
推荐指数
1
解决办法
127
查看次数