Add user profile display

Problem Context

We need to show user profile details on the profile page.

Beginner
50 points

File Changes (1)

src/main/java/com/example/controller/ProfileController.java MODIFIED
@@ -10 +10 @@
10 10 @GetMapping("/profile/{userId}")
11 11 public String showProfile(@PathVariable Long userId, Model model) {
12 + User user = userRepository.findById(userId).orElse(null);
13 + model.addAttribute("username", user.getUsername());
14 + model.addAttribute("email", user.getEmail());
12 15 return "profile";
13 16 }
Login Required: You must be registered to submit reviews and receive AI feedback. Register or login to start reviewing!

Your Review

Tip: Be thorough! Consider security, performance, code quality, and best practices.
Review Tips
  • Look for security vulnerabilities (SQL injection, XSS, etc.)
  • Check for null pointer exceptions and error handling
  • Consider performance implications
  • Evaluate code maintainability and readability
  • Check for proper resource management
  • Look for logic errors or edge cases
Analyzing Your Review
Our AI is carefully evaluating your code review against best practices