• Post Reply Bookmark Topic Watch Topic
  • New Topic

Display Source Code in JSP

 
Albert Hopkins
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..
I'm developing a small project that displays source code examples.

what is the suitable tags can be used??
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Going through the JSP 2.0 spec and JSTL 1.1 spec will help you a lot.

Hope this helps. Thank you.
 
Albert Hopkins
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..
thanks..

but still, i can't find it out..

please help me
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: <pre> and <cut>
 
Albert Hopkins
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm sure its something very easy.

Gonna find it out.
 
Albert Hopkins
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me. An example would be very appreciated
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly do you mean by "display source code" - the source of the JSP page? Or any code styled so that it looks like properly formatted source code? Do you want to display an entire file in that page, or just an excerpt?
 
Albert Hopkins
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i just want to display source code examples in a webpage. So that people can copy & paste it.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, go with Bear's suggestions.
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When your are displaying source code it might contain characters like <,>,& etc..
So you will need to escape these special characters. have a look at the JSTL tag suggested by Bear, that will give you the answer.
 
Albert Hopkins
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what if i use

< & > ??? is it ok??

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I repeat, check out how <cut> works.
 
Albert Hopkins
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amol Nayak:
When your are displaying source code it might contain characters like <,>,& etc..
So you will need to escape these special characters. have a look at the JSTL tag suggested by Bear, that will give you the answer.


The work "escape" from Amol and hint from bear really helped.

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!