我在Java-spring-mvc框架中使用angular1。从前端服务/控制器中,我需要将2种不同类型的对象传递给java-backend-controller。例如,假设我的2个对象是:
self.basicBean = {id: null, name: self.fileInfo.fileLocation};
self.delimiterToChk = {name:'', value:self.delimiter}
我当前的看到错误的javascript控制器是:
return $http.post( 'submenu/layout/guess/' + clientId + '/' + maxColumns + "/" + origin ,
delimiterObj,
folderPathBean)
.then(
function( response )
{
return response.data;
},
function( errResponse )
{
console.error( 'Error while guessFieldLayout' );
return $q.reject( errResponse );
}
);
我的后端java控制器看起来像:
@RequestMapping( value = "/layout/guess/{clientId}/{maxColumns}/{origin}", method = RequestMethod.POST )
public ResponseEntity<?> guessFieldLayout( @PathVariable( "clientId" ) long clientId,
@PathVariable( "maxColumns" ) int maxColumns,
@RequestBody Delimiter delimiterObj,
@PathVariable( "origin" ) String origin,
@RequestBody BasicBean basicBeanFolderPath )
{
try{}
}
我看到400错误,并且猜测是因为我不打算将对象作为2 Request正文发送。但是,如何将其放在一个请求主体中以及如何在Java控制器端将其映射?有没有可用的示例?