小编Ale*_*lex的帖子

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万
查看次数

Spring:@SessionAttributes vs HttpSession

@SessionAttributes和HttpSession有什么区别?这两个中的哪一个在会话中保留更长时间的对象?在哪些情况下,我必须使用一个,在另一个情况下?

谢谢

spring spring-mvc

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

如何计算JSTL中总和的总和

如何通过JSP和JSTL实现这一点?

int total = 0;
for (Article article : list) {
    total += article.price;
}
Run Code Online (Sandbox Code Playgroud)

foreach jsp jstl sum

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

Netbeans 7.3.1添加服务器Glassfish 4.1

我将Glassfish服务器从4.0更新到4.1但现在如果我在Netbeans 7.3中添加它,我有"不是有效的GlassFish Server安装".Netbeans没有找到Glassfish.如何在不安装Glassfish 8.0.1的情况下解决?

netbeans java-ee glassfish-3 netbeans-7 glassfish-4

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

Spring:new() 运算符和自动装配在一起

如果我使用Spring,这两种方法哪个更正确。即使我使用了双亲注入,我也可以使用 new() 运算符吗?我可以混合使用两者吗?我想对这些概念做一些澄清。谢谢

第一种方法:

@RequestMapping(method=RequestMethod.GET)
public String create(Model model){
 model.addAttribute(new User());
 return "index";
}
Run Code Online (Sandbox Code Playgroud)

第二种方法:

@Autowired
User user;

@RequestMapping(method=RequestMethod.GET)
public String create(Model model){
 model.addAttribute(user);
 return "index";
}
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc jakarta-ee

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

Spring:Lookup方法注入、Provider&lt;T&gt;、ObjectFactory和factoryBean之间的区别

Lookup 方法注入Provider<T>ObjectFactoryfactoryBean. 如果我想要将原型的新实例(多次)转换为单例,那么哪一个是最佳解决方案?如果我想要将原型 bean 的新实例(多次)转换为原型?

spring spring-mvc

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

将输入标记值传递给href参数

我想将输入标记的值作为参数(quantita)传递给href.我应该用javascript来做这件事吗?抱歉,我的英文谢谢

<input type="text" id="qta_field" value="${item.value}"/><a href="updateItem?codice=${item.key.codice}&quantita=">update</a>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

html javascript

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

对齐图例标记内的两个元素

如何将图像与文本对齐?

截图

<fieldset>
  <legend>
    <img src="http://www.placehold.it/50" width="50" height="50" />
    <label id="dettagli_ordine">Dettagli Ordine N° ${numero_ordine}</label>
  </legend>
</fieldset>
Run Code Online (Sandbox Code Playgroud)

html css

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

在Eclipse Luna中安装spring插件

我下载了Eclipse Luna,我想安装spring的插件有什么区别:Spring IDE插件和Spring工具套件插件?我应该下载哪一个?

Eclipse + Spring Tool套件插件= Spring Tool Suite发布?

eclipse spring eclipse-plugin java-ee spring-tool-suite

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

Spring mvc资源不起作用

我使用Eclipse Luna创建了一个简单的Spring MVC项目,但是如果我在springConfig-servlet.xml中添加mvc:resources,它就无法工作.我在Tomcat中有这个错误:

 PM org.springframework.web.servlet.PageNotFound noHandlerFound
Avvertenza: No mapping found for HTTP request with URI [/SpringStore/] in   DispatcherServlet with name 'springConfig'
Run Code Online (Sandbox Code Playgroud)

我哪里做错了?谢谢

这是我项目的结构

在此输入图像描述

Web.xml代码

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>SpringStore</display-name>

<servlet>
  <servlet-name>springConfig</servlet-name>
  <servlet-class> org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
  <servlet-name>springConfig</servlet-name>
   <url-pattern>/</url-pattern> 
</servlet-mapping> 
</web-app>
Run Code Online (Sandbox Code Playgroud)

springConfig-Servlet代码:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/jsp/"/>
    <property name="suffix" value=".jsp"/>
</bean>

<context:component-scan base-package="controller"/>
<mvc:resources mapping="/resources/**" location="/resources/"/>
</beans>
Run Code Online (Sandbox Code Playgroud)

HomeController.java …

spring spring-mvc java-ee

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