Dynamic for with Spring MVC using a HashMap
Sometime you need to dynamically generate a form without knowing how many fields it will be required (i.e. when your form is driven by a configuration or by some properties). […]
Sometime you need to dynamically generate a form without knowing how many fields it will be required (i.e. when your form is driven by a configuration or by some properties). […]
Suppose you defined TemplateDao Spring bean in this way: <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property> <property name="url"><value>jdbc:mysql://${mysql.hostname}:${mysql.port}/${mysql.db}</value></property> <property name="username"><value>${mysql.user}</value></property> <property name="password"><value>${mysql.password}</value></property> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> […]
Sometime happens get a list of object from database and, to do that without call a RowMapper, use this: List<Object> strings = (List<Object>) jdbcTemplate.queryForList(query, Object.class);List<Object> strings = (List<Object>) jdbcTemplate.queryForList(query, Object.class); […]
I was trying to figured out how to solve this issue. Basically I’m saving a user profile bean that contains multiple occurrences of other beans inside him. Something like date: […]
If the exception “Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/schema” is raised probably you forgot to add the <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property><property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property> property […]
Today I updated an old Spring MVC application to Apache Tomcat 7 and some other newer jars and, when I started it, I get this error: SEVERE: Servlet.service() for servlet […]
To download a remote file (like a PDF) redirecting to response output, use these instructions to update a your Spring MVC controller: @RequestMapping(value="/viewAttach", method = RequestMethod.GET) public ModelAndView viewAttach(@RequestParam(value="article_id", required […]
The requirement is very simple. Route an XML message from rabbitMQ to MongoDB. MongoDB BSON as the data storage and network transfer format for “documents”. BSON is a binary-encoded serialization […]
Define a RabbitMQ broker endpoint in Camel is possible with the Bluelock camel-spring-amqp (https://github.com/Bluelock/camel-spring-amqp) library. It’s an Apache Camel component that allows to natively communicate with a RabbitMQ broker and […]
To extract two or more object (in this sample two Integer) from a DB and putting into a map, use this: final Map<Integer,Integer> topic = new HashMap<Integer,Integer>(); getJdbcTemplate().query(sqlCommand, new […]