Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom tag not being recognized  RSS feed

 
Frank Serkland
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following JSP with two custom tags, one of which is being recognized, the other of which is not. Here is the JSP, followed by the TLD. In the JSP, the tag in line 21 is the one that's working, and the tag in line 24 is the one with the problem. Any ideas?



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any errors in the logs?

What's being rendered into the HTML being sent to the browser?
 
Frank Serkland
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Any errors in the logs?


No errors in the logs, but Eclipse is highlighting it and saying, "Unknown tag(mytag: myPollResults)".

Bear Bibeault wrote:What's being rendered into the HTML being sent to the browser?


The HTML being rendered for that line is simply this:



For what it's worth, here is the code for my tag. It is supposed to print out some HTML.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you are sure that the other tag is rendering properly?
 
Frank Serkland
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:And you are sure that the other tag is rendering properly?


Well, there's no HTML statements being output, but I'm no longer sure if the other tag is working. Here is what I have for it. It's supposed to return a cookie to the JSP.

 
Frank Serkland
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank Serkland wrote:Well, there's no HTML statements being output, but I'm no longer sure if the other tag is working.


I have now verified using different browsers that the first tag is not being called when a cookie is present, but it is called when there is no cookie. I put a System.out.println() statement in it, and when I ran the JSP, that statement did not print out. The tag is in a place where it is supposed to be called regardless of whether the cookie it's supposed to find is present or not. This is all in spite of the fact that I wrote this tag to detect the presence of the cookies. Any ideas out there about why the tag isn't working?
 
Vijitha Kumara
Bartender
Posts: 3973
24
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank Serkland wrote:I put a System.out.println() statement in it, and when I ran the JSP, that statement did not print out...

Is it not printed in your server logs or the page being rendered?
 
Frank Serkland
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:
Frank Serkland wrote:I put a System.out.println() statement in it, and when I ran the JSP, that statement did not print out...

Is it not printed in your server logs or the page being rendered?


It's not printed in the server logs.
 
Frank Serkland
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank Serkland wrote:
Vijitha Kumara wrote:
Frank Serkland wrote:I put a System.out.println() statement in it, and when I ran the JSP, that statement did not print out...

Is it not printed in your server logs or the page being rendered?


It's not printed in the server logs.


Okay, the System.out.println() statement is always being printed now, for whatever reason. I didn't do anything to the code, but I won't complain.

Back to the original question. I will re-paste the code here for everyone's convenience. Below is my JSP. When the cookie is not present, I get the poll question, which is correct. When the cookie is present, the JSP is not calling the tag in line 24 because it doesn't recognize it, and that's not correct. Instead, nothing is rendered in the browser. The HTML code for what's rendered in the browser is exactly what appears below in line 24. Any ideas?



This is my TLD.
 
Frank Serkland
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank Serkland wrote:Back to the original question.


I have solved this issue by giving up on a second tag and simply doing a database call in the first tag and returning them from there.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!