Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Source code not visible in browser

Thread view: 
Mikey - 25 Jan 2006 16:04 GMT
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.
Joe Attardi - 25 Jan 2006 16:32 GMT
> 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.
Mikey - 26 Jan 2006 22:30 GMT
Thanks for the reply Joe. Do you have a reference where I could get
some details on your suggestion.

Thanks again.
zero - 25 Jan 2006 18:07 GMT
"Mikey" <mike.gunn@comcast.net> 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.
Oliver Wong - 25 Jan 2006 19:15 GMT
> "Mikey" <mike.gunn@comcast.net> wrote in news:1138205075.563497.44970
> @g44g2000cwa.googlegroups.com:
[quoted text clipped - 6 lines]
> 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
Roedy Green - 25 Jan 2006 19:59 GMT
>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
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Noodles Jefferson - 26 Jan 2006 04:41 GMT
> 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
[quoted text clipped - 39 lines]
>
> Thanks.

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

Signature

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.

Mikey - 26 Jan 2006 22:21 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.