reset password
Author Message
LHS
Posts: 26
Posted 19:31 Feb 25, 2019 |

I am still having trouble finding my BMI Calculator, error 404. I did exactly the same things I did for lab 8. Did anyone get their's working on a web browser, for the cs3 server?

 

Last edited by LHS at 19:32 Feb 25, 2019.
kamron_m
Posts: 3
Posted 21:48 Feb 25, 2019 |

I'm still struggling with this too. If somebody who has gotten it working could post their web.xml file here that would help me out a lot. I think that's my current issue.

astrong2
Posts: 25
Posted 21:50 Feb 25, 2019 |

Same thing happened to me, not sure what I did differently compared to the last lab, but it's not working. A solution would be appreciated 

chenyi
Posts: 3
Posted 22:12 Feb 25, 2019 |

You can try deploy your project as follow guide.If it doesn't work,feel free to come during office hours.

https://csns.calstatela.edu/wiki/content/cysun/course_materials/eclipse

kamron_m
Posts: 3
Posted 00:57 Feb 26, 2019 |

Okay so I've finally ironed out all the kinks in mine.

All told, my directory structure looks like this (in the ~/www directory)

.
 |-index.html
 |-WEB-INF
 | |-classes
 | | |-co
 | | | |-kamron
 | | | | |-cs3220
 | | | | | |-lb9
 | | | | | | |-Person.class
 | | | | | | |-BmiServlet.class
 | |-web.xml
 | |-response.jsp

Note that my servlet is declared in the package co.kamron.cs3220.lb9, and is in the directory classes/co/kamron/cs3220/lb9. These two have to match.

Also, my index.html file is the one that contains the form, and the response.jsp is only used to output the result of the BMI calculation. It's in the WEB-INF folder because everything under WEB-INF is hidden from clients. This means that at the url http://cs3.calstatela.edu:8080/cs3220stu27/index.html will directly serve the html file, but http://cs3.calstatela.edu:8080/cs3220stu27/WEB-INF/response.jsp will INTENTIONALLY give a 404.

I've also attached my web.xml file which will probably look pretty different because I'm unable to use Eclipse. If you use Eclipse, ignore it. If like me you've been struggling to write one yourself it may be helpful, but YMMV.

Attachments:
Last edited by kamron_m at 00:59 Feb 26, 2019.
cysun
Posts: 2935
Posted 09:10 Feb 26, 2019 |
kamron_m wrote:

[...]

I've also attached my web.xml file which will probably look pretty different because I'm unable to use Eclipse. If you use Eclipse, ignore it. If like me you've been struggling to write one yourself it may be helpful, but YMMV.

Regarding web.xml: with Servlet 3 Specification (which we are using with Tomcat 8.5), it's no longer necessary to declare servlets in web.xml (because @WebServlet takes care of that). You can use the attached web.xml for all your CS3220 assignments.

Attachments:
LHS
Posts: 26
Posted 21:56 Feb 26, 2019 |

Sort of works for me now.

For some my hyperlink doesn't work on the server but works on eclipse. So i tried a form instead, but the server is still showing my old code. Not really sure whats going on. I uploaded the new code.

Last edited by LHS at 23:31 Feb 26, 2019.
cysun
Posts: 2935
Posted 09:51 Feb 27, 2019 |
LHS wrote:

Sort of works for me now.

For some my hyperlink doesn't work on the server but works on eclipse. So i tried a form instead, but the server is still showing my old code. Not really sure whats going on. I uploaded the new code.

After you upload the new code, you need to upload web.xml again, which basically tells Tomcat to reload your project.