Search Posts

Category: spring

Getting a user by id in JHipster

I have an issue with this. Some of the entities I created have a relationship with the User table. As such, they contain a field called userId. On the page on which I’m detailing them, I’d wish to show the User’s username, not his ID(for example a review page, it would look better if it said “post by ragnarthered” rather than “post by 337). As you know, generating a JHipster app comes with a function […]

Export and Import File: Back-end or Front-end?

I’m confused about doing exporting in the back-end or front-end. For example in export: Using Spring and JPA Get data (repository) return ModelAndView (controller) in csv format using super-csv But this approach(export to csv) can also be done in angularjs. Request data(service) using javascript or other available api. In my case I’m using only javascript. return json data converted to csv file. downloaded as text/csv. I’m a beginner in this exporting process. I searched on […]

Required request part is not present – Spring

I am trying to pass the attached file information to the spring controller from agularjs controller. I am facing issues while passing the information from angularjs to spring controller, it is throwing the error on the browser console and not calling the spring controller. Error message: error : “Required request part ‘ad’ is not present” status : 500 Below is the sample code i have used in my application to send the attached files and […]

Conncet Rest API with Angularjs

I have written a rest api using Spring Boot and made a login page in angular js. Here is the plunker link for my angular page. And here is my rest api controller @RestController @RequestMapping(“login”) public class BikeController { @GetMapping public List<Bike> list(){ List<Bike> bikes = new ArrayList<>(); return bikes; } How do i connect my controller to the Angular js UI Source: AngularJS

how to pass the selected files from angular controller to spring controller [duplicate]

This question already has an answer here: File Upload using AngularJS 28 answers How to POST binary files with AngularJS (with DEMO) 1 answer I am working on angularjs and springmvc. I am trying to send an email with attachments to the users. I am successful in sending the email without attachements with the below code: html: <div ng-controller=”BaseController”> <div class=”modal-body”> <div class=”row” > <label>From: <span style=”color:red;”>*</span> </label> <input type=”email” style=”alignment: right” name=”fromEmail” ng-model=”fromEmail” required></inputtext> […]

Uploading file with other parameters in spring controller

I am unable to send the multipart file and two text fields from angular post request to spring controller. My post request is like follows, $ = { “file”: $scope.uploadFile, “doucmentType” : $scope.documentType, “otherDocumentType” : $scope.otherDocumentType } where $scope.uploadFile is the file object, doucmnetType and otherDocumentType are two text fields that I wish to send to spring controller with the file. The post request is as follows, $ + ‘/temp/uploadAttachments’,JSON.stringify($ ).success(function(result) { }); My spring […]

Getting null value in spring controller when passing data from angular client

I have an angular client from which i am calling spring RestController.When i pass the data from postman i am getting the values in spring controller but when i pass data from client to controller. /** * service */ app.factory(‘Userservice’,function($http){ var userservice={} userservice.Signup=function(user){ console.log(“In User service Signup”,user) return $“http://localhost:8080/Niit-Social/Signup”, user) } userservice.Login=function(user){ console.log(“In User service Login”,user) return $“http://localhost:8080/Niit-Social/Login”, user) } return userservice; }) /** * Controller */ app.controller(‘Userctrl’,function($scope,Userservice, $location,$rootScope,$cookieStore) { $scope.Signup=function(user) { console.log(“In User controller […]

Webservice not returning correct date format

I am calling a webservice to get date . Date returned to to the UI is in format 1530158400000 but i need it in “2018-06-12” how can i do this. My UI is angular js and the webservice that returns the response object( out DTO)has “protected Date trdDate” . My hibernate query criteria returns correct format “2018-06-12” response object in the web-service also has correct format. But when i check the response in UI it […]

template URL in angular always calling the path variable requesting mapping in spring

I’m using the Angular UI-router to navigate between pages, and my app.js file looks like below: var businessApp = angular.module(‘businessApp’, [ ‘ui.router’ ]); businessApp.config(function($stateProvider, $urlRouterProvider) { // $urlRouterProvider.otherwise(‘/’); $stateProvider // HOME STATES AND NESTED VIEWS ======================================== .state(‘home’, { url : ‘/’ }) .state(‘index’, { url : ‘/’, templateUrl : ‘index’, controller : ‘dashboardController’ }); }); and my spring controller request mapping looks like below: @RequestMapping(value=”/home/{name}/{id}”, method=RequestMethod.GET) public String loadHomePage(@PathVariable String name, @PathVariable String id) { […]

POST resquest not accepted while GET is being accepted

I am trying to make a http call from angularjs in spring controller and post json data but I am getting this error in angularjs : angular.js:10661 POST http://localhost:8080/shopng/product/add 404 (Not Found) (anonymous) @ angular.js:10661 sendReq @ angular.js:10480 serverRequest @ angular.js:10187 processQueue @ angular.js:14634 (anonymous) @ angular.js:14650 $eval @ angular.js:15916 $digest @ angular.js:15727 $apply @ angular.js:16024 (anonymous) @ angular.js:23416 eventHandler @ angular.js:3293 product_service.js:35 Error while adding product product_controller.js:30 {productName: “ads”, productPrice: 34, description: “ads”, imageUrl: […]

Next Page »