www.webdeveloper.com
Results 1 to 10 of 10

Thread: Line Break

  1. #1
    Join Date
    Sep 2011
    Posts
    12

    Line Break

    Trying to do a break between a from and a link. It keeps putting the link beside the table instead of underneath. Can you help?

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Login</title>");
    out.println("</head>");
    out.println("<BODY BGCOLOR=357EC7>");
    out.println("<form name=Login action=Login method=post>");
    out.println("<table BORDER=0 COLS=2");
    out.println("<th BGCOLOR=#191970 align=Left>");
    out.println("<td style=color:white colspan=2><font size=4 face=Georgia>Login");
    out.println("<tr BGCOLOR=#B0C4DE align=Left>");
    out.println("<td width=100>Username:");
    out.println("<td><Input type=text name=username>");
    out.println("<tr BGCOLOR=#B0C4DE align=Left>");
    out.println("<td width=100>Password:");
    out.println("<td><Input type=password name=password</td></tr>");
    out.println("<tr BGCOLOR=#191970>");
    out.println("<td align=right><Input type=SUBMIT name=Submit value=Submit></td>");
    out.println("</table></br>");{
    out.println("<table>");
    out.println("<A style=color:black HREF=Servlet>click here to proceedr</A>");
    out.println("</table>");
    out.println("</form>");
    out.println("</BODY></HTML>");
    }
    } finally {
    out.close();
    }
    }

  2. #2
    Join Date
    Sep 2011
    Location
    Memphis, TN
    Posts
    5
    you have to put the link in a table cell

    Code:
    <table>
    <tr>
    <td>
    <a href="url">url</a>
    </td>
    </tr>
    </table>

  3. #3
    Join Date
    Sep 2011
    Posts
    12
    Unfortunately, it's still not working.!!!

  4. #4
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    Several typos in HTML : <table BORDER=0 COLS=2>, <Input type=password name=password > a <table> whitout <tr><td> no DOCTYPE and depreciated bgcolor...
    An alternative ?
    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Login</title>
    <style type="text/css">
    body{background-color:#357EC7;}
    table {background-color:#191970;}
    table th {color:#FFFFFF;font-size:4;font-family:Georgia;text-align:left;width:100px;}
    table td {background-color:#B0C4DE;text-align:left;width:100px;}
    input{width:120px;}
    a {color:black;}
    p {margin:0}
    </style>
    </head>
    <body>
    <form name="Login" action="Login" method="post"> 
    <table cellpadding="3">
    <tr><th colspan="2">Login</th></tr>
    <tr><td>Username:</td><td><input type="text" name="username"></td></tr>
    <tr><td>Password:</td><td><input type="password" name="password"></td></tr>
    <tr><th colspan="2"><input type="submit" name="submit" value="Submit"></th></tr>
    </table>
    <p><a href="Servlet">click here to proceed</a></p>
    </form>
    </body>
    </html>

  5. #5
    Join Date
    Sep 2011
    Posts
    12
    thanks! it works in a html form that i already have...do you have a solution based on the format (servlet) that I submitted?

  6. #6
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    Java is not javascript ! Probably, you have only to print this code line by line... You can group lines and have probably to escape the quotes like here.

    HTML Code:
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
    out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">");
    out.println("<html lang=\"en\"><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">");
    //....
    }
    } finally {
    out.close();
    }
    } 

  7. #7
    Join Date
    Sep 2011
    Posts
    12
    Ok---I'm getting closer. The code below puts the link outside of the form but at the top of the page instead of underneath the table.
    try {
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Login</title>");
    out.println("</head>");
    out.println("<BODY BGCOLOR=357EC7>");
    out.println("<form name=Login action=Servlet method=post>");
    out.println("<table BORDER=0 COLS=2");
    out.println("<tr BGCOLOR=#191970 align=Left>");
    out.println("<td style=color:white colspan=2>Login</tr>");
    out.println("<tr BGCOLOR=#B0C4DE align=Left>");
    out.println("<td width=100>Username:");
    out.println("<td><Input type=text name=username></tr>");
    out.println("<tr BGCOLOR=#B0C4DE align=Left>");
    out.println("<td width=100>Password:");
    out.println("<td><Input type=password name=password</td></tr>");
    out.println("<tr BGCOLOR=#191970>");
    out.println("<td align=right><Input type=SUBMIT name=Submit value=Submit></td>");
    out.println("<td align=left><Input type=Reset name=Reset value=Reset></td></tr>");
    out.println("</form>");
    out.println("<p><A style=color:black HREF=Servlet>Click Here</A></p>");
    out.println("</BODY></HTML>");
    } finally {
    out.close();
    }

  8. #8
    Join Date
    Sep 2011
    Posts
    12
    when I add
    out.println("</table>

    it puts it on the side of the table instead of the bottom

  9. #9
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    Your code is broken ! See HTML table ... Browsers have made progress and admit no more broken codes...
    Quote Originally Posted by newbee4126 View Post
    Ok---I'm getting closer. The code below puts the link outside of the form but at the top of the page instead of underneath the table.
    try {
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Login</title>");
    out.println("</head>");
    out.println("<BODY BGCOLOR=357EC7>");
    out.println("<form name=Login action=Servlet method=post>");

    out.println("<table BORDER=0 COLS=2>");This table tag is not closed
    out.println("<tr BGCOLOR=#191970 align=Left>");
    out.println("<td style=color:white colspan=2>Login</tr>");the tr tag is closed before the td tag
    out.println("<tr BGCOLOR=#B0C4DE align=Left>");
    out.println("<td width=100>Username:");the td tag isn't closed before the new td
    out.println("<td><Input type=text name=username></tr>");;the td tag isn't closed
    ...
    Last edited by 007Julien; 09-24-2011 at 04:39 PM.

  10. #10
    Join Date
    Sep 2011
    Posts
    12
    YAHOO!!! That works!! Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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



Recent Articles