Results 1 to 10 of 10
  1. #1
    Patit Pawan is offline Member
    Join Date
    Jul 2014
    Posts
    5
    Rep Power
    0

    Default Velocity framework creating unnecessary rows and column

    When i am sending email using velocity framework, the table is creating
    unnecessary rows and columns . I dont understand why its comming
    if anybody has any idea about it.

    test.vm

    <table border='2'>
    <tbody>
    #foreach($user in $users)
    <tr> <td> $user.division</td> <td> $user.customer</td>
    <td> $user.invoiceNumber</td>
    <td> $user.billedDate </td>
    <td align='right'>$user.billedAmount</td>
    </tr>
    #end
    </tbody>

    </table>
    ------------------------
    Here is the email i got where you can see extra rows and columns are generated automatically...

    Velocity framework creating unnecessary rows and column-table.png

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,104
    Rep Power
    6

    Default Re: Velocity framework creating unnecessary rows and column

    That template does not generate that content. Its very easy to see why: your template defines no table headers, yet in your screenshot there are.

    So you're not using the template you think you are using to generate this email body.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    Patit Pawan is offline Member
    Join Date
    Jul 2014
    Posts
    5
    Rep Power
    0

    Default Re: Velocity framework creating unnecessary rows and column

    Quote Originally Posted by gimbal2 View Post
    That template does not generate that content. Its very easy to see why: your template defines no table headers, yet in your screenshot there are.

    So you're not using the template you think you are using to generate this email body.

    hi gimbal2 thanks for reviewing the question....

    the screen shot i have taken of the new code where i have added the table header...
    yes the template is being used to generate the email body

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: Velocity framework creating unnecessary rows and column

    Well, your header has a problem because it clearly has more columns than the data you are supplying.
    So show the whole table construction.

    Show the HTML produced as well, not the display.
    The resulting HTML is more important than what a browser/email client displays it as.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Patit Pawan is offline Member
    Join Date
    Jul 2014
    Posts
    5
    Rep Power
    0

    Default Re: Velocity framework creating unnecessary rows and column

    Quote Originally Posted by Tolls View Post
    Well, your header has a problem because it clearly has more columns than the data you are supplying.
    So show the whole table construction.

    Show the HTML produced as well, not the display.
    The resulting HTML is more important than what a browser/email client displays it as.
    Thanks
    For your time Tolls and gimbal2 ,

    actually i was trying to identify the <br> tag in the string which is generated by the mergeTemplateIntoString() and replace with "\n" so i was getting error, i have commeted and tried and it worked........thanks guys for your valueable time.....

    **********************Here is the code***********

    String text = VelocityEngineUtils.mergeTemplateIntoString(veloci tyEngine, templatePath, "utf-8", model);
    // text = text.replaceAll("\n", "<br>");

    **********************************************

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: Velocity framework creating unnecessary rows and column

    And this is yet another example of why people posting have to provide proper information.
    In your case, if you'd provided the full (relevant) table code from the template, and the full table HTML produced, it would have been obvious something else was going on.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,104
    Rep Power
    6

    Default Re: Velocity framework creating unnecessary rows and column

    I need hard liquor now. And I don't even drink alcohol.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: Velocity framework creating unnecessary rows and column

    Quote Originally Posted by gimbal2 View Post
    I need hard liquor now. And I don't even drink alcohol.
    But you're Dutch!
    I thought that was a national pastime...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,104
    Rep Power
    6

    Default Re: Velocity framework creating unnecessary rows and column

    Jeez, now we're a nation of alcoholics too? I mean recently we've already all been slated as racists who promote slavery, and now this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: Velocity framework creating unnecessary rows and column

    You're clearly on the right path...you're almost British!
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 0
    Last Post: 12-31-2013, 04:36 AM
  2. Replies: 1
    Last Post: 03-28-2012, 02:37 PM
  3. TextArea size with column and rows!!
    By jspexception in forum AWT / Swing
    Replies: 4
    Last Post: 01-04-2012, 07:22 AM
  4. Replies: 4
    Last Post: 03-25-2011, 01:06 PM
  5. Fix the rows and column of JTextPane
    By anilkumar_vist in forum Advanced Java
    Replies: 2
    Last Post: 09-09-2010, 08:16 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •