String output question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: String output question

  1. #1
    Join Date
    Mar 2006
    Posts
    3

    String output question

    Why wont this print?

    out.print("<LINK REL="STYLESHEET" TYPE="text/css" href="style.css">")

    How can I tell Java to ignor the special characters?

  2. #2
    Join Date
    Mar 2005
    Location
    UK, London
    Posts
    150
    Because you have not constructed the string properly

    "<LINK REL="STYLESHEET" TYPE="text/css" href="style.css">"
    it should be
    "<LINK REL='STYLESHEET' TYPE='text/css' href='style.css'>"

  3. #3
    Join Date
    Oct 2004
    Posts
    311
    Nope, not true
    When you want the output HTML code to be XHTML compliant for instance, you need to have it like <link rel="stylesheet" type="text/css" href="style.css">
    This can be done like this:
    out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">");

    when using ["] in a String in Java you need to escape it using a [\]

  4. #4
    Join Date
    Mar 2005
    Location
    UK, London
    Posts
    150
    what is not true about the fact that he did not cunstruct his string properly. I offered an alternative, it works as I use it my self. The issue was he did not construct his string correctly. So there is nothing to say nope, not true about.

Similar Threads

  1. if statements
    By airrazor in forum Java
    Replies: 11
    Last Post: 11-06-2005, 11:18 AM
  2. to use or not to use SingleThreadModel?
    By ashiers in forum Java
    Replies: 0
    Last Post: 09-09-2005, 12:17 PM
  3. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 04:53 AM
  4. verify local admin
    By Patrick Comeau in forum VB Classic
    Replies: 6
    Last Post: 03-22-2001, 11:50 PM
  5. NetUserEnum Api
    By Mike in forum VB Classic
    Replies: 2
    Last Post: 04-24-2000, 04:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center