This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Html <Head><Title> not showing the title Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Html <Head><Title> not showing the title" Watch "Html <Head><Title> not showing the title" New topic
Author

Html <Head><Title> not showing the title

Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Hi, is there a reason why my title is not visible on the page?



only Testing Servlet is shown
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Don't use "\n" ,it will not work.

You are using "println()" for writing in a new line.
Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Ankit Tripathi wrote:Don't use "\n" ,it will not work.

You are using "println()" for writing in a new line.


Any character in Java has to be a string enclosed with double quotes
Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Ankit Tripathi wrote:Don't use "\n" ,it will not work.

You are using "println()" for writing in a new line.


I've removed all the '\n' but still get the same results
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198

Any character in Java has to be a string enclosed with double quotes


Most probably I am aware of this thing.........

Line saparators are dependent of OS and are different in case of different OSs and are stored as system properties.
You can use System.getProperty("line.separator"); to find the the Line-Saparator specific to that OS.
put \n in single quotes and use it like that <html>+'\n'.
Windows programs often process a '\n' separated text file correctly but there are some exceptions.

If it'll not work-
try this-

String ls=System.getProperty("line.separator");

out.println("<html>"+ls+"<head>");

it should work.....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41089
    
  44
HTML is completely oblivious of the type of line ending being used - it's all just whitespace, and interpreted as a single space. So that has nothing to do with the problem.


Ping & DNS - my free Android networking tools app
Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Ulf Dittmer wrote:HTML is completely oblivious of the type of line ending being used - it's all just whitespace, and interpreted as a single space. So that has nothing to do with the problem.


Ulf do you perhaps know what could be the problem?
Deepakkumar Devarajan
Ranch Hand

Joined: Apr 19, 2011
Posts: 54

@sonx your code worked perfectly for me, Object ut in your code is of what type ? I removed those two statements alone..


Regards,
Deepakkumar Devarajan
Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Deepakkumar Devarajan wrote:@sonx your code worked perfectly for me, Object ut in your code is of what type ? I removed those two statements alone..




mhh, so the Title BATCH OVERRIDE LIST is displayed? strange
Deepakkumar Devarajan
Ranch Hand

Joined: Apr 19, 2011
Posts: 54

Yeah it works. I used IE7 to view the page.
Dieter Quickfend
Bartender

Joined: Aug 06, 2010
Posts: 503
    
    4

Sonx Nkuks wrote:Hi, is there a reason why my title is not visible on the page?


only Testing Servlet is shown

You do realize that the <title> tag in the <head> section shows the title on your browser window, and nothing on your page? you use <H1> etc. for page titles, <title> is just for your browser's title bar.


Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Html <Head><Title> not showing the title
 
Similar Threads
Servlet HelloWorld problem
Passing parameter to servlet from another servlet
Problems creating WAR file
PrintWriter no html to response
Need to monitor a runtime process in servlet