• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Including Code From Another Source on a JSP

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, just a simple question today.

When writing a simple tag (JSP 2.0 tag) is it strictly forbidden to use html tags?

As a further question, what if I had code which was repeated on like 100 different jsp pages that was ALL html tags. Would it be a gross violation to use simple tags.

I guess I ask this just because I could technically have all flavors of includes (.html, .jspf, .jsp, .tag, .tld) and I really do not want this kind of mixture on a individual jsp page. I would prefer a more homogenous solution.

Thanks.

-Greg
 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Greg Werner wrote:Hi all, just a simple question today.

When writing a simple tag (JSP 2.0 tag) is it strictly forbidden to use html tags?

As a further question, what if I had code which was repeated on like 100 different jsp pages that was ALL html tags. Would it be a gross violation to use simple tags.

I guess I ask this just because I could technically have all flavors of includes (.html, .jspf, .jsp, .tag, .tld) and I really do not want this kind of mixture on a individual jsp page. I would prefer a more homogenous solution.

Thanks.

-Greg



You can put html code in a tag-file, of course.
If you have repeated code in 100 jsps you should put it in a tag file, why to have repited code? When you say simple tags are you meaning tag-files or SimpleTag?
 
Marshal
Posts: 67514
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Greg Werner wrote:When writing a simple tag (JSP 2.0 tag) is it strictly forbidden to use html tags?

Where did you get that notion? The whole idea of tag files is to be able to easily create tags using markup. Besides, HTML tags aren't tags at all to a JSP engine. It's just meaningless template text.

As a further question, what if I had code which was repeated on like 100 different jsp pages that was ALL html tags. Would it be a gross violation to use simple tags.

Not at all.

 
Greg Werner
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean .tag files, for instance:

Like I put when I want to include it on a page,

I put when I want to use the tag

And my feedback.tag would be

So what I am trying to do in this case is write a div which belongs on a great number of pages in a .tag file.
 
Bear Bibeault
Marshal
Posts: 67514
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go for it.
 
Albareto McKenzie
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, of course you can do that. For example I use them for including code that goes always at the beginning and at the end of all the jsps, I have a tag
<mytags:addContent>

other tags and jsp content

</mytags:addContent>

and in that tag I have the tipical <body> <html> <head>, etc... and the tag closings but I have just one file.
 
Greg Werner
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

Greg Werner wrote:When writing a simple tag (JSP 2.0 tag) is it strictly forbidden to use html tags?

Where did you get that notion?



That is what I thought. I guess I am paying too much attention to the Eclipse 3.4.x warnings which complain anytime you put an html tag in a .tag file. And this is because Eclipse probably does not know what a .tag file is I am guessing? Ok this becomes an Eclipse issue. Thank you very much your answer.
 
Bear Bibeault
Marshal
Posts: 67514
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, IDE warnings are frequently more wrong than they are right.
 
Albareto McKenzie
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have seen Eclipse telling me that <body> tag is wrong because it didn't recognize it Just don't pay attention to the warnings in html-related code in Eclipse.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse will only complain about things like that if you have mis-matched tags, which can happen depending on how you're breaking up your content. Personally I don't really like breaking things up in a way that puts mis-matched (including missing) tags in a single file--it's far too easy to make a mistake that way, and it seems like it's nearly always avoidable.
 
Albareto McKenzie
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Eclipse will only complain about things like that if you have mis-matched tags, which can happen depending on how you're breaking up your content. Personally I don't really like breaking things up in a way that puts mis-matched (including missing) tags in a single file--it's far too easy to make a mistake that way, and it seems like it's nearly always avoidable.



That's not compleatly true (or not in my case :P ) cause in my Eclipse, in this piece of code it's complaining about the </div>



In the <div> it says that is an unknown tag and a warning is shown, but in the </div> it directly says error (no explanation and red line under de sentence), which is strange. I don't care too much about this, if the code works is fine for me.
 
Bear Bibeault
Marshal
Posts: 67514
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As this has become an IDE discussion, this topic has been moved to the IDEs forum.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK.
 
Get me the mayor's office! I need to tell her about this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic