Skip to content

Hometask jv-web-practice completed#660

Open
MarynaKushniruk wants to merge 3 commits intomate-academy:masterfrom
MarynaKushniruk:master
Open

Hometask jv-web-practice completed#660
MarynaKushniruk wants to merge 3 commits intomate-academy:masterfrom
MarynaKushniruk:master

Conversation

@MarynaKushniruk
Copy link

No description provided.

}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add redirect

car.setManufacturer(manufacturer);
car.setDrivers(new ArrayList<>());
carService.create(car);
resp.sendRedirect("/index");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and for all redirect, pls

Driver driver = driverService.get(Long.valueOf(req.getParameter("driver")));
car.getDrivers().add(driver);
carService.update(car);
resp.sendRedirect(req.getContextPath() + "/cars/add/driver");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better redirect to a page where you can see the change just made, after you added a car - to list of all cars etc

Comment on lines 26 to 29
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.sendRedirect(req.getContextPath() + "/cars/all");
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove doPost from controllers that start with Get

Copy link

@okuzan okuzan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to unblock review on the platform

@MarynaKushniruk MarynaKushniruk requested a review from okuzan August 7, 2023 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants