How create table use j2html?

拟墨画扇 提交于 2019-12-11 04:53:37

问题


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


回答1:


(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();


来源:https://stackoverflow.com/questions/39794735/how-create-table-use-j2html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!