Easy way to display JSP source on web  
Author Message
Andrew Thompson





PostPosted: 2003-12-6 6:15:00 Top

java-programmer, Easy way to display JSP source on web I need an easy way to display JSP source in a
web page.

If I use..
<jsp:include page="/test/index.jsp" ></jsp:include> or
<%@ include file="/test/index.jsp" %>
..the jsp I want to include is merged with the
original page and (usually) throws exceptions.

Is there any way to include a jsp in a web page
but have it treated as if it were text?


 
Andrew Thompson





PostPosted: 2003-12-6 6:18:00 Top

java-programmer >> Easy way to display JSP source on web "Andrew Thompson" <email***@***.com> wrote in message
news:pr7Ab.41011$email***@***.com...
> I need an easy way to display JSP source in a
> web page.

Or rather, another JSP. (..Duh!)

> If I use..
> <jsp:include page="/test/index.jsp" ></jsp:include> or
> <%@ include file="/test/index.jsp" %>
> ..the jsp I want to include is merged with the
> original page and (usually) throws exceptions.
>
> Is there any way to include a jsp in a web page
> but have it treated as if it were text?
>
> --
> Andrew Thompson
> * http://www.PhySci.org/ PhySci software suite
> * http://www.1point1C.org/ 1.1C - Superluminal!
> * http://www.AThompson.info/andrew/ personal site


 
Wendy S





PostPosted: 2003-12-6 7:16:00 Top

java-programmer >> Easy way to display JSP source on web "Andrew Thompson" <email***@***.com> wrote
in message news:pr7Ab.41011$email***@***.com...
> I need an easy way to display JSP source in a
> web page.

I don't suppose it's as simple as wrapping it in <pre> tags? Works with
other stuff...

--
Wendy in Chandler, AZ


 
 
Andrew Thompson





PostPosted: 2003-12-6 7:29:00 Top

java-programmer >> Easy way to display JSP source on web "Wendy S" <email***@***.com> wrote in message
news:bqr3jd$hsi$email***@***.com...
> "Andrew Thompson" <email***@***.com> wrote
> in message news:pr7Ab.41011$email***@***.com...
> > I need an easy way to display JSP source in a
> > web page.
>
> I don't suppose it's as simple as wrapping it in <pre> tags? Works with
> other stuff...

Unfortunately not. Here are some URL's of
stuff I have been working on, the first two use
TEXTAREA,
http://localhost:8080/codes/display.jsp?fl=index.jsp
http://localhost:8080/codes/display.jsp?fl=index.jsp?zip=ps
the third uses PRE..
http://localhost:8080/codes/display2.jsp?fl=index.jsp

I could use some classes I already have that
grab a file or URL as a string, but I still think
there must be an easier way..


 
 
Andrew Thompson





PostPosted: 2003-12-6 7:34:00 Top

java-programmer >> Easy way to display JSP source on web "Andrew Thompson" <email***@***.com> wrote in message
news:Vw8Ab.41061$email***@***.com...
> "Wendy S" <email***@***.com> wrote in message
> news:bqr3jd$hsi$email***@***.com...
> > "Andrew Thompson" <email***@***.com> wrote
> > in message news:pr7Ab.41011$email***@***.com...
> > > I need an easy way to display JSP source in a
> > > web page.
> >
> > I don't suppose it's as simple as wrapping it in <pre> tags? Works with
> > other stuff...
>
> Unfortunately not. Here are some URL's of
> stuff I have been working on, the first two use
> TEXTAREA,
> http://localhost:8080/codes/display.jsp?fl=index.jsp
> http://localhost:8080/codes/display.jsp?fl=index.jsp?zip=ps
> the third uses PRE..
> http://localhost:8080/codes/display2.jsp?fl=index.jsp

D'Oh! lemme try that again.

http://www.physci.org/codes/display.jsp?fl=index.jsp
http://www.physci.org/codes/display.jsp?fl=index.jsp?zip=ps
and..
http://www.physci.org/codes/display2.jsp?fl=index.jsp

>
> I could use some classes I already have that
> grab a file or URL as a string, but I still think
> there must be an easier way..
>
> --
> Andrew Thompson
> * http://www.PhySci.org/ PhySci software suite
> * http://www.1point1C.org/ 1.1C - Superluminal!
> * http://www.AThompson.info/andrew/ personal site
>
>


 
 
Chris Smith





PostPosted: 2003-12-6 7:58:00 Top

java-programmer >> Easy way to display JSP source on web Andrew Thompson wrote:
> D'Oh! lemme try that again.
>
> http://www.physci.org/codes/display.jsp?fl=index.jsp
> http://www.physci.org/codes/display.jsp?fl=index.jsp?zip=ps
> and..
> http://www.physci.org/codes/display2.jsp?fl=index.jsp

Okay, so try <pre> *and* run the file contents (as a String) by this
first:

str = str.replaceAll("\\<", "<");
str = str.replaceAll("\\>", ">");
str = str.replaceAll("\\\"", """);

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
 
Sudsy





PostPosted: 2003-12-6 12:50:00 Top

java-programmer >> Easy way to display JSP source on web Wendy S wrote:
> "Andrew Thompson" <email***@***.com> wrote
> in message news:pr7Ab.41011$email***@***.com...
>
>>I need an easy way to display JSP source in a
>>web page.
>
>
> I don't suppose it's as simple as wrapping it in <pre> tags? Works with
> other stuff...
>

Even if you designate content as preformatted, tags still get
interpreted. I use bold tags and the like in preformatted text
all the time. The key is to escape the interpretation of the
tag start marker, namely the left angle bracket. Best to run
it through some form of processor which converts it to the
proper sequence first.

 
 
Andrew Thompson





PostPosted: 2003-12-7 19:44:00 Top

java-programmer >> Easy way to display JSP source on web "Andrew Thompson" <email***@***.com> wrote in message
news:pr7Ab.41011$email***@***.com...
> I need an easy way to display JSP source in a
> web page.

Thanks to Wendy, Chris and Sudsy for your advice.

You can see my implementation, here..
http://www.physci.org/codes/display.jsp?fl=codes%2Fdisplay.jsp

Now that I see it, the original question
does seem kind of silly. :)

It is probably not very robust, but it seems to
work well enough for my purposes, ..well enough
to come in here screaming "Why won't my JSP
work?!? Here's the code.." ;-)