developer101
developer101

Reputation: 63

grails createLink throws error only when deploying on a server

grails version: 3.1.1 groovy version: 2.4.5 jvm version: 1.8.0_25 Apache Tomcat: 7.0.70

So i have this in my main view to navigate:

<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Test Your Data<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="${createLink(controller:'testdata', action:'location')}">GIS Data</a></li>
<li><a href="${createLink(controller:'testdata', action:'credit')}">Credit Data</a></li>
<li><a href="${createLink(controller:'testdata', action:'vehicle')}">Axiom Data</a></li>
<li><a href="${createLink(controller:'testdata', action:'license')}">MVR Data</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Add New Data<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="${createLink(controller:'UploadTestData', action:'uploadLocation')}">Location Data</a></li>
<li><a href="${createLink(controller:'UploadTestData', action:'uploadCredit')}">Credit Data</a></li>
<li><a href="${createLink(controller:'UploadTestData', action:'uploadVehicle')}">Vehicle Data</a></li>
<li><a href="${createLink(controller:'UploadTestData', action:'uploadLicense')}">Licence Data</a></li>
</ul>
</li>

It works when i run it on my local in dev and prod but when i build a war and put it on the server all the createlinks in UploadTestData do not work and throw this error: javax.servlet.ServletException: Could not resolve view with name '/uploadTestData/uploadGis' in servlet with name 'grailsDispatcherServlet'

Upvotes: 0

Views: 88

Answers (1)

Dipak Thoke
Dipak Thoke

Reputation: 1983

Try to use <g:link> </g:link> which provided by the grails

E.g

 <li><g:link resource="testdata" action="location">GIS Data</g:link></li>

resource = your controller name.

action = your controller action name.

For more Details :

http://docs.grails.org/latest/ref/Tags/link.html

Upvotes: 0

Related Questions