Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

HTML display  RSS feed

 
Ranch Hand
Posts: 664
  • 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!
 
Creator of Enthuware JWS+ V6
Bartender
Posts: 3117
259
Android Chrome Eclipse IDE
  • 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: 664
  • 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.....
 
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • 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: 664
  • 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
  • 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: 664
  • 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
  • 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: 664
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me give it a try again..

Yep I am reading HFSJ.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!