我无法部分更新我的页面。我用几句话解释业务问题。我有一个用户个人资料,他可以在其中更改有关他自己的任何信息:技能,个人信息,主要照片库。一切正常,但添加了等照片后,我的整个页面刷新了,这是我的烦恼。
首先,我显示添加主照片的确切位置
<div th:fragment="photoDiv">
<img id="mainPhoto" th:src="@{/profile/main/img}" alt=""/>
<div>
<form id="mainPhotoForm" action="#" th:action="@{/profile/main/upload}"
enctype="multipart/form-data" method="post">
<label for="files"><img src="../../img/plus.png"/> Upload photo</label>
<input id="files" style="display:none;" type="file" accept="image/*" th:name="img"
onchange="document.getElementById('mainPhotoForm').submit();"/>
</form>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的控制器
@PostMapping("/profile/main/img")
public String uploadingMianPhoto(@RequestParam("img") MultipartFile file,
@ModelAttribute("userDto") userDto user) {
String path = filesStrorage.storeFiles(file, getCurrentUserID());
if (!path.isEmpty()) {
Photo mainPhoto = new Photo();
mainPhoto.setFileName(file.getOriginalFilename());
mainPhoto.setPath(path);
user.setProfilePhoto(mainPhoto);
}
return "/profile/edit";
}
// Load main photo
@RequestMapping(value = "/profile/main/upload")
public @ResponseBody
byte[] mainPhotoResponse(@ModelAttribute("userDto") UserDto user) throws IOException {
Path path = …Run Code Online (Sandbox Code Playgroud) 我正在尝试从数组中删除特定对象
我有一个由我定义的Objects系列数组
A =[Family(), ....]
Run Code Online (Sandbox Code Playgroud)
我实现了函数,minimum以便我可以传递数组A并获取一个Object
family = minimal(A)
Run Code Online (Sandbox Code Playgroud)
然后我想从数组中删除此对象 A
pop!(A , family)
Run Code Online (Sandbox Code Playgroud)
我收到了 error pop! has no method matching pop!...
我搜索正确的流行方法版本,但我什么也没找到,我可以使用什么,任何想法如何修复此代码?