Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 276729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:58:01+00:00 2026-05-12T00:58:01+00:00

I’m considering using Grails for my current project. I have a couple of requirements

  • 0

I’m considering using Grails for my current project. I have a couple of requirements that I’m hoping I can do in Grails.

First, I have the following database table:

TagType
---------
tag_type_id
tag_type


Sample Data: TagType
--------------------
1,title
2,author

Based on that data, I need to generate a data entry form like this which
will save its data to another table.

Tile _ _ _ _ _ _ _ _ _ _ _

Author _ _ _ _ _ _ _ _ _ _ _

save cancel

Can I do that in Grails? Can you point me in the right direction?

Thanks!

More Details

I’m building a digital library system that supports OIA-PMH which is a standard for sharing metadata about documents. The standard states that every element is optional and repeatable. To support this requirement I have the following database design.

I need to generate the user GUI (data entry form) based primarily on the contents
of the TagType Table (see above). The data from the form then get’s saved to
the Tags (if the tag is new) and Item_Tags tables.

Items
---------
item_id
last_update

Tags
--------
tag_id
tag_type_id
tag

TagType
---------
tag_type_id
tag_type

Item_tags
---------
item_id
tag_id

Sample Data: Items
------------------
1,2009-06-15

Sample Data: TagType
--------------------
1,title
2,author

Sample Data: Tags
------------------

1,1,The Definitive Guide to Grails
2,2,Graeme Rocher
3,2, Jeff Brown

Sample Data: Item_tags
-----------------------
1,1
1,2
1,3
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:58:02+00:00Added an answer on May 12, 2026 at 12:58 am

    I’m really liking grails. When I first started playing with it a couple of weeks ago, I didn’t realize that it’s a full fledged language. In fact it’s more than that. It’s a complete web stack with a web server and a database included. Anyway, the short answer to my question is yes. You might even say yes, of course! Here’s the code for the taglib I created:

    import org.maflt.flashlit.pojo.Item
    import org.maflt.flashlit.pojo.ItemTag
    import org.maflt.flashlit.pojo.Metacollection
    import org.maflt.flashlit.pojo.SetTagtype
    import org.maflt.flashlit.pojo.Tag
    import org.maflt.flashlit.pojo.Tagtype
    
    /**
    * @return Input form fields for all fields in the given Collection's Metadataset. Does not return ItemTags where TagType is not in the Metadataset.
    *  
    * In Hibernate, the
    *
    *    "from ItemTag b, Tag a where b.tag= a"
    *
    * query is a cross-join. The result of this query is a list of Object arrays where the first item is an ItemTag instance and the second is a Tag instance.
    *
    * You have to use e.g.
    *
    *    (ItemTag) theTags2[0][0]
    *
    * to access the first ItemTag instance.
    * (http://stackoverflow.com/questions/1093918/findall-not-returning-correct-object-type)
    **/
    class AutoFormTagLib {
    
        def autoForm = {attrs, body ->
            //def masterList    = Class.forName(params.attrs.masterClass,false,Thread.currentThread().contextClassLoader).get(params.attrs.masterId)
            def theItem     = Item.get(attrs.itemId)
            def theCollection   = Metacollection.get(attrs.collectionId)
            def masterList  = theCollection.metadataSet.setTagtypes
            def theParams   = null
            def theTags     = null
            def itemTag     = null
            def tag         = null
            masterList.each {
    
                theParams   = [attrs.itemId.toLong(),it.tagtype.id]
                theTags     = ItemTag.findAll("from ItemTag d, Item c, Tag b, Tagtype a where d.item = c and d.tag = b and b.tagtype = a and c.id=? and a.id=?",theParams)
    
                for (int i=0;i<it.maxEntries;i++) {                 
                    out << "<tr>\n"
                    out << "    <td>${it.tagtype.tagtype}</td>\n"
                    out << "    <td>\n"
                    if (theTags[i]) {
                        itemTag     = (ItemTag) theTags[i][0]
                        //item  = (Item)    theTags[i][1]
                        tag     = (Tag) theTags[i][2] 
                        //itemTag   = (Tagtype) theTags[i][3]
                        out << "    <input name='${it.tagtype.tagtype}_${i}_${itemTag.id}' value='${tag.tag}' />\n";
                    }
                    else
                        out << "       <input name='${it.tagtype.tagtype}_${i}' />\n";
                    out << "    </td>\n"
                    out << "</tr>\n"
                }
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.