Announcement Announcement Module
Collapse
No announcement yet.
Mysterious values after store params in variable ~50 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mysterious values after store params in variable ~50

    Hello,

    In the beginning of a controller i have the following code where i read the params for pagenation:
    Code:
    println "a1: "+params.offset
    println "b1: "+params.max
            
    int offset = params.offset ?: 0
    int max = params.max ?: 2
    if(max > 100) max = 100
    
    println "a2: "+offset
    println "b2: "+max
    I get the following output in the consol:
    Code:
    a1: 2
    b1: 2
    a2: 50
    b2: 50
    Where do this 50 come from ? I had the same problem a time ago, too: http://www.spieleprogrammierer.de/20...25/#post256591 in a other controller.

    It is always a number near 50. But i want the value passed from the params. What do i wrong ?

    Regards
    Hetzge

  • #2
    Get the same problem again and now i found the mistake. The params came in as String and Groovy take the byte-int instead interpreting the String as int.

    assert "2".getBytes() == 50

    Comment

    Working...
    X