reset password
Author Message
bruno1693
Posts: 48
Posted 18:58 Jan 11, 2015 |

I'm following the instructions to upload the files to the server, but only the JSP is displayed. When I check for the servlet, I know it's uploaded because I can see the file if I type .java at the end, but it's doesn't give me access when I just type the URL we are supposed to do. Any tips?

MariahM
Posts: 35
Posted 19:04 Jan 11, 2015 |
Did you also upload the web.xml file ?
bruno1693
Posts: 48
Posted 19:08 Jan 11, 2015 |

No, but the xml shouldn't matter when it comes to display the servlet

MariahM
Posts: 35
Posted 19:10 Jan 11, 2015 |

Oh. Well mine would not work without it. Professor also uploaded it in class when his wasn't working. 

mbarra10
Posts: 4
Posted 19:17 Jan 11, 2015 |

What about the URL mapping, did you name it appropriately when creating the servlet.

bruno1693
Posts: 48
Posted 19:29 Jan 11, 2015 |

Yes the directories are the same ones as the ones he told us to do, but it doesn't display the servlet. The only one working so far is the JSP

giraid
Posts: 39
Posted 19:45 Jan 11, 2015 |

I think you uploaded the wrong file because you said you can see the .java file. The folders we need to upload are WebContent and class and none of them contain any .java files.

bruno1693
Posts: 48
Posted 20:12 Jan 11, 2015 |

I followed exactly what the instructions said to upload it to the server. I don't think I uploaded the wrong file. If any of you uploaded it already, can you send me the link to it so I can look it up?

giraid
Posts: 39
Posted 20:18 Jan 11, 2015 |

you can look at mine if you want

link

The picture attached is how my file structure look like on the server.

Attachments:
Last edited by giraid at 20:20 Jan 11, 2015.
bruno1693
Posts: 48
Posted 20:21 Jan 11, 2015 |

Man that looks great. The photo that you sent helps a lot. What software did you use to upload it? I'm using FileZilla but its a mess on a Mac lol

giraid
Posts: 39
Posted 20:25 Jan 11, 2015 |

I use filezilla too, on PC tho.

hippiewho
Posts: 46
Posted 20:27 Jan 11, 2015 |
giraid wrote:

I think you uploaded the wrong file because you said you can see the .java file. The folders we need to upload are WebContent and class and none of them contain any .java files.

the class folder should have had another folder in it (the name depends on what you called the package) and the .java file should be in there. For OP you do need the .xml file or it wont work. Also make sure the the compiler your using is jre 1.7 and not 1.8 or the server wont run it (i had this problem - i had to redo the whole project to get it to work right then reupload). and like MBARRA10 said, make sure the mapping is correct. What is the URL that displays at the top when you click on the link on the JSTL? 

giraid
Posts: 39
Posted 20:35 Jan 11, 2015 |
hippiewho wrote:
giraid wrote:

I think you uploaded the wrong file because you said you can see the .java file. The folders we need to upload are WebContent and class and none of them contain any .java files.

the class folder should have had another folder in it (the name depends on what you called the package) and the .java file should be in there. For OP you do need the .xml file or it wont work. Also make sure the the compiler your using is jre 1.7 and not 1.8 or the server wont run it (i had this problem - i had to redo the whole project to get it to work right then reupload). and like MBARRA10 said, make sure the mapping is correct. What is the URL that displays at the top when you click on the link on the JSTL? 

I could be wrong, but shouldn't the files under build/class be .class files instead of .java files? Since .java is the source code and .class is the binary.

hippiewho
Posts: 46
Posted 20:37 Jan 11, 2015 |
giraid wrote:

I could be wrong, but shouldn't the files under build/class be .class files instead of .java files? Since .java is the source code and .class is the binary.

oh crap your right. LOL

bruno1693
Posts: 48
Posted 20:42 Jan 11, 2015 |

This is what I have in filezilla, I followed the instructions. 

This is my link for the JSP, and it works fine. 

http://cs3.calstatela.edu:8080/cs320stu77/lab2/HelloJSTL.jsp

