Tag Archives: object

'append' called on an object that does not implement interface FormData

Questions: I’m Trying to upload image on with jquery and ajax. But weird thing happened here. In console Log its showing TypeError: ‘append’ called on an object that does not implement interface FormData. Please tell me what i did wrong here? JS script var prosrc=$(“#pro_pix img”).last().attr(“src”); $(“#logoform”).on(‘change’,function(event){ var postData = new FormData(this); $(“#pro_pix img”).last().hide(); $(“#pro_pix… Read More »

How to access JSON Object name/value?

Questions: function (data) { //add values based on activity type //data = JSON.parse(data); //alert(abc.Phone1); alert(data.myName) alert(data.toString()); if (activityType == “Phone”) { } return; }, As you can see this callback function of $.ajax taking JSON data from controller. For example: [{“name”:”myName” ,”address”: “myAddress” }] In this case my first alert giving me undefined and second/third… Read More »

Posting JSON objects to Symfony 2

Questions: I’m working on a project using Symfony 2, I’ve built a bundle to handle all my database services which passes JSON data back and forward. My Problem/Question: Is it possible to post a straight up JSON object? Currently I’m spoofing a normal form post for my ajax calls by giving the object a name… Read More »

How to not serialize the __type property on JSON objects

Questions: Every object I return from a WebMethod of a ScriptService is wrapped into a JSON object with the data in a property named d. That’s ok. But I don’t want the additional __type property to be served to the client, since I do manual processing with jQuery. Is it possible? Answers: Well it’s been… Read More »

What's the best way to share business object instances between Java web apps using JBoss and Spring?

Questions: We currently have a web application loading a Spring application context which instantiates a stack of business objects, DAO objects and Hibernate. We would like to share this stack with another web application, to avoid having multiple instances of the same objects. We have looked into several approaches; exposing the objects using JMX or… Read More »

Should I mark object attributes as volatile if I init them in @PostConstruct in Spring Framework?

Questions: Suppose, that I do some initialization in Spring singleton bean @PostConstruct (simplified code): @Service class SomeService { public Data someData; // not final, not volatile public SomeService() { } @PostConstruct public void init() { someData = new Data(….); } } Should I worry about someData visibility to other beans and mark it volatile? (suppose… Read More »

Simple center a object with css and no hacks

Questions: I want to center an object using CSS and no hacks, is this possible and how? I have tried this, but than my p tag is gone. .centered { position: fixed; top: 50%; left: 50%; } Answers: There’s several ways to center an element. But it depends on what your element is and how… Read More »

receiving json and deserializing as List of object at spring mvc controller

Questions: My code is as below: controller @RequestMapping(value=”/setTest”, method=RequestMethod.POST, consumes=”application/json”) public @ResponseBody ModelMap setTest(@RequestBody List<TestS> refunds, ModelMap map) { for(TestS r : refunds) { System.out.println(r.getName()); } // other codes } TestS pojo public class TestS implements Serializable { private String name; private String age; //getter setter } Json request var z = ‘[{“name”:”1″,”age”:”2″},{“name”:”1″,”age”:”3″}]’; $.ajax({ url:… Read More »

spring security: NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.security.config.annotation.ObjectPostProcessor] found

Questions: I’m trying to add spring-security to my rest app. I followed the tutorial (https://spring.io/guides/tutorials/spring-security-and-angular-js/) on spring website to do it but there it uses spring-boot component which I don’t want to use, maybe problem is here. My security configuration is here: @Configuration @Order(2147483636) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http)… Read More »