aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Grails and jQuery: how to get image to show that the user just typed in the URL to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Grails and jQuery: how to get image to show that the user just typed in the URL to" Watch "Grails and jQuery: how to get image to show that the user just typed in the URL to" New topic
Author

Grails and jQuery: how to get image to show that the user just typed in the URL to

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Is it worth it to use JQuery in your Grails app.

I still need to learn JQuery, but I would also have to learn Prototype if I used it.

Anyway, I want to show or hide some <div> based on if someone entered data in a property of my domain. So while editing that domain. Basically they are going to put a URL to an image, and I want to show that image on the page after they have entered it.

What is my best approach? OK, I changed the subject, let me update the subject line.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I use jQuery for everything, as long as I get to make the decision.

Major untested pseudo code alert!!!



Also, moving this to the HTML / JavaScript forum.

GenRocket - Experts at Building Test Data
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Mark Spritzler wrote:I still need to learn JQuery, but I would also have to learn Prototype if I used it.

"It" Grails, or "it" jQuery? I think Grails supports a couple of different JS libs, but I don't recall that jQuery was one of them. There's a plugin, though:

http://www.grails.org/plugin/jquery
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

David Newton wrote:
Mark Spritzler wrote:I still need to learn JQuery, but I would also have to learn Prototype if I used it.

"It" Grails, or "it" jQuery? I think Grails supports a couple of different JS libs, but I don't recall that jQuery was one of them. There's a plugin, though:

http://www.grails.org/plugin/jquery


Well, it's support via the plugin. So if you install the plugin and make a couple of config mods, all the grails ajaxy tags will use jQuery instead of Prototype (the default). And that's really all the support is.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Gregg Bolinger wrote:
David Newton wrote:
Mark Spritzler wrote:I still need to learn JQuery, but I would also have to learn Prototype if I used it.

"It" Grails, or "it" jQuery? I think Grails supports a couple of different JS libs, but I don't recall that jQuery was one of them. There's a plugin, though:

http://www.grails.org/plugin/jquery


Well, it's support via the plugin. So if you install the plugin and make a couple of config mods, all the grails ajaxy tags will use jQuery instead of Prototype (the default). And that's really all the support is.


So this takes it back to being a Grails question. The original question was about those config mods, what they mean, is it worth jumping through those hoops, or is it just 2 mods and then automatically you can use the jQuery type code you posted?

Mark
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I've never used the jQuery plugin, but I'm not sure why it would need anything beyond the two things mentioned in the wiki article.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

<g:javascript library="jquery" />

And in the Config.groovy file you add....

grails.views.javascript.library="jquery"

That's it. No hoops.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

And technically, you only need the Config.groovy addition if you want the Grails remote taglibs to use jquery. Personally, I never use those tags, so all I need is to source in the jquery js file, which is what the <g:javascript /> is for.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Gregg Bolinger wrote:And technically, you only need the Config.groovy addition if you want the Grails remote taglibs to use jquery. Personally, I never use those tags, so all I need is to source in the jquery js file, which is what the <g:javascript /> is for.


Thanks, and I assume if I just put that in my main.gsp layout, then all the pages will get that.

Things have been going really well too.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Grails and jQuery: how to get image to show that the user just typed in the URL to