reset password
Author Message
lishenyu
Posts: 103
Posted 00:05 Jul 01, 2015 |

Hi ,

when I was checking out a maven project of "reivew" , I have following problems ,could you tell me how to fix this ? thanks . Maybe I have something forget to install but I don't what it is, I am operating on a new laptop. thanks!

hgadhia
Posts: 52
Posted 09:24 Jul 01, 2015 |

It seems you have not included the JSTL.jar in your build path

Please refer the last point from CSNS wiki on setting up the development environment for CS520 here.

Last edited by hgadhia at 09:25 Jul 01, 2015.
cysun
Posts: 2935
Posted 14:30 Jul 01, 2015 |
lishenyu wrote:

Hi ,

when I was checking out a maven project of "reivew" , I have following problems ,could you tell me how to fix this ? thanks . Maybe I have something forget to install but I don't what it is, I am operating on a new laptop. thanks!

Those seem to be warnings. You can just ignore them.

Eclipse's JSP validator sometimes gives false warnings. If the code runs then you can ignore the warnings.

The build path warning basically says that the project asks for JDK 1.7 but (presumably) you have JDK 1.8 on your computer. Again, that's perfectly fine. This warning can be disabled in Eclipse Preferences.

lishenyu
Posts: 103
Posted 23:15 Jul 01, 2015 |
cysun wrote:
lishenyu wrote:

Hi ,

when I was checking out a maven project of "reivew" , I have following problems ,could you tell me how to fix this ? thanks . Maybe I have something forget to install but I don't what it is, I am operating on a new laptop. thanks!

Those seem to be warnings. You can just ignore them.

Eclipse's JSP validator sometimes gives false warnings. If the code runs then you can ignore the warnings.

The build path warning basically says that the project asks for JDK 1.7 but (presumably) you have JDK 1.8 on your computer. Again, that's perfectly fine. This warning can be disabled in Eclipse Preferences.

hi professor ,I did as the video and made a maven project ,after I input the groupID and artifactID then click finish , my project tells an error like following in pom.xml :

lishenyu
Posts: 103
Posted 23:16 Jul 01, 2015 |

the description :

cysun
Posts: 2935
Posted 23:17 Jul 01, 2015 |

You need to change packaging from "jar" to "war" when you create the project.

lishenyu
Posts: 103
Posted 23:21 Jul 01, 2015 |
cysun wrote:

You need to change packaging from "jar" to "war" when you create the project.

I did that ,and I also deleted the old project and recreated a new project , the packaing is war ,but the error is still there ..

cysun
Posts: 2935
Posted 23:25 Jul 01, 2015 |

Just continue with the rest of the steps. After you do Maven -> Update Project ... the errors should go away.

lishenyu
Posts: 103
Posted 14:04 Jul 03, 2015 |

professor I want to make sure that whether the pom.xml should be version controlled or not ,because in the videos the pom.xml was version controlled under trunk folder. So our trunk folder should only include src folder ? Thanks !

cysun
Posts: 2935
Posted 15:13 Jul 03, 2015 |

pom.xml should be version controlled.

lishenyu
Posts: 103
Posted 13:37 Jul 11, 2015 |

Dr.Sun ,

I have checked the csns2 project :User class and File class . but I found in File class it has following :

    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false, name = "owner_id")
    private User owner;

 

but in User class :

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "original_picture_id")
    private File originalPicture;

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "profile_picture_id")
    private File profilePicture;

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "profile_thumbnail_id")
    private File profileThumbnail;

why in User class there is no "@OneToMany(mappedby="owner")"  that corresponds to File class ?

 

cysun
Posts: 2935
Posted 22:50 Jul 11, 2015 |

Because in CSNS2 there isn't an operation that requires getting all the files owned by a particular user, so there's no benefit of doing a bidirectional association here.

lishenyu
Posts: 103
Posted 23:34 Jul 11, 2015 |

Hi Dr Sun ,

in order to test "reviewer3 is on two committees." , as 'reviewer3'  is not a first name or last name , can I assume that I have known the id or first name of 'reviewer3' ?

cysun
Posts: 2935
Posted 08:32 Jul 12, 2015 |
lishenyu wrote:

Hi Dr Sun ,

in order to test "reviewer3 is on two committees." , as 'reviewer3'  is not a first name or last name , can I assume that I have known the id or first name of 'reviewer3' ?

As stated in the homework, the email of each user is <username>@localhost.localdomain, and email is unique, so you can use the email reviewer3@localhost.localdomain to get the reviewer.

lishenyu
Posts: 103
Posted 16:31 Jul 23, 2015 |

Hi Dr.Sun , I got this error in my userController when I did the validation :

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'applicant' available as request attribute

then I found the solution to this : public String register( @ModelAttribute("applicant") User applicant,BindingResult result)

in your video you have no ("applicant") after @ModelAttribute and  it works fine , but I have to add this in order to get it working ,

did I miss something ? Thanks !

