Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hidden variable syntax not working in servlets

 
puja shaw
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone please run the above example and tell me why it isnt working.I found out that the problem is with the hidden variable syntax.If so ,please can anyone tell me the solution for the below program th work.











 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch puja shaw.

I have applied code tag to your post to make more readable.

Coming to your question, yes as you smelled the problem is in hidden tag .
*scriptlet is for jsp not for servlet * . here scriptlet is not required. you can use variable directly as in
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<servlet-class>MyCookieExample</servlet-class>


I do hope that is not your real web.xml - ALL classes used in a servlet or jsp MUST be in a package. The reason being that if no package is specified, the JVM looks for a class file in the "current" directory, something you have no control over in a server environment.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you emitting HTML from a servlet rather than using a JSP?
 
puja shaw
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yes i understand my mistake now.Thankyou very much for helping me.My program did work fine now.Thankyou for fixing it for me.
 
puja shaw
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Mr bill.Thankyou very much for your suggestion.I will keep this in mind and i will make sure that next time when i write servlets ,i will put them in a package.Thankyou.
 
puja shaw
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i havent yet started using jsp's.Right now i am practising servlets.Thats the reason i used static content in servlets.But i agree that this is not a good idea.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic