niraj « Intelligrape Groovy & Grails Blogs
Subscribe via E-Mail:

niraj

http://www.intelligrape.com/blog

Posts by niraj:

  • Getting params attribute as list()

    14 Jun 2010 in Grails

    following are two methods for getting parameters from GSP in form of list only:-

    even if the variable has only one value, it will be recieved as a list and not as “String”.

    List<String> myList = params.list(‘variableName’)
    List<String> myList = [params.variableName].flatten()

    ~~Niraj Kumar~~
    niraj@intelligrape.com

    http://www.intelligrape.com

    • Share/Bookmark
  • Handy g:uploadForm

    14 May 2010 in Grails

    It is very easy and handy to use Grails <g:uploadForm> tag insteed of using HTML <form> tag or grails <g:form> tag, as you don’t need to set the enctype attritbute to multipart/form-data (as in case of HTML <form> tag or grails <g:form> tag) to work with file upload.

    for example insteed of using:

    <g:form name="myForm" controller="myController" action="myaction" id="1" enctype="multipart/form-data">...</g:form>

    ,We can just use

    <g:uploadForm name="myForm" controller="myController" action="myaction">...</g:uploadForm>

    with all same features!!!

    ~~Niraj Kumar~~
    niraj@intelligrape.com

    http://www.intelligrape.com

    • Share/Bookmark