开发者

Inserting into DB in JPA in play Framework

I am finding difficult to display the template in play framework using groovy

#{list users, as:'user'} 
    <li>${user}</li>
#{/list}

#{list items:0..10, as:'i'} 
  ${i}
#{/list}

How to combine the above 2 to display like this

  1. My Name

  2. Pla开发者_开发问答ys Name

  3. Groovy Name


If I understand you correctly, this is pretty easy to achieve.

To do this in Groovy, using Play, You can simply do

#{list users, as:'user'} 
    <li>${user_index}. ${user}</li>
#{/list}

See the list tag for more details. http://www.playframework.org/documentation/1.2.2/tags#list

Obviously, you could have just done this with an OrderedList in HTML, using outside of the List tag, which by default in HTML will show a numbered list.

So, your code could simply be

<ol>
#{list users, as:'user'} 
    <li>${user}</li>
#{/list}
</ol>


No real idea of what your example output is meant to show, but I assume you have:

<ul>
  #{list users, as:'user'} 
    <li>${user}</li>
  #{/list}
</ul>

If you change it to <ol> instead of <ul>, you will get an ordered list with numbers:

<ol>
  #{list users, as:'user'} 
    <li>${user}</li>
  #{/list}
</ol>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