This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML display

 
Nabila Mohammad
Ranch Hand
Posts: 661
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I am trying to run an application to test cookies.
Now for some reason it's not displaying form.html located in the application folder "CookyTest" .
It was working fine initially when I did not have it linked to any servlets but now i keep getting "Resource Not Found".

I am typing http://localhost:8080/CookyTest/form.html into the browser.

Can any one suggest me what else I can check.

i have checked spelling mistakes and my Tom cat is working...Any other suggestions are welcome ! Thanks!
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2167
57
Android Chrome Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does your web-application look like (structure of the war)?

Regards,
Frits
 
Nabila Mohammad
Ranch Hand
Posts: 661
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits. Had some problem with the <url-pattern> , which is why it wasn't working

However i do have a question.

These are my two servlets

CookieTest.java





And CheckCookie.java





And I am getting the out put :

helloNabila Maximum age is -1
Path is null
Domain is null
Version is 0

CookieTest forwards to a jsp which then passes on to the CheckCookie.


I am just wondering why I am getting the max age as -1 and not as 30*60 , the way i set it initially.....
 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nabila,

(sorry Frits for hijacking)

If I read this right, you add a cookie to your response...do a few forwards and read it from the request ?
Well it hasn't been to a browser yet or anything, so nobody put it on your request. So you wont get it if you read it of course..


grtz Mark
 
Nabila Mohammad
Ranch Hand
Posts: 661
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm.. I am getting a lil confused ...but I think I am getting your point....
So how would i modify the code to make it work...
 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of forwarding, surf to your first page CookieTest (make it doGet instead of doPost). This will add the cookie to the response and send it to the browser.
Then surf to your CheckCookie page to view your cookie.

Notice that the browser received the cookie from the response of CookieTest, and will send it in the new request to CheckCookie
So CheckCookie will receive a cookie then.

 
Nabila Mohammad
Ranch Hand
Posts: 661
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the doPost to doGet and now i am getting "HTTP method POST is not supported by this URL" even though i changed the form method to Get in the html file.

Anyway , what i was wondering was when you mentioned about surfing to a different Servlet ie. CheckCookie , did you mean using response.sendRedirect(.....) or is there a different way...?
 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the doPost to doGet and now i am getting "HTTP method POST is not supported by this URL" even though i changed the form method to Get in the html file.


Perhaps the web page is still in your cache, try a control F5

Also, use firefox, and install firebug. Its an incredible help and web development without is is 100 times harder.
you can see what the browser sends over the wire for example.


is there a different way...?

you could simply surf to it , but a sendRedirect will also work since that does the same but without user interaction.

Are you reading HFSJ ?
 
Nabila Mohammad
Ranch Hand
Posts: 661
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me give it a try again..

Yep I am reading HFSJ.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic