git config --global credential.helper wincred
git push
Thursday, March 31, 2016
Monday, March 28, 2016
Windows wireless service is not running on this computer in Windows 10
Run the following commands in the command prompt as Administrator to fix the issue in Windows 10. A system restart will be required.
netsh winsock reset catalog
netsh int ip reset reset.log hit
netsh winsock reset catalog
netsh int ip reset reset.log hit
Sunday, March 27, 2016
BindingResult result follows validated object
BindingResult result has to follow the object show that it binds to properly validate the inputs. Otherwise, you'll get an exception similar to "field error in object on field rejected value codes".
@RequestMapping(value={"/addnewshow", "/editshow"}, method=RequestMethod.POST)
public String processShow(@Valid @ModelAttribute("show") Show show, BindingResult result,
@RequestParam(value="showid", required=false) Long showId)
{
if(result.hasErrors()){
return "myapp.editshow";
}
else{
show.setId(showId);
show = showService.save(show);
}
return "redirect:editshow.html?showid=" + show.getId();
}
@RequestMapping(value={"/addnewshow", "/editshow"}, method=RequestMethod.POST)
public String processShow(@Valid @ModelAttribute("show") Show show, BindingResult result,
@RequestParam(value="showid", required=false) Long showId)
{
if(result.hasErrors()){
return "myapp.editshow";
}
else{
show.setId(showId);
show = showService.save(show);
}
return "redirect:editshow.html?showid=" + show.getId();
}
Friday, March 25, 2016
Thursday, March 24, 2016
Wednesday, March 16, 2016
Querystring or Model values
<c:set var="showId" value="${param.showid}"/>
~
<c:set var="showId" value="${show.getId()}"/>
~
<c:set var="showId" value="${show.getId()}"/>
Monday, March 14, 2016
Java Config dataSourceInitializer
@Value("classpath:db/sql/insert-data.sql")
private org.springframework.core.io.Resource DATA_SCRIPT;
@Bean
public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
final DataSourceInitializer initializer = new DataSourceInitializer();
initializer.setDataSource(dataSource);
initializer.setDatabasePopulator(databasePopulator());
return initializer;
}
private DatabasePopulator databasePopulator() {
final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
populator.addScript(DATA_SCRIPT);
return populator;
}
OR
populator.addScript(new ClassPathResource("db/sql/insert-data.sql"));
private org.springframework.core.io.Resource DATA_SCRIPT;
@Bean
public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
final DataSourceInitializer initializer = new DataSourceInitializer();
initializer.setDataSource(dataSource);
initializer.setDatabasePopulator(databasePopulator());
return initializer;
}
private DatabasePopulator databasePopulator() {
final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
populator.addScript(DATA_SCRIPT);
return populator;
}
OR
populator.addScript(new ClassPathResource("db/sql/insert-data.sql"));
Sunday, March 13, 2016
Subscribe to:
Posts (Atom)