Search code examples
grailsviewrender

Grails render view in not rendering view


I am working on a web application,in which from a domain i want to render a view on browser.

My requirement is something like this-

When user comes to my website for registration,after he submits data from controller i render a different view.

I am using

render(view:'myviewname')

but it not working and gives error invocation target exception and control goes to some other method of same controller. i also try using PageRendrar and by creating separate method for render my view but in all case finding same issue.

Code -if have tried using different ways but all are not working for me.

def mytest(){
   render(view:'mytest')
}


def mytest(){
   render(view:'/book/myview')
   return
}

def mytest(){
  render(view:'/error')
}

UPDATED:

WARN: Exception: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav‌​a:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.springsource.loaded.ri.ReloadedTypeInvoker$2.invoke(ReloadedTypeInvoker.java‌​:107) at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInter‌​ceptor.java:1260)

Thanks in advance.


Solution

  • I have the same issue. If i write:

    def abc(){
        render (view:'/DG/quanlyCCDG')
    }
    

    I have the same WARN like you got. But if i write :

    def abc(){
        def ccdgList = CCDG.findAllByCheckDel(0)
        render (view:'/DG/quanlyCCDG',model:[ccdgList:ccdgList])
    }
    

    I didnt get any WARN (?). May be you can not write only render view in a method ?? Im not sure, but if you write like above, i think it will be ok. Sorry my English is not good.