Questions tagged [gsp]

Groovy Server Pages (GSP) is a presentation language for web applications, similar to JSP. GSP allows static and dynamic content to be mixed in the same document. The result is a dynamically generated HTML, XML or other type of document in response to a Web client request.

Groovy Server Pages (GSP) is a view technology which can be used for designing web application using Grails Framework. Developing GSP are very much similar to that of designing web pages with Active Server Pages (ASP) and Java Server Pages (JSP) but coding is very much simpler and easier than both of them. Users are provided with facility of having static, dynamic as well as mix of both contents at a time in a single application.

The output can be dynamically rendered to different forms like : HTML, XML, text and any other format based on Web client request object.If you are beginner in learning groovy, please read Introduction to Groovy – Scripting Language.

Advantages of using GSP using Grails

  1. A GSP uses Groovy GString for evaluation of expression generally using ${….} but whereas in JSP EL expressions are used for the same purpose but they are restricted only to object navigation to overcome this disadvantage JSTL functions can to be written for creating static helper methods, registering them through a taglib descriptor, adding a taglib declaration and finally implementing them using the function.
  2. A developer has been provided with Logical and Iterative tags in GSP with safe navigation operator and Elvis operator which can be implemented easily to fetch the needed results according to their requirement. For example these operators can be implemented in this manner: Safe navigation operator :${book.pages?.no()}
  3. Elvis operator : ${totalpages ?: 100}
  4. A GSPhas ability for invoking methods through Grails dynamic tags which makes it easier to produce well-formed markup:
<!-- With a regular tag -->
<a href="<g:createLink action="list" />">Click here</a>
<!-- As a method call -->
<a href="${createLink(action:'list')}">Click here</a>
  1. Creating and testing custom tag libraries using GSP are very easier then JSP since there is no need for developer to code tld files and taglib declarations.
1323 questions
-1
votes
1 answer

Align g:form elements horizontally

Having a Grails/GSP issue. I want to horizontally align elements within a g:form tag. My code looks like this currently, though the submitButton is still below the textField.
Calabria
  • 94
  • 10
-1
votes
1 answer

Grails createLink doesnt add all arguments to uri

So i have a createLink in gsp file like this: ${createLink(params:[warehouseId:warehouse?.id, itemId:itemWarehouseInstance?.item?.id], uri: '/item/show/' + itemWarehouseInstance?.item?.id)} and in localhost version it works perfectly and produces…
crollywood
  • 31
  • 5
-1
votes
1 answer

Display list of records on a Combo Box in Grails

How do i load records to a Grails combo-box (look screenshot below). def bookList = Book.getAll(); Now how do i display the above book list in a Combo box?
Illep
  • 16,375
  • 46
  • 171
  • 302
-1
votes
2 answers

How to render Json data which is Needed

[ {name: "name1", y: val1}, {name: "name2", y: val2}, {name: "name3", y: val3}, ..., {name: "nameN", y: valN} ] I would like to get value in this JSON format How to use this format in piechart in grails?
Srijan
  • 1
-1
votes
1 answer

Browser always sends the "noSelection" value of the Grails tag library

I have this select input in my gsp: Even if I change to another item in the dropdown,…
Nedo
  • 627
  • 1
  • 10
  • 20
-1
votes
1 answer

GSP Accessing domain class static field

I have a domain class which contains a Class[] array. I want the contents of that array displayed using g:select. Although I cannot find how to access those fields. I tried <%@page import="package.path.to.PropertyDefinition" %> and then …
Giannis
  • 5,286
  • 15
  • 58
  • 113
-1
votes
1 answer

Can I call a jquery or javascript function in grails g:each element?

I want to call a jquery function in grails g:each element, i'm using a function call on page load to filter a table which has a loop as follows
${sampleType}
John
  • 137
  • 1
  • 4
  • 12
-1
votes
2 answers

Image Upload in FormRemote (Grails)

In normal form, I can upload an image. When I am doing this via formRemote it won't work. In params map displays only controller and action . In ajax, file upload is not possible. My need is have to do image upload in ajax and form validation.…
Visme
  • 983
  • 8
  • 29
-1
votes
3 answers

g:link ignoring named mapping

I have the following named UrlMapping name 'admin_user' :"/admin/user/$action?/$id?"(controller:'userAdmin') On a different page site/edit.gsp (/admin/site/edit) I am calling: New…
Nix
  • 57,072
  • 29
  • 149
  • 198
-1
votes
1 answer

Grails and

I am just curious, what is the difference between and ? They seem to work the same, or are they?
noob
  • 300
  • 5
  • 16
-1
votes
2 answers

Formatting of html tables in GSP

I am using Grails and I am currently faced with this problem. This is the result of my html table And this is my code from the gsp page Device ID Device Type Status …
user1790785
  • 53
  • 10
-1
votes
1 answer

downloading form tag into csv file format

I need some help or guide on how to download a form into a CSV file. What I'm trying to do here is :