Author | Message |
---|---|
cysun
Posts: 2935
|
Posted 13:53 May 08, 2013 |
For your homework, please add the following to your web.xml:
I'll explain in class. |
xytian
Posts: 70
|
Posted 13:06 May 09, 2013 |
Hi Professor, I encountered problems on the other way. To review a lawyer, I first created a new Review object, set the lawyer and user field, then pass it to jsp as ModelAttribute. After it is returned, the ratings and comment fields seem fine, but the user/lawyer (or reviewer/reviewee) fields are null. Then I tried another way, I pass a new Review object to jsp, after I collect the input values I manually set the user/lawyer field, and add this review to the lawyer's reviews list, then tried to save the Lawyer object. But now I get an "detached entity passed to persist" error! I tried to save either a user, lawyer, or the review, but I kept getting the same message. |
cysun
Posts: 2935
|
Posted 13:21 May 09, 2013 |
1. Use @SessionAttribute 2. Use merge() instead of persist() |
xytian
Posts: 70
|
Posted 13:54 May 09, 2013 |
Professor, Things didn't change. Please refer to the attached pics for codes in my UserController.java. (3) I guess I just need to save "lawyer", then the review should be automatically saved, is it right? Last edited by cysun at
14:09 May 09, 2013.
|
cysun
Posts: 2935
|
Posted 14:13 May 09, 2013 |
I've removed the attached screenshot. Please do not post complete code in the forum; doing so will be considered facilitating cheating. You can post error messages and code snippets, and you can describe your code in English. Just don't post complete methods and so on. |
cysun
Posts: 2935
|
Posted 14:18 May 09, 2013 |
It would, but it doesn't solve the problem of missing user and lawyer, i.e. the review would have null in those fields. |