2

I get acquainted with j2html and I try a make table, but have some problems:

  main().with(
                    table(

                            tr(
                                    td().with(
                                            img().withSrc(imagePath+photo)

                                    )

                                    td().with(
                                            span(name)
                                    ),
                                    td().with(
                                            span(String.valueOf(quantity))
                                    )

after img().withSrc(imagePath+photo) I see mistake, but I don't understand what want from me Idea May be you can show how create table with image+name+ some quontity + colspan for several cells

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
Viking
  • 177
  • 5
  • 16
  • 1
    Seems to me you want a comma after the `)` on the line after the `img().withSrc` line. If this is Java code. (Or JavaScript. Or any of several related languages.) – T.J. Crowder Sep 30 '16 at 15:12
  • I try comma, it's not working. This framework allow in java the create web application – Viking Sep 30 '16 at 16:24

1 Answers1

3

(pre v.1.0.0): The tag-methods don't accept DomContent children, so you need to do table().with(, td().with( etc, not just table( and td(:

String htmlTable = table().with(
    tr().with(
        td().with(
            img().withSrc("path" + "photo")
        ),
        td().with(
            span("name")
        ),
        td().with(
            span(String.valueOf("quantity"))
        )
    )
).render();
tipsy
  • 402
  • 4
  • 15