reset password
Author Message
cysun
Posts: 2935
Posted 14:20 Aug 02, 2015 |

Midterm will be held on Friday 8/7 from 8pm to 11pm. It is an open-book take-home exam. The exam will be available on CSNS at 8pm. Due time will be strictly enforced. No late submission will be accepted, period.

The exam must be completed individually. Collaboration of any kind will be considered cheating, and you will receive an automatic F for the course.

In the exam you will be asked to implement some functions for the CSJobs application, but instead of working on your own code, you will work on a copy of the CSJobs project checked out from svn://sun.calstatela.edu/csjobs/trunk. Please spend some time before the exam to get familiar with the code. The code is given "as is", meaning that there's no guarantee that the code is correct or complete. If there's any problem in the code, you need to deal with it yourself. I'll answer any questions about the code before the exam, but once the exam starts, you'll be on your own. During the exam I'll be available online to answer any questions about the problem description. You may email me or post your questions in the class forum. Note that during exam you may only post questions about the problem description; posting any question about programming or running the project during the exam is considered cheating.

At the end of the exam you must submit the project in a zip file csjobs.zip. The zip file should include two folders src/ and .svn/, and the pom.xml file. The reason we need the .svn folder is because we need to use version control to locate the files that you added or changed. Do not include unnecessary folders like target/ and test-output/ and so on. Because .svn is a hidden folder, the easiest way to create the zip file is to use some software like 7zip to create a zip file of the whole project folder, then delete from the zip file any unnecessary files and folders. The zip file should be about 60KB or so. If yours is too large or too small, you are doing something wrong. You can watch a short video on how to create the zip file here.

If you have any questions about the midterm, please post them in this thread. I may also post additional information about the midterm here, so please subscribe to this thread by clicking on the "Subscribe to This Topic" button at the upper right corner of the post. After you subscribe to a thread (i.e. topic), you will receive an email notification whenever new replies are posted to the thread.

cysun
Posts: 2935
Posted 14:25 Aug 02, 2015 |

The midterm will cover everything we have discussed so far except JavaScript/Ajax/jQuery.

cthanh
Posts: 56
Posted 15:43 Aug 02, 2015 |

Will we need to create our own branch to work on from the repository or we don't need to be commit to your repository(only upload to csns)?

 

Thanks

cysun
Posts: 2935
Posted 16:56 Aug 02, 2015 |
cthanh wrote:

Will we need to create our own branch to work on from the repository or we don't need to be commit to your repository(only upload to csns)?

 

Thanks

You don't need to commit back to the repository. In fact, you only have read access to the repository so you can't branch or tag or commit.

shashank7991
Posts: 18
Posted 10:48 Aug 03, 2015 |

Can we use csjobs database which we generaed during homework-4 or we have to re-setup it for midterm?

Last edited by shashank7991 at 11:07 Aug 03, 2015.
cysun
Posts: 2935
Posted 11:45 Aug 03, 2015 |
shashank7991 wrote:

Can we use csjobs database which we generaed during homework-4 or we have to re-setup it for midterm?