but my Servlet doesn't work

http://cs3.calstatela.edu:8080/cs320stu77/lab2/HelloServlet

HeavyTech
Posts: 6
Posted 20:49 Jan 11, 2015 |
bruno1693 wrote:

This is what I have in filezilla, I followed the instructions. 

This is my link for the JSP, and it works fine. 

http://cs3.calstatela.edu:8080/cs320stu77/lab2/HelloJSTL.jsp

but my Servlet doesn't work

http://cs3.calstatela.edu:8080/cs320stu77/lab2/HelloServlet

Make sure you are using version 1.7 for your java compiler. I had the same problem for the servlet and it turned out it was the compiler.  

Right click your project-> properties-> java compiler 

 

 

giraid
Posts: 39
Posted 20:50 Jan 11, 2015 |

does it work on your local server?

bruno1693
Posts: 48
Posted 20:51 Jan 11, 2015 |

I have 1.7

bruno1693
Posts: 48
Posted 20:51 Jan 11, 2015 |
giraid wrote:

does it work on your local server?

yes it does work on my local server!

HeavyTech
Posts: 6
Posted 21:10 Jan 11, 2015 |

Here is my server structure. Hope it works for you :) 

Attachments:
bruno1693
Posts: 48
Posted 21:19 Jan 11, 2015 |

Yes I have it like that! The permissions are so that everyone can read and execute, but it doesn't work man /:

giraid
Posts: 39
Posted 21:20 Jan 11, 2015 |
bruno1693 wrote:
giraid wrote:

does it work on your local server?

yes it does work on my local server!

can you paste the url to the servlet on your local server?

bruno1693
Posts: 48
Posted 21:22 Jan 11, 2015 |

Yes. Here I attach two photos of how the URL looks on my files

bruno1693
Posts: 48
Posted 21:22 Jan 11, 2015 |

and the other one

Last edited by bruno1693 at 21:22 Jan 11, 2015.
giraid
Posts: 39
Posted 21:33 Jan 11, 2015 |
bruno1693 wrote:

and the other one

I mean the url from your browser when you go to the servlet on you local server.

bruno1693
Posts: 48
Posted 21:41 Jan 11, 2015 |

ohhh, on my local server everything works, just not online /:

giraid
Posts: 39
Posted 21:43 Jan 11, 2015 |
bruno1693 wrote:

ohhh, on my local server everything works, just not online /:

yea, I know. I want to see whether you have the "/lab2/" part before the servlet in your url. If it doesn't, I might know what's going on.

bruno1693
Posts: 48
Posted 21:47 Jan 11, 2015 |

I have this:

http://localhost:8080/CS320/lab2/HelloServlet

and

http://localhost:8080/CS320/lab2/HelloJSTL.jsp

hippiewho
Posts: 46
Posted 21:52 Jan 11, 2015 |

What if u use a relative url in the source. like in my picture.

Attachments:
giraid
Posts: 39
Posted 21:55 Jan 11, 2015 |
bruno1693 wrote:

I have this:

http://localhost:8080/CS320/lab2/HelloServlet

and

http://localhost:8080/CS320/lab2/HelloJSTL.jsp

These urls look fine, I'm out of ideas too, sorry.

bruno1693
Posts: 48
Posted 22:00 Jan 11, 2015 |

My friend is having the same problem too. idk what to do anymore lol

hippiewho
Posts: 46
Posted 22:07 Jan 11, 2015 |

are you uploading the .java file or the .class file?

bruno1693
Posts: 48
Posted 22:08 Jan 11, 2015 |

the .class file

I followed everything the instructions said.

lakerfan94
Posts: 143
Posted 22:11 Jan 11, 2015 |

I'm pretty sure there's a Mac version of WinSCP that you can download. Use it. It's more organized and clear and it really helps you in knowing which files and folders you have to retrieve files from and/or upload to.

hippiewho
Posts: 46
Posted 22:13 Jan 11, 2015 |

Really the only thing I can think is the url mapping.. whats the name of the package? If its cs320.lab2 or something then under classes its supposed to be "/WEB-INF/classes/cs320/lab2/HelloServlet.class"

bruno1693
Posts: 48
Posted 22:17 Jan 11, 2015 |

yeah that's the package name I have. I used to have it like that online too, but it didn't work, so I changed it to the way the other guy had, but still didn't work

Last edited by bruno1693 at 22:20 Jan 11, 2015.
hippiewho
Posts: 46
Posted 22:19 Jan 11, 2015 |

is the file structure like the one i wrote? other than that im clueless too.

bruno1693
Posts: 48
Posted 22:22 Jan 11, 2015 |

yes like yours, so idk either lol

acervantes
Posts: 28
Posted 23:07 Jan 11, 2015 |

Bruno:

 

Please confirm that you uploaded your .CLASS files, not the .JAVA files.  

Next, confirm the URL mapping that is specified near the top of your HelloServlet Class definition in HelloServlet.java.  What is the mapping specified?

Next, which package is the Servlet defined in?

Lastly, confirm that your web.xml file has been uploaded to WEB-INF.

-Prof. Cervantes

bruno1693
Posts: 48
Posted 23:18 Jan 11, 2015 |
acervantes wrote:

Bruno:

 

Please confirm that you uploaded your .CLASS files, not the .JAVA files.  

Next, confirm the URL mapping that is specified near the top of your HelloServlet Class definition in HelloServlet.java.  What is the mapping specified?

Next, which package is the Servlet defined in?

Lastly, confirm that your web.xml file has been uploaded to WEB-INF.

-Prof. Cervantes

Here I attach a photo of the mapping at the top of the HelloServlet.java

the package for the servlet is cs320.lab2

vluu2
Posts: 64
Posted 18:12 Jan 12, 2015 |
bruno1693 wrote:
acervantes wrote:

Bruno:

 

Please confirm that you uploaded your .CLASS files, not the .JAVA files.  

Next, confirm the URL mapping that is specified near the top of your HelloServlet Class definition in HelloServlet.java.  What is the mapping specified?

Next, which package is the Servlet defined in?

Lastly, confirm that your web.xml file has been uploaded to WEB-INF.

-Prof. Cervantes

Here I attach a photo of the mapping at the top of the HelloServlet.java

the package for the servlet is cs320.lab2

The professor is talking about the cs3 server, when you uploaded the Servlet, are you uploading the HelloServlet.class or HelloServlet.java? (Supposed to be the class one) 

bruno1693
Posts: 48
Posted 18:52 Jan 12, 2015 |

Yes I had fixed it, but he told me that I couldn't have an external file with the HTML so now that I modified the .java and uploaded the class, I get an error. I get this even though the servlet has the html code already in in

vluu2
Posts: 64
Posted 19:13 Jan 12, 2015 |

You uploaded the HTML to the server? o.O I didn't do that

bruno1693
Posts: 48
Posted 19:15 Jan 12, 2015 |
vluu2 wrote:

You uploaded the HTML to the server? o.O I didn't do that

First I thought that it would be nicer and cleaner to have an external html with the servlet html so that I wouldn't have to have all the printout lines, so I did it like that, but the professor told me not to do it like that, and now that I changed my servlet class, it doesn't let me display it. I always get that damn error

 

vluu2
Posts: 64
Posted 19:20 Jan 12, 2015 |
bruno1693 wrote:
vluu2 wrote:

You uploaded the HTML to the server? o.O I didn't do that

First I thought that it would be nicer and cleaner to have an external html with the servlet html so that I wouldn't have to have all the printout lines, so I did it like that, but the professor told me not to do it like that, and now that I changed my servlet class, it doesn't let me display it. I always get that damn error

 

I'm confused by what you mean with external html........ Anyways, what does your HelloServlet link look like?

bruno1693
Posts: 48
Posted 19:32 Jan 12, 2015 |

Okay I fixed it already. My friend had the same problem, but somehow he figured it out, and he helped me with it. I just had to change the name of the package, then delete everything from the server and reupload it again so the .class will rebuild. It's a pain in the *** the damn server lol, but thank you everyone that replied and helped :D