• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP - cookie not processing as it should

 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've been trying to get the jsp to display a table to show the name enter from a form.

However, it doesn't show the table which will display the Name, Value and Comments.

Hope someone can advise me where have I gone wrong with my codes. Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, why are you using out.print to emit HTML code? That's why we use JSP in the first place... so that we can just use template text for HTML.

Secondly, you are not generating valid HTML. Do a View Source in the browser and look at the HTML that is being sent to the browser. You'll see that it's a mess.
 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. I will remove the html portion.

But, please advise the jsp portion how to make it correct. Sorry this is my first attempt in a jsp so not very sure.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not clear that there's anything wrong with your JSP at all... except for the fact that you are putting Java code in a JSP -- a practice that has been frowned upon for over 8 years now.

If your JSP is not creating valid HTML, the display will not be correct. Making sure that valid HTML is being generated is the first step to even determining if there are any other problems.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cookie c is never assigned a value. And ++ on what Bear said. Why is java+jsp code together like that ? Separate your view components and place them in your JSP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic