Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes JSP - cookie not processing as it should Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP - cookie not processing as it should " Watch "JSP - cookie not processing as it should " New topic
Author

JSP - cookie not processing as it should

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: Feb 24, 2006
Posts: 6662
    
    5

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


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP - cookie not processing as it should