Why the String inside Controller not printing anything?
I am trying to send Image and Id using retrofit for that i am sending Multipart file and String.
This is my Upload Method on Android side ->
private void UploadFiles() {
File uploadFile = fileArrayList.get(0);
if (uploadFile != null) {
Log.d(TAG, "UploadFiles: File Name is -> " + uploadFile.getName());
// Parsing any Media type file
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile);
// MultipartBody.Part is used to send also the actual file name
MultipartBody.Part cropImage = MultipartBody.Part.createFormData("cropImage", uploadFile.getName(), requestFile);
RequestBody cropId = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile.getParentFile().getName());
Api.uploadCropImage(cropImage,cropId, new Callback<BasicResponse>() {
@Override
public void onResponse(Call<BasicResponse> call, Response<BasicResponse> response) {
if (response.body() != null) {
Log.d(TAG, "onResponse: Success" + response.body().getResponse());
}
else{
Log.d(TAG, "onResponse: null Response");
}
}
@Override
public void onFailure(Call<BasicResponse> call, Throwable t) {
Log.d(TAG, "onResponse: Failure");
}
});
}
}
My Upload CropImage Method ->
public static void uploadCropImage(MultipartBody.Part multipartBody,RequestBody cropId,
Callback<BasicResponse> callback) {
UploadCropImageApi uploadCropImageApi = retrofit.create(UploadCropImageApi.class);
Call<BasicResponse> call = uploadCropImageApi.uploadCropImage(multipartBody,cropId);
call.enqueue(callback);
}
My Interface ->
public interface UploadCropImageApi {
@Multipart
@POST(UPLOAD_FILE_TO_AWS_URL)
Call<BasicResponse> uploadCropImage(@Part MultipartBody.Part cropImage, @Part("cropId") RequestBody cropId);
}
This is my Spring Controller, What's wrong with it? It's not printing cropId.
@RequestMapping(value = "/UploadCropImage", method = RequestMethod.POST, consumes = {"multipart/form-data"})
@ResponseBody
public String UploadImage(@RequestBody MultipartFile cropImage,@RequestBody String cropId ,HttpServletRequest request) {
System.out.println("String is -> " + cropId);
return null;
}
java

|
show 4 more comments
I am trying to send Image and Id using retrofit for that i am sending Multipart file and String.
This is my Upload Method on Android side ->
private void UploadFiles() {
File uploadFile = fileArrayList.get(0);
if (uploadFile != null) {
Log.d(TAG, "UploadFiles: File Name is -> " + uploadFile.getName());
// Parsing any Media type file
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile);
// MultipartBody.Part is used to send also the actual file name
MultipartBody.Part cropImage = MultipartBody.Part.createFormData("cropImage", uploadFile.getName(), requestFile);
RequestBody cropId = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile.getParentFile().getName());
Api.uploadCropImage(cropImage,cropId, new Callback<BasicResponse>() {
@Override
public void onResponse(Call<BasicResponse> call, Response<BasicResponse> response) {
if (response.body() != null) {
Log.d(TAG, "onResponse: Success" + response.body().getResponse());
}
else{
Log.d(TAG, "onResponse: null Response");
}
}
@Override
public void onFailure(Call<BasicResponse> call, Throwable t) {
Log.d(TAG, "onResponse: Failure");
}
});
}
}
My Upload CropImage Method ->
public static void uploadCropImage(MultipartBody.Part multipartBody,RequestBody cropId,
Callback<BasicResponse> callback) {
UploadCropImageApi uploadCropImageApi = retrofit.create(UploadCropImageApi.class);
Call<BasicResponse> call = uploadCropImageApi.uploadCropImage(multipartBody,cropId);
call.enqueue(callback);
}
My Interface ->
public interface UploadCropImageApi {
@Multipart
@POST(UPLOAD_FILE_TO_AWS_URL)
Call<BasicResponse> uploadCropImage(@Part MultipartBody.Part cropImage, @Part("cropId") RequestBody cropId);
}
This is my Spring Controller, What's wrong with it? It's not printing cropId.
@RequestMapping(value = "/UploadCropImage", method = RequestMethod.POST, consumes = {"multipart/form-data"})
@ResponseBody
public String UploadImage(@RequestBody MultipartFile cropImage,@RequestBody String cropId ,HttpServletRequest request) {
System.out.println("String is -> " + cropId);
return null;
}
java

you mean your output is just "String is -> " ? or doesn't it print anything?
– Stultuske
Nov 20 '18 at 10:30
@Stulttuske,Does not print anything. It just prints some numbers.
– Avi Patel
Nov 20 '18 at 10:30
check whether or not that code is called at all. maybe you are looking in the wrong console. System.out.println will print on the console of the system it runs on. do you run this code on a server?
– Stultuske
Nov 20 '18 at 10:31
It calls only when there is one argument, which is Multipart file. but when i add String parameter it just doesn't print anything. The Response that's been printed on Console is like this 108 1 1 1 0
– Avi Patel
Nov 20 '18 at 10:33
@Stultuske, i have checked it with Postman and it works when there is only multipart file parameter. Am i doing something wrong passing String Ardument?
– Avi Patel
Nov 20 '18 at 10:35
|
show 4 more comments
I am trying to send Image and Id using retrofit for that i am sending Multipart file and String.
This is my Upload Method on Android side ->
private void UploadFiles() {
File uploadFile = fileArrayList.get(0);
if (uploadFile != null) {
Log.d(TAG, "UploadFiles: File Name is -> " + uploadFile.getName());
// Parsing any Media type file
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile);
// MultipartBody.Part is used to send also the actual file name
MultipartBody.Part cropImage = MultipartBody.Part.createFormData("cropImage", uploadFile.getName(), requestFile);
RequestBody cropId = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile.getParentFile().getName());
Api.uploadCropImage(cropImage,cropId, new Callback<BasicResponse>() {
@Override
public void onResponse(Call<BasicResponse> call, Response<BasicResponse> response) {
if (response.body() != null) {
Log.d(TAG, "onResponse: Success" + response.body().getResponse());
}
else{
Log.d(TAG, "onResponse: null Response");
}
}
@Override
public void onFailure(Call<BasicResponse> call, Throwable t) {
Log.d(TAG, "onResponse: Failure");
}
});
}
}
My Upload CropImage Method ->
public static void uploadCropImage(MultipartBody.Part multipartBody,RequestBody cropId,
Callback<BasicResponse> callback) {
UploadCropImageApi uploadCropImageApi = retrofit.create(UploadCropImageApi.class);
Call<BasicResponse> call = uploadCropImageApi.uploadCropImage(multipartBody,cropId);
call.enqueue(callback);
}
My Interface ->
public interface UploadCropImageApi {
@Multipart
@POST(UPLOAD_FILE_TO_AWS_URL)
Call<BasicResponse> uploadCropImage(@Part MultipartBody.Part cropImage, @Part("cropId") RequestBody cropId);
}
This is my Spring Controller, What's wrong with it? It's not printing cropId.
@RequestMapping(value = "/UploadCropImage", method = RequestMethod.POST, consumes = {"multipart/form-data"})
@ResponseBody
public String UploadImage(@RequestBody MultipartFile cropImage,@RequestBody String cropId ,HttpServletRequest request) {
System.out.println("String is -> " + cropId);
return null;
}
java

I am trying to send Image and Id using retrofit for that i am sending Multipart file and String.
This is my Upload Method on Android side ->
private void UploadFiles() {
File uploadFile = fileArrayList.get(0);
if (uploadFile != null) {
Log.d(TAG, "UploadFiles: File Name is -> " + uploadFile.getName());
// Parsing any Media type file
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile);
// MultipartBody.Part is used to send also the actual file name
MultipartBody.Part cropImage = MultipartBody.Part.createFormData("cropImage", uploadFile.getName(), requestFile);
RequestBody cropId = RequestBody.create(MediaType.parse("multipart/form-data"), uploadFile.getParentFile().getName());
Api.uploadCropImage(cropImage,cropId, new Callback<BasicResponse>() {
@Override
public void onResponse(Call<BasicResponse> call, Response<BasicResponse> response) {
if (response.body() != null) {
Log.d(TAG, "onResponse: Success" + response.body().getResponse());
}
else{
Log.d(TAG, "onResponse: null Response");
}
}
@Override
public void onFailure(Call<BasicResponse> call, Throwable t) {
Log.d(TAG, "onResponse: Failure");
}
});
}
}
My Upload CropImage Method ->
public static void uploadCropImage(MultipartBody.Part multipartBody,RequestBody cropId,
Callback<BasicResponse> callback) {
UploadCropImageApi uploadCropImageApi = retrofit.create(UploadCropImageApi.class);
Call<BasicResponse> call = uploadCropImageApi.uploadCropImage(multipartBody,cropId);
call.enqueue(callback);
}
My Interface ->
public interface UploadCropImageApi {
@Multipart
@POST(UPLOAD_FILE_TO_AWS_URL)
Call<BasicResponse> uploadCropImage(@Part MultipartBody.Part cropImage, @Part("cropId") RequestBody cropId);
}
This is my Spring Controller, What's wrong with it? It's not printing cropId.
@RequestMapping(value = "/UploadCropImage", method = RequestMethod.POST, consumes = {"multipart/form-data"})
@ResponseBody
public String UploadImage(@RequestBody MultipartFile cropImage,@RequestBody String cropId ,HttpServletRequest request) {
System.out.println("String is -> " + cropId);
return null;
}
java

java

asked Nov 20 '18 at 10:25


Avi PatelAvi Patel
879
879
you mean your output is just "String is -> " ? or doesn't it print anything?
– Stultuske
Nov 20 '18 at 10:30
@Stulttuske,Does not print anything. It just prints some numbers.
– Avi Patel
Nov 20 '18 at 10:30
check whether or not that code is called at all. maybe you are looking in the wrong console. System.out.println will print on the console of the system it runs on. do you run this code on a server?
– Stultuske
Nov 20 '18 at 10:31
It calls only when there is one argument, which is Multipart file. but when i add String parameter it just doesn't print anything. The Response that's been printed on Console is like this 108 1 1 1 0
– Avi Patel
Nov 20 '18 at 10:33
@Stultuske, i have checked it with Postman and it works when there is only multipart file parameter. Am i doing something wrong passing String Ardument?
– Avi Patel
Nov 20 '18 at 10:35
|
show 4 more comments
you mean your output is just "String is -> " ? or doesn't it print anything?
– Stultuske
Nov 20 '18 at 10:30
@Stulttuske,Does not print anything. It just prints some numbers.
– Avi Patel
Nov 20 '18 at 10:30
check whether or not that code is called at all. maybe you are looking in the wrong console. System.out.println will print on the console of the system it runs on. do you run this code on a server?
– Stultuske
Nov 20 '18 at 10:31
It calls only when there is one argument, which is Multipart file. but when i add String parameter it just doesn't print anything. The Response that's been printed on Console is like this 108 1 1 1 0
– Avi Patel
Nov 20 '18 at 10:33
@Stultuske, i have checked it with Postman and it works when there is only multipart file parameter. Am i doing something wrong passing String Ardument?
– Avi Patel
Nov 20 '18 at 10:35
you mean your output is just "String is -> " ? or doesn't it print anything?
– Stultuske
Nov 20 '18 at 10:30
you mean your output is just "String is -> " ? or doesn't it print anything?
– Stultuske
Nov 20 '18 at 10:30
@Stulttuske,Does not print anything. It just prints some numbers.
– Avi Patel
Nov 20 '18 at 10:30
@Stulttuske,Does not print anything. It just prints some numbers.
– Avi Patel
Nov 20 '18 at 10:30
check whether or not that code is called at all. maybe you are looking in the wrong console. System.out.println will print on the console of the system it runs on. do you run this code on a server?
– Stultuske
Nov 20 '18 at 10:31
check whether or not that code is called at all. maybe you are looking in the wrong console. System.out.println will print on the console of the system it runs on. do you run this code on a server?
– Stultuske
Nov 20 '18 at 10:31
It calls only when there is one argument, which is Multipart file. but when i add String parameter it just doesn't print anything. The Response that's been printed on Console is like this 108 1 1 1 0
– Avi Patel
Nov 20 '18 at 10:33
It calls only when there is one argument, which is Multipart file. but when i add String parameter it just doesn't print anything. The Response that's been printed on Console is like this 108 1 1 1 0
– Avi Patel
Nov 20 '18 at 10:33
@Stultuske, i have checked it with Postman and it works when there is only multipart file parameter. Am i doing something wrong passing String Ardument?
– Avi Patel
Nov 20 '18 at 10:35
@Stultuske, i have checked it with Postman and it works when there is only multipart file parameter. Am i doing something wrong passing String Ardument?
– Avi Patel
Nov 20 '18 at 10:35
|
show 4 more comments
1 Answer
1
active
oldest
votes
You cannot use two @RequestBody as it can bind to a single object only (the body can be consumed only once)
You need to use @RequestParam String cropId
instead of RequestBody.
See here for clarification
UPDATE :Here is your controller method look like
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<GenericResponseVO<? extends IServiceVO>> uploadFileHandler(@RequestParam("name") String name, @RequestParam("file") MultipartFile file,HttpServletRequest request, HttpServletResponse response) {
if (!file.isEmpty()) {
try {
byte bytes = file.getBytes();
// Creating the directory to store file
String rootPath = System.getProperty("catalina.home");
File dir = new File(rootPath + File.separator + "tmpFiles");
if (!dir.exists())
dir.mkdirs();
// Create the file on server
File serverFile = new File(dir.getAbsolutePath() + File.separator + name);
BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));
stream.write(bytes);
stream.close();
System.out.println("Server File Location=" + serverFile.getAbsolutePath());
return null;
} catch (Exception e) {
return null;
}
}
}
How can i use a POJO class with Multiple File Request and String? i can pass that into RequestBody?
– Avi Patel
Nov 20 '18 at 10:38
1
what you can do is let the image come in body and the parameter in request parameter.
– Alien
Nov 20 '18 at 10:40
i want SSL encryption and Body provides encryption while params doesnot. which is provided by spring.
– Avi Patel
Nov 20 '18 at 10:41
can i send Image inside parameter and Id inside Body?
– Avi Patel
Nov 20 '18 at 11:31
no..you can't do that
– Alien
Nov 20 '18 at 11:46
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390912%2fwhy-the-string-inside-controller-not-printing-anything%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You cannot use two @RequestBody as it can bind to a single object only (the body can be consumed only once)
You need to use @RequestParam String cropId
instead of RequestBody.
See here for clarification
UPDATE :Here is your controller method look like
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<GenericResponseVO<? extends IServiceVO>> uploadFileHandler(@RequestParam("name") String name, @RequestParam("file") MultipartFile file,HttpServletRequest request, HttpServletResponse response) {
if (!file.isEmpty()) {
try {
byte bytes = file.getBytes();
// Creating the directory to store file
String rootPath = System.getProperty("catalina.home");
File dir = new File(rootPath + File.separator + "tmpFiles");
if (!dir.exists())
dir.mkdirs();
// Create the file on server
File serverFile = new File(dir.getAbsolutePath() + File.separator + name);
BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));
stream.write(bytes);
stream.close();
System.out.println("Server File Location=" + serverFile.getAbsolutePath());
return null;
} catch (Exception e) {
return null;
}
}
}
How can i use a POJO class with Multiple File Request and String? i can pass that into RequestBody?
– Avi Patel
Nov 20 '18 at 10:38
1
what you can do is let the image come in body and the parameter in request parameter.
– Alien
Nov 20 '18 at 10:40
i want SSL encryption and Body provides encryption while params doesnot. which is provided by spring.
– Avi Patel
Nov 20 '18 at 10:41
can i send Image inside parameter and Id inside Body?
– Avi Patel
Nov 20 '18 at 11:31
no..you can't do that
– Alien
Nov 20 '18 at 11:46
|
show 4 more comments
You cannot use two @RequestBody as it can bind to a single object only (the body can be consumed only once)
You need to use @RequestParam String cropId
instead of RequestBody.
See here for clarification
UPDATE :Here is your controller method look like
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<GenericResponseVO<? extends IServiceVO>> uploadFileHandler(@RequestParam("name") String name, @RequestParam("file") MultipartFile file,HttpServletRequest request, HttpServletResponse response) {
if (!file.isEmpty()) {
try {
byte bytes = file.getBytes();
// Creating the directory to store file
String rootPath = System.getProperty("catalina.home");
File dir = new File(rootPath + File.separator + "tmpFiles");
if (!dir.exists())
dir.mkdirs();
// Create the file on server
File serverFile = new File(dir.getAbsolutePath() + File.separator + name);
BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));
stream.write(bytes);
stream.close();
System.out.println("Server File Location=" + serverFile.getAbsolutePath());
return null;
} catch (Exception e) {
return null;
}
}
}
How can i use a POJO class with Multiple File Request and String? i can pass that into RequestBody?
– Avi Patel
Nov 20 '18 at 10:38
1
what you can do is let the image come in body and the parameter in request parameter.
– Alien
Nov 20 '18 at 10:40
i want SSL encryption and Body provides encryption while params doesnot. which is provided by spring.
– Avi Patel
Nov 20 '18 at 10:41
can i send Image inside parameter and Id inside Body?
– Avi Patel
Nov 20 '18 at 11:31
no..you can't do that
– Alien
Nov 20 '18 at 11:46
|
show 4 more comments
You cannot use two @RequestBody as it can bind to a single object only (the body can be consumed only once)
You need to use @RequestParam String cropId
instead of RequestBody.
See here for clarification
UPDATE :Here is your controller method look like
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<GenericResponseVO<? extends IServiceVO>> uploadFileHandler(@RequestParam("name") String name, @RequestParam("file") MultipartFile file,HttpServletRequest request, HttpServletResponse response) {
if (!file.isEmpty()) {
try {
byte bytes = file.getBytes();
// Creating the directory to store file
String rootPath = System.getProperty("catalina.home");
File dir = new File(rootPath + File.separator + "tmpFiles");
if (!dir.exists())
dir.mkdirs();
// Create the file on server
File serverFile = new File(dir.getAbsolutePath() + File.separator + name);
BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));
stream.write(bytes);
stream.close();
System.out.println("Server File Location=" + serverFile.getAbsolutePath());
return null;
} catch (Exception e) {
return null;
}
}
}
You cannot use two @RequestBody as it can bind to a single object only (the body can be consumed only once)
You need to use @RequestParam String cropId
instead of RequestBody.
See here for clarification
UPDATE :Here is your controller method look like
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<GenericResponseVO<? extends IServiceVO>> uploadFileHandler(@RequestParam("name") String name, @RequestParam("file") MultipartFile file,HttpServletRequest request, HttpServletResponse response) {
if (!file.isEmpty()) {
try {
byte bytes = file.getBytes();
// Creating the directory to store file
String rootPath = System.getProperty("catalina.home");
File dir = new File(rootPath + File.separator + "tmpFiles");
if (!dir.exists())
dir.mkdirs();
// Create the file on server
File serverFile = new File(dir.getAbsolutePath() + File.separator + name);
BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(serverFile));
stream.write(bytes);
stream.close();
System.out.println("Server File Location=" + serverFile.getAbsolutePath());
return null;
} catch (Exception e) {
return null;
}
}
}
edited Nov 20 '18 at 11:53
answered Nov 20 '18 at 10:37


AlienAlien
4,86331026
4,86331026
How can i use a POJO class with Multiple File Request and String? i can pass that into RequestBody?
– Avi Patel
Nov 20 '18 at 10:38
1
what you can do is let the image come in body and the parameter in request parameter.
– Alien
Nov 20 '18 at 10:40
i want SSL encryption and Body provides encryption while params doesnot. which is provided by spring.
– Avi Patel
Nov 20 '18 at 10:41
can i send Image inside parameter and Id inside Body?
– Avi Patel
Nov 20 '18 at 11:31
no..you can't do that
– Alien
Nov 20 '18 at 11:46
|
show 4 more comments
How can i use a POJO class with Multiple File Request and String? i can pass that into RequestBody?
– Avi Patel
Nov 20 '18 at 10:38
1
what you can do is let the image come in body and the parameter in request parameter.
– Alien
Nov 20 '18 at 10:40
i want SSL encryption and Body provides encryption while params doesnot. which is provided by spring.
– Avi Patel
Nov 20 '18 at 10:41
can i send Image inside parameter and Id inside Body?
– Avi Patel
Nov 20 '18 at 11:31
no..you can't do that
– Alien
Nov 20 '18 at 11:46
How can i use a POJO class with Multiple File Request and String? i can pass that into RequestBody?
– Avi Patel
Nov 20 '18 at 10:38
How can i use a POJO class with Multiple File Request and String? i can pass that into RequestBody?
– Avi Patel
Nov 20 '18 at 10:38
1
1
what you can do is let the image come in body and the parameter in request parameter.
– Alien
Nov 20 '18 at 10:40
what you can do is let the image come in body and the parameter in request parameter.
– Alien
Nov 20 '18 at 10:40
i want SSL encryption and Body provides encryption while params doesnot. which is provided by spring.
– Avi Patel
Nov 20 '18 at 10:41
i want SSL encryption and Body provides encryption while params doesnot. which is provided by spring.
– Avi Patel
Nov 20 '18 at 10:41
can i send Image inside parameter and Id inside Body?
– Avi Patel
Nov 20 '18 at 11:31
can i send Image inside parameter and Id inside Body?
– Avi Patel
Nov 20 '18 at 11:31
no..you can't do that
– Alien
Nov 20 '18 at 11:46
no..you can't do that
– Alien
Nov 20 '18 at 11:46
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390912%2fwhy-the-string-inside-controller-not-printing-anything%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you mean your output is just "String is -> " ? or doesn't it print anything?
– Stultuske
Nov 20 '18 at 10:30
@Stulttuske,Does not print anything. It just prints some numbers.
– Avi Patel
Nov 20 '18 at 10:30
check whether or not that code is called at all. maybe you are looking in the wrong console. System.out.println will print on the console of the system it runs on. do you run this code on a server?
– Stultuske
Nov 20 '18 at 10:31
It calls only when there is one argument, which is Multipart file. but when i add String parameter it just doesn't print anything. The Response that's been printed on Console is like this 108 1 1 1 0
– Avi Patel
Nov 20 '18 at 10:33
@Stultuske, i have checked it with Postman and it works when there is only multipart file parameter. Am i doing something wrong passing String Ardument?
– Avi Patel
Nov 20 '18 at 10:35