小编Nis*_*ain的帖子

绝对的uri:http://java.sun.com/jsp/jstl/core无法在web.xml或使用此应用程序部署的jar文件中解析

我使用的是JDK 1.7,Apache Tomcat 7.0.23,我在WEB_INF lib文件夹中放置了JSTL核心库(1.2)和STANDARD jar,它没有给我任何警告,但是当我尝试运行代码时

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- Create Bean Instance-->
<jsp:useBean id="listdomain" class="bean.PopulateMultiDomain" scope="session"></jsp:useBean>

<jsp:setProperty property="*" name="listdomain"/>

<c:forEach var="item" items="${listdomain.status}">
    <option>
        <c:out value="${item}" />
    </option>
</c:forEach> 
Run Code Online (Sandbox Code Playgroud)

它给了我以下错误:

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:410)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1425)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Run Code Online (Sandbox Code Playgroud)

有谁能告诉我我犯的是什么错误?

apache jstl java-ee tomcat7

46
推荐指数
3
解决办法
12万
查看次数

UnsupportedClassVersionError不支持major.minor版本51.0无法加载类

可能重复:
线程"main"中的异常java.lang.UnsupportedClassVersionError:a(Unsupporte d major.minor版本51.0)

我使用jdk 1.7.0,Eclipse IDE(Indigo)在java中开发了一个Web应用程序,并在eclipse ide中配置的tomcat(apache-tomcat-7.0.23)上运行该应用程序.

当我试图通过IDE运行我的应用程序时它运行正常,但是当我创建它的战争并将其放在apache部署文件夹(webapps)并从IDE外部运行它时,启动页面成功加载但当我尝试执行任何操作时它给了我一个错误

UnsupportedClassVersionError unsupported major.minor version 51.0 unable to load class bean.myclassname
Run Code Online (Sandbox Code Playgroud)

我已经检查了它的jdk 1.7.0以外的java版本,并且JAVA_HOME环境变量也设置为C:\ Program Files\Java\jdk1.7.0_01.

java tomcat war

32
推荐指数
2
解决办法
13万
查看次数

java.lang.IllegalArgumentException:控制cookie值或属性中的字符

我试图在cookie中设置unicode值,但它不接受这个并抛出异常.我检查了字符串的十六进制值,它是正确的,但在添加到cookie时抛出异常.

private void fnSetCookieValues(HttpServletRequest request,HttpServletResponse response) 
    {

        Cookie[] cookies=request.getCookies();
        for (int i = 0; i < cookies.length; i++) {

            System.out.println(""+cookies.length+"Name"+cookies[i].getName());

            if(cookies[i].getName().equals("DNString"))
            {   
                System.out.println("Inside if:: "+cookies[i].getValue()+""+cookies.length);
                try {

                    String strValue;
                    strValue = new String(request.getParameter("txtIIDN").getBytes("8859_1"),"UTF8");
                    System.out.println("Cookie Value To be stored"+strValue);
                    for (int j = 0; j < strValue.length(); j++) {

                        System.out.println("Code Point"+Integer.toHexString(strValue.codePointAt(j)));

                    }


                    Cookie ck = new Cookie("DNString",strValue);
                    response.addCookie(ck);

                } catch (UnsupportedEncodingException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }


            }
        }

    }
Run Code Online (Sandbox Code Playgroud)

我明白了:

java.lang.IllegalArgumentException: Control character in cookie value or …
Run Code Online (Sandbox Code Playgroud)

cookies servlets

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

无法从外部返回功能或方法?

在开发Web应用程序时,我想执行某些验证检查,并且只有在成功验证后才需要发布表单并将控件重定向到下一页.

JavaScript代码:

function fnCheckEmptyField()
{
    var strDomain = document.getElementsByName("txtIIDN").value;
    if (strDomain == null)
    {
        document.getElementById("lblValidityStatus").innerHTML = "";
        document.getElementById("lblValidityStatus").innerHTML = "Domain Name Field Can't be Left Blank";
        return false;
    }
    else
    {
        return true; 
    }
}
Run Code Online (Sandbox Code Playgroud)

相关的HTML代码:

<form action="Result.jsp" name="validityCheck" onsubmit="return fnCheckEmptyField()">
    <input type="text" id="txtIIDN"/>
    <input type="submit" id="btnValidityCheck" value="Check Validity" />
</form>
Run Code Online (Sandbox Code Playgroud)

该行onsubmit="return fnCheckEmptyField()"显示错误无法从函数或方法外部返回,并且在执行JavaScript函数表单后,无论文本字段是否为空,都会提交.

我已将警报置于if条件内,并确保if字段为空时函数返回false.

我不知道我的代码有什么问题以及为什么这个错误无法从函数或方法外部返回.

原因是什么,我该如何解决?

html javascript eclipse jsp

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

将GridView绑定到字符串列表

我有一个List,我绑定到GridView,因此我的GridView只有一列这些字符串值.我希望为此列提供正确的标题文本.请帮我.看看我试图做什么:

<asp:GridView ID="GridView1" runat="server" Width="95%">

<Columns>

<asp:BoundField HeaderText="My List" />

</Columns>

</asp:GridView>
Run Code Online (Sandbox Code Playgroud)

在代码背后:

List<string> myList = new List<string>();

:

:

// code to populate myList

:

:

GridView1.DataSource = myList;

GridView1.DataBind();
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,我在GridView中得到两列.第一列具有标题文本作为"我的列表"并且具有空行,而第二列具有标题文本作为"项目"并且具有具有myList值的行.我想在我的GridView中只有一列具有标题文本作为"我的列表"和具有myList对象值的行.

谢谢

asp.net gridview

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

查询数据库的记录以获得几乎相似的匹配字符串值

场景是我有一个包含地址城市字段的大约500,000条记录的庞大数据库,其中没有这样的标准方式来插入值,因此多个用户,例如一些已将城市值插入班加罗尔而另一个已插入其城市价值为begaluru或benglore(拼写错误)

同样在地址 字段的情况下,具有多个记录的相同用户已插入其地址值但是值不是特别相同的例如Mountville park Thomas gateMontlee park thonas gte.

我需要获取所有那些具有相同和几乎相似的值(不知何故)的地址城市的记录.

有没有办法让这些记录具有几乎相似但无法比拟的值?

谢谢.

java mysql

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

使用java Executor接口的多线程方法

我正在尝试使用执行器接口实现多线程方法,其中我在主类中生成了多个线程

class Main
{
    private static final int NTHREADS = 10;

    public static void main(String[] args)
    {
        .........
        String str = createThreads(document);
        .............
    }


    public String createThreads(String docString)
    {

        ........
        .......
        Map<String,String> iTextRecords = new LinkedHashMap<String, String>();
        if(!iText.matches(""))
        {
            String[] tokenizedItext = iText.split("\\^");
            ExecutorService executor = Executors.newFixedThreadPool(NTHREADS);
            for(int index = 0 ;index < tokenizedItext.length;index++)
            {
                Callable<Map<String,String>> worker = null;
                Future<Map<String,String>> map = null;
                if(tokenizedItext[index].matches("^[0-9.<>+-= ]+$") || tokenizedItext[index].matches("^\\s+$"))
                {
                    iTextRecords.put(tokenizedItext[index],tokenizedItext[index]);
                }
                else
                {
                    worker = new MultipleDatabaseCallable(tokenizedItext[index],language);
                    map = executor.submit(worker);
                    try …
Run Code Online (Sandbox Code Playgroud)

java multithreading executorservice

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

Error Occuring :: java.lang.OutOfMemoryError:Java堆空间

我正在尝试读取一个包含158000条记录(12MB)的文件,该文件由换行符分隔并将该记录放入mysql数据库中,但在插入大约49000条记录后,我的java程序抛出异常

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.jar.Manifest$FastInputStream.<init>(Manifest.java:315)
    at java.util.jar.Manifest$FastInputStream.<init>(Manifest.java:310)
    at java.util.jar.Manifest.read(Manifest.java:178)
    at java.util.jar.Manifest.<init>(Manifest.java:52)
    at java.util.jar.JarFile.getManifestFromReference(JarFile.java:167)
    at java.util.jar.JarFile.getManifest(JarFile.java:148)
    at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:696) at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:696)

    at java.net.URLClassLoader.defineClass(URLClassLoader.java:228)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:430) at com.mysql.jdbc.Util.handleNewInstance(Util.java:430)

    at com.mysql.jdbc.PreparedStatement.getInstance(PreparedStatement.java:553)
    at com.mysql.jdbc.ConnectionImpl.clientPrepareStatement(ConnectionImpl.java:1378)
    at com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4143)
    at com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4042)
    at loadcsvdatabase.LoadCsvDatabase.fnLoadCsvIntoMemory(LoadCsvDatabase.java:52)
    at loadcsvdatabase.LoadCsvDatabase.main(LoadCsvDatabase.java:29)
Run Code Online (Sandbox Code Playgroud)

Java代码插入数据

FileInputStream file;
        DataInputStream dataIn;
        BufferedReader bReader;
        Connection conn= openConnection();
        String strRecord=new String();
        String[]strSplittedRecord;
        file= new FileInputStream("D:\\Java\\CountryWhois.txt");
        dataIn= new DataInputStream(file);
        bReader= new …
Run Code Online (Sandbox Code Playgroud)

java exception

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

从基本数组中删除元素

我有一个原始类型数组,我想从中删除指定索引处的元素.这样做的正确有效方法是什么?

我希望以下面提到的方式删除元素

long[] longArr = {9,8,7,6,5};
int index = 1;

List list = new ArrayList(Arrays.asList(longArr));
list.remove(index);
longArr = list.toArray(); // getting compiler error Object[] can't be converted to long[]
Run Code Online (Sandbox Code Playgroud)

但上面的方法看起来只与Object一起使用而不与原语一起使用.

除此之外的其他选择?我不能使用任何第三方/额外的库

java arrays primitive-types

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