cysun
Posts: 2935
Posted 19:19 Jul 23, 2015 |
lishenyu wrote:

Hi Dr.Sun , I got this error in my userController when I did the validation :

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'applicant' available as request attribute

then I found the solution to this : public String register( @ModelAttribute("applicant") User applicant,BindingResult result)

in your video you have no ("applicant") after @ModelAttribute and  it works fine , but I have to add this in order to get it working ,

did I miss something ? Thanks !

That's a quirk about @ModelAttribute. If you don't specify the name, by default the name is the class name (with the first letter in lower case) rather than the parameter name. For example, in your case it expects a model attribute called "user" instead of "applicant".

lishenyu
Posts: 103
Posted 18:45 Jul 24, 2015 |

Hi Dr Sun .

In my login controller , I have a @RequestMapping('login.html') , and after a user logins  ,I put the user into an object and want to pass the corresponding page ,like an applicant will be led to applicant.html page .

I did it like this then:
          return "redirect:applicant.html";

but I found it failed to get the user object that passed from controller in applicant.jsp page ,could you tell me how to solve this problem ? And if I use :  return "applicant"  , it did pass the user object ,but the url still shows login.html instead of applicant.html.

cysun
Posts: 2935
Posted 11:06 Jul 25, 2015 |
lishenyu wrote:

Hi Dr Sun .

In my login controller , I have a @RequestMapping('login.html') , and after a user logins  ,I put the user into an object and want to pass the corresponding page ,like an applicant will be led to applicant.html page .

I did it like this then:
          return "redirect:applicant.html";

but I found it failed to get the user object that passed from controller in applicant.jsp page ,could you tell me how to solve this problem ? And if I use :  return "applicant"  , it did pass the user object ,but the url still shows login.html instead of applicant.html.

The user object needs to be in session scope if you want to get it after a redirect. "return 'application'" is a forward.

You can add an HttpSesson argument to the login controller and use session.setAttribute() to put the user object into session.

lishenyu
Posts: 103
Posted 11:14 Jul 25, 2015 |

 Can I use "RedirectAttributes" ? and when I used this to add attribute like this : "redirectAttrs.addAttribute("applicant", user);"

it gave me an exception :

~Failed to convert value of type 'csjobs.model.User' to required type 'java.lang.String'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [csjobs.model.User] to required type [java.lang.String]: no matching editors or conversion strategy found

cysun
Posts: 2935
Posted 11:16 Jul 25, 2015 |
lishenyu wrote:

 Can I use "RedirectAttributes" ? and when I used this to add attribute like this : "redirectAttrs.addAttribute("applicant", user);"

it gave me an exception :

~Failed to convert value of type 'csjobs.model.User' to required type 'java.lang.String'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [csjobs.model.User] to required type [java.lang.String]: no matching editors or conversion strategy found

RedirectAttributes are not session attributes. Read the documentation.

lishenyu
Posts: 103
Posted 11:04 Aug 03, 2015 |

Hi Dr Sun , the last two videos have introduced file uploading/downloading , and Jquery and Ajax , you have said in midterm we don't need to implement Ajax and Jquery ,  do we need to implement some functions of file uploading/downloading in midterm ?

Thanks !

cysun
Posts: 2935
Posted 11:47 Aug 03, 2015 |
lishenyu wrote:

Hi Dr Sun , the last two videos have introduced file uploading/downloading , and Jquery and Ajax , you have said in midterm we don't need to implement Ajax and Jquery ,  do we need to implement some functions of file uploading/downloading in midterm ?

Thanks !

Yes, you may need to do file uploading/downloading.

lishenyu
Posts: 103
Posted 10:19 Aug 10, 2015 |

Hi Dr sun , for the midterm I used a Spring form to handle the modelAttribute of "job" , but other fields of job like title ,description and date are added successfully to the database ,but committeeChair and committeeMembers these two fields failed to store in database , I have used form:select and form:checkbox to handle them respectively , in jsp I think there may be no problem . So could you tell me how to solve this ?thank you !

cysun
Posts: 2935
Posted 11:31 Aug 10, 2015 |
lishenyu wrote:

Hi Dr sun , for the midterm I used a Spring form to handle the modelAttribute of "job" , but other fields of job like title ,description and date are added successfully to the database ,but committeeChair and committeeMembers these two fields failed to store in database , I have used form:select and form:checkbox to handle them respectively , in jsp I think there may be no problem . So could you tell me how to solve this ?thank you !

See this.

lishenyu
Posts: 103
Posted 11:39 Aug 10, 2015 |

property editor ? can we get it from online videos ?

cysun
Posts: 2935
Posted 12:12 Aug 10, 2015 |
lishenyu wrote:

property editor ? can we get it from online videos ?

Unfortunately it's not in the videos. It's in my email last week.

lishenyu
Posts: 103
Posted 12:15 Aug 10, 2015 |

got it..

Last edited by lishenyu at 12:16 Aug 10, 2015.