Showing posts with label playframework. Show all posts
Showing posts with label playframework. Show all posts

Thursday, May 3, 2012

jQuery JSON response always triggers a ParseError


I am trying to preform some basic operations with jQuery and JSON. Presently having difficulty with jQuery accepting JSON response from my play framework application. Below is a simplified version of the code that still produces the error.

Sunday, March 11, 2012

Friday, February 24, 2012

Render images by java code or read images from a static path?


Here's my code:



1.Java Code:




public static void getImg(Long itemId) {
try {
Item item = Item.findById(itemId);
if (item.img != null && item.img.getFile() != null{
response.setContentTypeIfNotSet(item.img.type());
renderBinary(item.img.get());
}
} catch (Exception e) {
Logger.error("Can't find image,itemId = " + itemId);
}
}

html : < img src="@{{ Items.getImage(123)}}"/>