0

Problem: I need help fixing an issue with my program involving my GET request and retrieving the endpoints for the /register and /user pages.

Program: Program works as follows: Running the localhost will allow the user to input their details to the page (username, password, address). Once that's completed, this will be saved to an account name (which is editable), be saved via mySQL, and viewable on the /users page. Additionally, the users page will display all registered accounts (ID, email, password, and account(s)), and a link w/ a numbered userID will appear in /users page and clicking on it redirects to the single user's details and allows the user to make any changes to their info. Clicking on their account(s) name in users will do the same.

Link: This is the progress I've made so far. https://github.com/NilesDobbs/Assignment13

Goal: My localhost is retrieving me a 500 status error for both /user and /register pages, and my IDE isn't giving me any errors at runtime until I input the URL paths, which is:

javax.servlet.ServletException: Circular view path [register]: would dispatch back to the current handler URL [/register] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

I need help identifying the issue with my code, getting the pages to run on the host, and also understanding the current error. Any help would be appreciated. Thanks.

1 Answers1

1

Check this issue

But I'm guessing your solution would be to change in POM:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

to:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
vabatch_dev
  • 115
  • 4
  • Thanks. It fixed the 500 status issue with getting the user and register to run, but now there's an issue with the foreign key constraints in mySQL: `java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`assignment_13`.`user_account`, CONSTRAINT `FK1pxs5fj6ujqfs13gmfg3o5cwo` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`))` I'm assuming this error is due to a value in the child row that does not exist in the parent? – Niles Dobbs Jul 03 '22 at 23:03
  • check @ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE}) @JoinTable(name = "user_account", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "account_id")) public List getAccounts() { return accounts; } I'm actually not sure how it works, but the problem seems to be happening there. In the first place, I don't see any Entity with table name "user_account" – vabatch_dev Jul 03 '22 at 23:17