Author | Message |
---|---|
yliang6
Posts: 4
|
Posted 12:35 Jan 29, 2012 |
What are we actually doing for HW 1? I read the HW1 on Sun's website, it said for this quarter, we are going to write a wiki server, and there are a lot of stuff we haven't talk about yet. so I am wondering what are we doing for HW1 Thanks for reply! |
YangXuan
Posts: 23
|
Posted 13:32 Jan 29, 2012 |
The homework1 is the entry step to build up a wiki server. In the homework, you need to implement the basic features such as adding a page and displaying the page list. All the details are described in the Dr.Sun's HW1 including the video. Read it all through and follow the instruction. |
rpuas
Posts: 29
|
Posted 13:41 Jan 29, 2012 |
Have you checked the video on the homework1 page? You have to create the data class first, per the hints on the bottom of the page, and then create Servlets to display and list the pages. I ended up with 4 servlet pages and 1 data class, total of 5 java files. The main servlet initiates the index page and stores it to the servletContext List. servlet 2 lists the pages in a table. servlet 3 checks to see if a page exists and displays the page or prompts you if you want to create the page. servlet 4 generates the form to collect the data and stores it to the servletContext List. Took me a while to put it all together. My biggest problem was using the right paths using getRequestURI & getContextPath See the RequestInfo.java & GuestBook (Servlet) links on the cs320 page for some examples on using paths. |
yliang6
Posts: 4
|
Posted 13:48 Jan 29, 2012 |
|
rpuas
Posts: 29
|
Posted 13:55 Jan 29, 2012 |
It's a .wmv file. I viewed the video using windows media player |
yliang6
Posts: 4
|
Posted 14:03 Jan 29, 2012 |
So, HW1 is a brainstorming homework, am I correct? |
rpuas
Posts: 29
|
Posted 14:11 Jan 29, 2012 |
Its a little more than brainstorming, it's an exercise in getting the Servlets to work together and using the paths correctly. looks like we'll be using this in other homework assignments, so it helps to get this part down. |
yliang6
Posts: 4
|
Posted 14:11 Jan 29, 2012 |
|
Fatemah
Posts: 59
|
Posted 19:47 Jan 29, 2012 |
1- How can I store the index page to the servletContext list? 2- How can I list servlets in the table? 3- how servlet 4 works?
I ended up with 5 servlet pages and one data class !! |
YangXuan
Posts: 23
|
Posted 20:10 Jan 29, 2012 |
Refer to the GuestBook example. 1. You can use the getServletContext().setAttribute( "objectName", object) to put your objects to the servlet context container As index page, you can create an object for index page, store this page object in a list and put the list to the servlet context container. 2.Get the list that you stored on the servlet context container and use the "for" loop could help 3. Use the form attributes like "method" and "action" to submit the data to the proper servlet. This servlet is responsible for converting the received data to an object and then store this object to the list which is in the servlet context container. |