Because you need to work on the exam version of CSJobs (i.e. the one you check out from svn://sun.calstatela.edu/csjobs/trunk), you should use the db scripts that come with it to recreate your database as the code may not work with your db design.

Last edited by cysun at 11:46 Aug 03, 2015.
shashank7991
Posts: 18
Posted 12:08 Aug 03, 2015 |

I already did that. And i have used model classes which you provided after homewor-3. So csjobs application which you provided is working properly with my existing database. So do i have to update my database.?.

nextmatrixman
Posts: 57
Posted 12:14 Aug 03, 2015 |

Can we format the given code (without changing the contents) to our preference?

afetiso
Posts: 84
Posted 12:26 Aug 03, 2015 |

you can use csjobs database, just drop all tables from it and use new create drop from csjods-exam

cysun
Posts: 2935
Posted 12:54 Aug 03, 2015 |
shashank7991 wrote:

I already did that. And i have used model classes which you provided after homewor-3. So csjobs application which you provided is working properly with my existing database. So do i have to update my database.?.

You don't have to, but you probably should as we'll use the scripts in the project to create the database when we grade your midterm. Plus creating/recreating a database with scripts is easy. In the time you asked the question you could have recreated it several times over.

cysun
Posts: 2935
Posted 12:56 Aug 03, 2015 |
nextmatrixman wrote:

Can we format the given code (without changing the contents) to our preference?

Sure, though I'd suggest that you only do it with the files your added or changed. The reason is that if you reformat everything, all files will be shown in version control as modified, so it'll be difficult for us to locate your changes. If your code works perfectly, that's not a problem, but it could be a problem when we give partial credit.

msargent
Posts: 519
Posted 13:27 Aug 03, 2015 |

Would implementing some functions on our own be a good way to practice for this midterm? If we do implement something, can we reuse that code (if it happens to be relevant) during the midterm?

cysun
Posts: 2935
Posted 13:28 Aug 03, 2015 |
msargent wrote:

Would implementing some functions on our own be a good way to practice for this midterm? If we do implement something, can we reuse that code (if it happens to be relevant) during the midterm?

Sure and sure.

nextmatrixman
Posts: 57
Posted 13:51 Aug 03, 2015 |

Oh that's a good point, I will not format anything then. Maybe this should be announced so no one else does it so the grading can go smooth. Thank you!

poonam31
Posts: 35
Posted 14:59 Aug 03, 2015 |

Hello,

Just want to confirm:

The topics discussed in video 'Bits and Pieces of Web Programming (I)' will be included in midterm?

cysun
Posts: 2935
Posted 15:02 Aug 03, 2015 |
poonam31 wrote:

Hello,

Just want to confirm:

The topics discussed in video 'Bits and Pieces of Web Programming (I)' will be included in midterm?

Yes.

ed12al
Posts: 5
Posted 20:29 Aug 03, 2015 |

Should we change the tomcat-jdbc version to match the tomcat version that we have on our own machine? 

 

cysun
Posts: 2935
Posted 22:45 Aug 03, 2015 |
ed12al wrote:

Should we change the tomcat-jdbc version to match the tomcat version that we have on our own machine? 

You shouldn't need to. As long as you are using Tomcat 7, it should work even if the versions don't exactly match.

poonam31
Posts: 35
Posted 22:47 Aug 03, 2015 |

Hello Professor,

 

When I run csjobs-exam project, its just running , not giving me any error or a default page. Its just going on. Did i Miss anything?

I checked out the project and populated the db as well.

 

Last edited by poonam31 at 22:48 Aug 03, 2015.
poonam31
Posts: 35
Posted 23:16 Aug 03, 2015 |

I resolved this  issue. 

Thanks

bseemscs
Posts: 26
Posted 14:47 Aug 06, 2015 |

Why are there two ApplicationController classes?

cysun
Posts: 2935
Posted 14:48 Aug 06, 2015 |
bseemscs wrote:

Why are there two ApplicationController classes?

I like to separate controller methods that require session attributes and the ones that don't.

bseemscs
Posts: 26
Posted 16:43 Aug 06, 2015 |

What is the purpose of the error.jsp? It appears that it is called by the apply control method if the applicant tries to apply for a job that has already been applied to but I cannot understand how this would happen and I cannot get to the error.jsp. I tried changing the parameter in the url to that of a job that was already applied to and was not directed to the error.jsp. Rather, I am able to change the information in the application.

cysun
Posts: 2935
Posted 19:33 Aug 06, 2015 |
bseemscs wrote:

What is the purpose of the error.jsp? It appears that it is called by the apply control method if the applicant tries to apply for a job that has already been applied to but I cannot understand how this would happen and I cannot get to the error.jsp. I tried changing the parameter in the url to that of a job that was already applied to and was not directed to the error.jsp. Rather, I am able to change the information in the application.

1. error.jsp is for displaying error messages.

2. You may have discovered a bug in the code.

poonam31
Posts: 35
Posted 21:17 Aug 06, 2015 |

How the errCode inside error.jsp is set in case of error? 

 

Last edited by poonam31 at 21:29 Aug 06, 2015.
cysun
Posts: 2935
Posted 07:47 Aug 07, 2015 |
poonam31 wrote:

How the errCode inside error.jsp is set in case of error? 

It's set in a controller. See the apply() method in ApplicationControllerS for example.

hensan
Posts: 23
Posted 11:46 Aug 07, 2015 |

On the midterm, are you going to grade us on the folder structure hierarchy, for example do we need to separate the different jsp files in their corresponding folders, do we need to create folders for each of the models that we're going to use depending on what you're going to ask us to implement or can we just place the jsp files in the root folder.

Last edited by hensan at 11:50 Aug 07, 2015.
cysun
Posts: 2935
Posted 11:53 Aug 07, 2015 |
hensan wrote:

On the midterm, are you going to grade us on the folder structure hierarchy, for example do we need to separate the different jsp files in their corresponding folders, do we need to create folders for each of the models that we're going to use depending on what you're going to ask us to implement or can we just place the jsp files in the root folder.

No.

bseemscs
Posts: 26
Posted 14:35 Aug 07, 2015 |

I want to get some attributes from an uploaded file from an upload.jsp and assign them to a new csjobs.model.File() object. Where should the File() object be created? Should it be created and passed into the jsp by the GET method or created in the POST method and do the work there?

cysun
Posts: 2935
Posted 14:41 Aug 07, 2015 |
bseemscs wrote:

I want to get some attributes from an uploaded file from an upload.jsp and assign them to a new csjobs.model.File() object. Where should the File() object be created? Should it be created and passed into the jsp by the GET method or created in the POST method and do the work there?

You can't "bind" a File object to a form to get the attributes of an uploaded file because those attributes (e.g. content type, length, and so on) are not sent as request parameters. Like I said here and here, you need to handle the uploaded file as a separate @RequestParam, then get the attributes from MultipartFile.

bseemscs
Posts: 26
Posted 15:28 Aug 07, 2015 |
cysun wrote:
bseemscs wrote:

I want to get some attributes from an uploaded file from an upload.jsp and assign them to a new csjobs.model.File() object. Where should the File() object be created? Should it be created and passed into the jsp by the GET method or created in the POST method and do the work there?

You can't "bind" a File object to a form to get the attributes of an uploaded file because those attributes (e.g. content type, length, and so on) are not sent as request parameters. Like I said here and here, you need to handle the uploaded file as a separate @RequestParam, then get the attributes from MultipartFile.

My thinking is to create a File object then use multipartFile methods inside the File object's setter methods. I am thinking I can do this in the POST controller. I was also thinking I could give the uploaded file a unique multipartFile name in the jsp using Expression Language to aid retrieval. If that is possible, I will have to pass some object into the jsp to use the Expression Language. I am thinking of passing in application for this. Am I all wet here or am I tracking on something?

Last edited by bseemscs at 15:29 Aug 07, 2015.
cysun
Posts: 2935
Posted 15:39 Aug 07, 2015 |
bseemscs wrote:
cysun wrote:
bseemscs wrote:

I want to get some attributes from an uploaded file from an upload.jsp and assign them to a new csjobs.model.File() object. Where should the File() object be created? Should it be created and passed into the jsp by the GET method or created in the POST method and do the work there?

You can't "bind" a File object to a form to get the attributes of an uploaded file because those attributes (e.g. content type, length, and so on) are not sent as request parameters. Like I said here and here, you need to handle the uploaded file as a separate @RequestParam, then get the attributes from MultipartFile.

My thinking is to create a File object then use multipartFile methods inside the File object's setter methods. I am thinking I can do this in the POST controller. I was also thinking I could give the uploaded file a unique multipartFile name in the jsp using Expression Language to aid retrieval. If that is possible, I will have to pass some object into the jsp to use the Expression Language. I am thinking of passing in application for this. Am I all wet here or am I tracking on something?

I don't quite understand what you are trying to do.

You can give different names to different <input type="file" /> to tell them apart, and all other information like content type etc. come with the uploaded files and can be retrieved from MultipartFile. I don't understand why you need to pass something from the server to the client.

bseemscs
Posts: 26
Posted 18:28 Aug 07, 2015 |

I created a FileDao and FileDaoImpl and tried to @Autowired the FileDao in a FileController then I got a HTTP 500 exception telling me that could not autowire the private field csjobs.model.dao.FileDao. I am quite certain I did everything the same as when I created and autowired a UserDao. Attached the Exception report. Any Idea what is happening here? Is there some conflict with java.io.File?

Attachments:
jpatel43
Posts: 11
Posted 18:30 Aug 07, 2015 |

While storing file information into database, I get this error.

HTTP Status 500 - Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing: csjobs.model.Application.cv -> csjobs.model.File; nested exception is java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing: csjobs.model.Application.cv -> csjobs.model.File

bseemscs
Posts: 26
Posted 18:48 Aug 07, 2015 |
bseemscs wrote:

I created a FileDao and FileDaoImpl and tried to @Autowired the FileDao in a FileController then I got a HTTP 500 exception telling me that could not autowire the private field csjobs.model.dao.FileDao. I am quite certain I did everything the same as when I created and autowired a UserDao. Attached the Exception report. Any Idea what is happening here? Is there some conflict with java.io.File?

I forgot the @Repository tag in FileDaoImpl. Crisis averted.

poonam31
Posts: 35
Posted 21:32 Aug 07, 2015 |

Hello,

 

On create job form, 

dates are entered in m/d/yyyy - can i assume this or should i validate if it is entered in correct form?

cysun
Posts: 2935
Posted 21:34 Aug 07, 2015 |
poonam31 wrote:

Hello,

 

On create job form, 

dates are entered in m/d/yyyy - can i assume this or should i validate if it is entered in correct form?

It's M/d/yyyy, not m/d/yyyy, which is different. And yes, you can assume this. Input validation is not required.

jpatel43
Posts: 11
Posted 23:00 Aug 07, 2015 |

Upload failed...What should I do???

jpatel43
Posts: 11
Posted 23:01 Aug 07, 2015 |

At 10:59...