小编Bal*_*usC的帖子

ViewParam vs @ManagedProperty(value ="#{param.id}")

定义View Params之间有什么区别:

<f:metadata>
  <f:viewParam name="id" value="#{someBean.id}"/>
</f:metadata>
Run Code Online (Sandbox Code Playgroud)

并在ManagedBean中定义属性,如下所示:

@ManagedProperty(value = "#{param.id}")
private Integer id;
Run Code Online (Sandbox Code Playgroud)

jsf jsf-2 managed-bean viewparams managed-property

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

如何在基于servlet的Web应用程序中运行后台任务?

我正在使用Java,我想在我的应用程序中保持servlet不断运行,但我不知道怎么做.我的servlet有一个方法,它每天从数据库中提供用户的计数以及整个数据库中用户的总数.所以我想保持servlet不断运行.

multithreading servlets background-process java-ee scheduledexecutorservice

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

Spring Hibernate - 无法为当前线程获取事务同步的Session

我用spring + hibernate创建了一个应用程序,但我总是遇到这个错误.这是我第一次使用hibernate的应用程序,我读了一些指南,但我无法解决这个问题.我哪里做错了?

这是我的应用程序的代码

ott 05, 2014 4:03:06 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
Informazioni: Refreshing   org.springframework.context.support.ClassPathXmlApplicationContext@1eab16b: startup date  [Sun Oct 05 16:03:06 CEST 2014]; root of context hierarchy
ott 05, 2014 4:03:06 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
Informazioni: Loading XML bean definitions from class path resource [springConfig.xml]
ott 05, 2014 4:03:08 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
ott 05, 2014 4:03:08 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.6.Final}
ott 05, 2014 4:03:08 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found …
Run Code Online (Sandbox Code Playgroud)

spring hibernate spring-mvc spring-orm

92
推荐指数
4
解决办法
17万
查看次数

策略模式和依赖注入之间有什么区别?

策略模式和依赖注入都允许我们在运行时设置/注入对象.策略模式和依赖注入之间有什么区别?

design-patterns dependency-injection strategy-pattern

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

Spring ApplicationContext - 资源泄漏:'context'永远不会关闭

在spring MVC应用程序中,我使用以下方法初始化其中一个服务类中的变量:

ApplicationContext context = 
         new ClassPathXmlApplicationContext("META-INF/userLibrary.xml");
service = context.getBean(UserLibrary.class);
Run Code Online (Sandbox Code Playgroud)

UserLibrary是我在我的应用程序中使用的第三方实用程序.上面的代码为'context'变量生成警告.警告如下所示:

Resource leak: 'context' is never closed
Run Code Online (Sandbox Code Playgroud)

我不明白这个警告.由于应用程序是一个Spring MVC应用程序,因此当我在应用程序运行时引用该服务时,我无法真正关闭/销毁上下文.试图告诉我的警告究竟是什么?

java eclipse spring spring-mvc

91
推荐指数
4
解决办法
7万
查看次数

java.lang.IllegalStateException:在提交响应后不能(转发| sendRedirect |创建会话)

抛出此方法

java.lang.IllegalStateException:在提交响应后无法转发

我无法发现问题.有帮助吗?

    int noOfRows = Integer.parseInt(request.getParameter("noOfRows"));
    String chkboxVal = "";
    // String FormatId=null;
    Vector vRow = new Vector();
    Vector vRow1 = new Vector();
    String GroupId = "";
    String GroupDesc = "";
    for (int i = 0; i < noOfRows; i++) {
        if ((request.getParameter("chk_select" + i)) == null) {
            chkboxVal = "notticked";
        } else {
            chkboxVal = request.getParameter("chk_select" + i);
            if (chkboxVal.equals("ticked")) {
                fwdurl = "true";
                Statement st1 = con.createStatement();
                GroupId = request.getParameter("GroupId" + i);
                GroupDesc = request.getParameter("GroupDesc" + i); …
Run Code Online (Sandbox Code Playgroud)

servlets response forward illegalstateexception requestdispatcher

90
推荐指数
3
解决办法
26万
查看次数

如何解决:找不到"http://java.sun.com/jsp/jstl/core"的标记库描述符

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.library.controller.*"%>
<%@ page import="com.library.dao.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.util.Date" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Return Page</title>
</head>
<body bgcolor="#aabcde">
<div align="right"><a href="Login.jsp">Logout</a></div>
<table align="center" border="2" cellspacing="3" cellpadding="3">
<tr><th>BookID</th><th>BookName</th><th>Issuedate</th><th>returndate</th></tr>
<c:forEach var="element" items="${list}">
    <tr>
        <td>${element.getBookid}</td><td>${element.getBookname()}</td>  
        <td>${element.getIssuedate()}</td><td>${element.getReturndate()}</td>
    </tr>
</c:forEach>
Run Code Online (Sandbox Code Playgroud)

Eclipse IDE显示红色下划线,当我关注它时,标记是:找不到http://java.sun.com/jsp/jstl/core的库描述符

java jsp jstl

90
推荐指数
6
解决办法
29万
查看次数

如何在BigDecimal上使用>,=,<等比较运算符

我有一个domainPrice设置为BigDecimal数据类型的域类.现在我正在尝试创建一个比较价格的方法,但似乎我不能在BigDecimal数据类型中有比较运算符.我是否必须更改数据类型或是否有其他方法?

java spring bigdecimal operator-keyword

88
推荐指数
8
解决办法
13万
查看次数

在JSF 2中使用faces-config.xml有什么用?

在JSF 2对注释的大力支持之后,我想知道我将使用它faces-config.xml.它现在的重要性是什么?

换句话说,只能faces-config.xml通过注释而不是通过注释完成哪些配置?

现在我用它的所有东西都是声明Spring的EL解析器.

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <application>
        <el-resolver>
            org.springframework.web.jsf.el.SpringBeanFacesELResolver
        </el-resolver>
    </application> 
</faces-config>
Run Code Online (Sandbox Code Playgroud)

jsf faces-config jsf-2

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

在"正在更新Maven项目"期间发生内部错误.显示java.lang.NullPointerException

我正在开发一个Java EE Web项目.当我尝试添加依赖项时,会出现此错误消息.我使用Eclipse Kepler.

在"正在更新Maven项目"期间发生内部错误.显示java.lang.NullPointerException

你可以帮帮我吗?谢谢.

在此输入图像描述

eclipse m2eclipse java-ee maven

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