Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Source code not visible in browser

Reply
Thread Tools

Source code not visible in browser

 
 
Mikey
Guest
Posts: n/a
 
      01-25-2006
I am new to servlets and I have a question about viewing the response
source code on my browser. I'm not sure if this is a problem with my
response headers or what.

My servlet creates a response and sends it back to the browser where it
is displayed correctly. However, when I attempt to view the source code
in the browser (both IE and Netscape) the display is blank.

The servlet code is:

res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n" +
"<HTML>\n" +
"<HEAD><TITLE>Submit Experiment
Results</TITLE></HEAD>\n" +
"<BODY>\n" +
"<br><br><br><br><center>\n" +
"<H2>Experimental Results Recorded</H2>\n" +
"<table border=\"1\" width=\"500\" cellpadding=\"10\"
cellspacing=\"0\"><tr><td>" +

"<H3>Your submitted data have been recorded. You can
either proceed to having your results gradded or click the \"Back\"
button on your browser to again review your data.</H3>\n" +
"</td></tr>" +

"<tr><td>" +
"<H3>After you have clicked the \"Grade Results\"
button, an email with your score will be sent to both you and your
instructor.</H3>\n" +

"</td></tr></table>" +

"</center></BODY></HTML>");

As I develop the servlet code I would like to be able to view the
received html file on the browser for debugging purposes.

Any help would be appreciated.

Thanks.

 
Reply With Quote
 
 
 
 
Joe Attardi
Guest
Posts: n/a
 
      01-25-2006
Mikey wrote:
> My servlet creates a response and sends it back to the browser where it
> is displayed correctly. However, when I attempt to view the source code
> in the browser (both IE and Netscape) the display is blank.


Hey Mikey,

Not sure about this problem, but you would be better off using a JSP to
display your results in the browser. It's much easier to read the code,
and is generally just a good practice.

 
Reply With Quote
 
 
 
 
zero
Guest
Posts: n/a
 
      01-25-2006
"Mikey" <(E-Mail Removed)> wrote in news:1138205075.563497.44970
@g44g2000cwa.googlegroups.com:

> My servlet creates a response and sends it back to the browser where it
> is displayed correctly. However, when I attempt to view the source code
> in the browser (both IE and Netscape) the display is blank.


If the browser displays the page correctly, it means it's receiving the
source code correctly. You should be able to use the browser's "view page
source" or similar to see the html source.
 
Reply With Quote
 
Oliver Wong
Guest
Posts: n/a
 
      01-25-2006

"zero" <(E-Mail Removed)> wrote in message
news:Xns9756C29EA897Ezerothishi@195.130.132.70...
> "Mikey" <(E-Mail Removed)> wrote in news:1138205075.563497.44970
> @g44g2000cwa.googlegroups.com:
>
>> My servlet creates a response and sends it back to the browser where it
>> is displayed correctly. However, when I attempt to view the source code
>> in the browser (both IE and Netscape) the display is blank.

>
> If the browser displays the page correctly, it means it's receiving the
> source code correctly. You should be able to use the browser's "view page
> source" or similar to see the html source.


Zero is correct. You may need to scroll around (i.e. horizontally and/or
vertically) to get visible characters (as opposed to whitespace) in the
source viewing window.

- Oliver


 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      01-25-2006
On Wed, 25 Jan 2006 18:07:54 GMT, zero <(E-Mail Removed)> wrote, quoted or
indirectly quoted someone who said :

>If the browser displays the page correctly, it means it's receiving the
>source code correctly. You should be able to use the browser's "view page
>source" or similar to see the html source.


An HTML validator will help you ferret out errors your eye overlooks
in the generated HTML.

See http://mindprod.com/jgloss/htmlvalidator.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
Noodles Jefferson
Guest
Posts: n/a
 
      01-26-2006
In article <(E-Mail Removed). com>, Mikey
took the hamburger, threw it on the grill, and I said "Oh wow"...

> I am new to servlets and I have a question about viewing the response
> source code on my browser. I'm not sure if this is a problem with my
> response headers or what.
>
> My servlet creates a response and sends it back to the browser where it
> is displayed correctly. However, when I attempt to view the source code
> in the browser (both IE and Netscape) the display is blank.
>
> The servlet code is:
>
> res.setContentType("text/html");
> PrintWriter out = res.getWriter();
> out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
> "Transitional//EN\">\n" +
> "<HTML>\n" +
> "<HEAD><TITLE>Submit Experiment
> Results</TITLE></HEAD>\n" +
> "<BODY>\n" +
> "<br><br><br><br><center>\n" +
> "<H2>Experimental Results Recorded</H2>\n" +
> "<table border=\"1\" width=\"500\" cellpadding=\"10\"
> cellspacing=\"0\"><tr><td>" +
>
> "<H3>Your submitted data have been recorded. You can
> either proceed to having your results gradded or click the \"Back\"
> button on your browser to again review your data.</H3>\n" +
> "</td></tr>" +
>
> "<tr><td>" +
> "<H3>After you have clicked the \"Grade Results\"
> button, an email with your score will be sent to both you and your
> instructor.</H3>\n" +
>
> "</td></tr></table>" +
>
> "</center></BODY></HTML>");
>
> As I develop the servlet code I would like to be able to view the
> received html file on the browser for debugging purposes.
>
> Any help would be appreciated.
>
> Thanks.


You won't see the source code, just the generated code for the page.

--
Noodles Jefferson
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

NP: "Icicle" (Tour Rehearsal) -- Tori Amos

"Our earth is degenerate in these latter days, bribery and corruption
are common, children no longer obey their parents and the end of the
world is evidently approaching."
--Assyrian clay tablet 2800 B.C.
 
Reply With Quote
 
Mikey
Guest
Posts: n/a
 
      01-26-2006
I agree. The page displays fine but the received html does not display
completely, or at all, when I view source code.

Thanks for all your comments.

 
Reply With Quote
 
Mikey
Guest
Posts: n/a
 
      01-26-2006
Thanks for the reply Joe. Do you have a reference where I could get
some details on your suggestion.

Thanks again.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide textbox / Make textbox not visible (NOT USING visible property) Jurjen de Groot ASP .Net Web Controls 0 05-19-2008 09:50 AM
Can Jscript source code be visible in a browser? WRH ASP .Net 9 11-08-2005 07:17 PM
How to make a hyperlink Visible or not visible in DataList Patrick Olurotimi Ige ASP .Net 7 06-15-2005 12:01 PM
Sections visible and not visible tshad ASP .Net 4 01-31-2005 09:30 PM
button visible/not visible tshad ASP .Net 6 10-28-2004 10:02 PM



Advertisments