add.jsp 수정

This commit is contained in:
daniel LEE 2023-11-02 12:06:35 +09:00
parent 1efd16f1ac
commit 25997d6c14
2 changed files with 10 additions and 6 deletions

View File

@ -48,7 +48,7 @@ public class UserProfileController {
@PostMapping("/user/{id}") @PostMapping("/user/{id}")
// public HashMap<String, Object> putUserProfile(@PathVariable String id, @RequestParam String name, // public HashMap<String, Object> putUserProfile(@PathVariable String id, @RequestParam String name,
// public void putUserProfile(@PathVariable String id, @RequestParam String name, // public void putUserProfile(@PathVariable String id, @RequestParam String name,
public List<UserProfile> putUserProfile(@PathVariable String id, @RequestParam String name, public List<UserProfile> putUserProfile(@PathVariable String id, @RequestParam("name") String name,
@RequestParam String phone, @RequestParam String address, @RequestParam String phone, @RequestParam String address,
@RequestParam MultipartFile upfile) { @RequestParam MultipartFile upfile) {

View File

@ -11,16 +11,20 @@
<script src="http://code.jquery.com/jquery-3.4.1.min.js"></script> <script src="http://code.jquery.com/jquery-3.4.1.min.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$('#add').on('click', function(){ $('#add').on('click', function(){
$.ajax({ $.ajax({
url: "/user/10", url: "/profile/user/10",
type: "POST", type: "POST",
//contentType : 'application/json; charset=UTF-8',
//dataType: "json",
data: $('#theForm').serialize(), data: $('#theForm').serialize(),
success: function(data){ success: function(data){
//location.href="listUser.do"; //location.href="listUser.do";
alert("신규등록 OK"); alert("신규등록 OK");
}, },
error: function(error){ alert(error); } error: function(error, status, msg) {
alert("Error " + msg);
}
}); });
}); });
}); });
@ -41,7 +45,7 @@
<td>Name <input type="text" id="name" name="name" value="50"/><br></td> <td>Name <input type="text" id="name" name="name" value="50"/><br></td>
<td>Phone <input type="text" id="phone" name="phone" value="50"/><br></td> <td>Phone <input type="text" id="phone" name="phone" value="50"/><br></td>
<td>Address <input type="text" id="address" name="address" value="50"/><br></td> <td>Address <input type="text" id="address" name="address" value="50"/><br></td>
<td>File<input type="file" multiple="multiple" id="upfile"></td> <td>File<input type="file" id="upfile" name="upfile" ></td>
<td><input id="add" type="button" value="Send"/></td> <td><input id="add" type="button" value="Send"/></td>
</tr> </tr>
</table> </table>