天道酬勤,学无止境

spring

Initial value to textarea field in form tld

I am using spring mvc and in my jsp page I have a form with textarea. I want the textarea to be pre filled with some text (it is an edit feature for article). I tried the following. <form:textarea id="description" path="article.description" value="${article.description}" onKeyUp="validationmethod($(this));" onKeyDown="validationmethod($(this));" /> But my textarea is still empty.. the value="" attribute works perfectly fine for <form:input> but not for text area. if i try to put it betweeen the tag then i get the warning "Form:textarea must not be empty". Please help.

2021-10-26 04:04:01    分类:问答    jquery   spring   jsp-tags   taglib

resteasy 在另一个服务中调用服务(resteasy invoke service inside another service)

问题 我有一个服务 X 和 Y。如果我想在 X 中调用 Y。有没有办法通过注释来做到这一点。 我不想为 X/Y 配置 bean,因为所有其他资源都是为 X 自动装配的。 谢谢! 回答1 Spring 只能注入托管实例: @Service public class X { @Resource private Y y; } @Service public class Y { } 如果您不喜欢将 @Service 添加到 Y 类,那么您可以使用它(X 将相同) @Configuration public class AppConfig { @Bean public Y y { return new Y(); } }

2021-10-26 03:19:46    分类:技术分享    web-services   spring   resteasy

Spring Security: Running the webapp causes an exception IncompatibleClassChangeError and an error 404 with the first page

I create a simple Spring Security WebApp for learning purpose, but when I am running it, I get an error 404. Follow my config files: web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" 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-app_2_5.xsd"> <servlet> <servlet-name>sdnext</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping>

2021-10-26 02:14:09    分类:问答    spring   spring-mvc   spring-security

<p:tabview> is not keeping track of data when page is reloaded in PrimeFaces 4.0

Hi I have some validation on my form (Java web application), and when the validation is displayed, it should reload the page. When it does this, I lose all the data input in the dropdown list in first tab.(Data in text boxes are retained) Below is how I define my tabview : <p:tabView id="tabView" dynamic="true"> Anyone can help on this? Thanks in Advance I am using PrimeFaces 4.0, spring, hibernate. <h:form prependId="false"> <p:panel> <h:panelGrid id="detail" columns="2" styleClass="grid"columnClasses="label,value"> <p:tabView id="tabView" dynamic="true" > <p:tab id="tab1" title="bUS Details"

2021-10-26 01:52:04    分类:问答    spring   jsf   primefaces

HttpClientErrorException 400 null 在微服务中使用 RestTemplate(HttpClientErrorException 400 null using RestTemplate in microServices)

问题 我有两个微服务。 第一个接收来自前端的调用,然后调用第二个 uService 以接收一些数据。 最后是返回错误响应(错误请求,这没关系 - 这是一个用例)。 但是,我丢失了从第二个微服务返回的正文(消息),因为第一个在调用中抛出 HttpClientErrorException 400 null 这是我的代码: ResponseEntity<MyEntity> entityResponse = restTemplate.getForEntity(url, MyEntity.class, id); 由于抛出异常,我无法执行entityResponse.getStatusCode() 。 在 ControllerAdvice 中处理它,即使我从服务返回自定义消息,我的异常消息也是“400 null”。 所以,我想得到在被调用的uservice 中发送的响应消息来管理它。 提前致谢。 回答1 我在我的项目中所做的是以下内容。 MicroService_2 调用 MicroService_1。 微服务_1 例如,如果未找到实体,MicroService_1 将返回 HTTP 404 异常。 @RestController @RequestMapping(value = "/api/v1/") public class Service1Controller {

2021-10-26 01:24:39    分类:技术分享    java   spring   rest   spring-mvc

is there any benefit of loading application context in root context and in servlet context?

I followed some spring mvc tutorial and my web.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" 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-app_2_5.xsd"> <!-- The definition of the Root Spring Container shared by all Servlets and Filters --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/root-context.xml, /WEB-INF/spring/appServlet/servlet-context.xml</param-value> </context

2021-10-26 01:09:35    分类:问答    xml   spring   spring-mvc   web-applications

Spring + Hibernate + Maven org.hibernate.MappingException: AnnotationConfiguration instance is required

I am new to Spring so as to Hibernate frameworks. The task is to create a project with both front and back ends, but for now I would like to focus on DB connection. I have MySQL database on localhost within my MySQL server. There is a simple application which needs to create clients, orders and search for them in the DB, so the task is trivial. Yet, I encounter the following ecxeption: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientDAOImpl': Injection of autowired dependencies failed; nested exception is org

2021-10-26 00:17:57    分类:问答    java   mysql   spring   hibernate   maven

Advise method error in Spring AOP

I'm trying to run an advise in a Spring AOP program but I keep getting this error: Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367) at com.sun.javafx.application.LauncherImpl

2021-10-26 00:15:35    分类:问答    java   spring   javafx   spring-aop

Spring AWS SQS Reconnect After Losing Connection

I am using Spring Cloud AWS (1.0.1.RELEASE) with Spring Boot to run a SQS consumer. The application runs fine, but when it looses network connection (for instance if I switch my WIFI off on my laptop when it runs on it), I see errors on the console and the application never recovers. It just hangs there and does not reconnect after the network becomes available. I have to kill it and bring it up. How do I force it to recover by itself? // Spring Boot entry point: public static void main(String[] args) { SpringApplication.run(MyConsumerConfiguration.class, args); } // Message Listener (A

2021-10-26 00:12:03    分类:问答    spring   amazon-web-services   amazon-sqs   spring-cloud

Spring 3 MVC:如何从表单中存储 € 符号?(Spring 3 MVC: How to store € symbol from form?)

问题 我使用 Spring 3 MVC 和 MySQL 5 作为我的数据库。 我使用 Spring 表单标签创建了一个表单,用于更新我的数据库中的对象。 我在此表单的文本输入字段之一中输入“票价:35 欧元”并保存该项目。 然后,当我在显示页面中查看该项目时,文本显示为“票价:?35”。 如果我使用 MySql 查询浏览器直接在数据库中输入“票价:35 欧元”,那么欧元符号在显示页面上显示正常。 我需要做什么才能让我的 Spring 表单将欧元符号正确保存到数据库中? 更新: 嗨,我尝试了你的建议,Bozho,但没有运气..我的 web.xml 看起来像这样: <filter> <filter-name>characterEncodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param

2021-10-26 00:07:17    分类:技术分享    java   spring   spring-mvc   character-encoding