はじめに Webサイトでは、認証を必要とするものがあります。ユーザー名とパスワードを登録し、それらを使ってログインするとアクセスできるようになる、というものです。こうした認証機能をGrailsで実装するにはどうすればよいのでしょうか。 ユーザーとパスワードをデータベースに登録し、それをチェックしてログイン処理する……といった仕組みを自分で作ることは可能です。が、もっと簡単にそれを行ってくれる機能がGrailsには用意されています。それは、「Authentication」というプラグインです。 対象読者 JSPを書くのは正直しんどい……と近頃感じる人。 Ruby on Railsスタイルの開発に興味があるという人。 MVCフレームワークをJavaで学びたい、という人。 認証とAuthenticationプラグイン Grailsというフレームワークは、比較的小さなものです。これ本体だけでは足り
はじめに 前回、Boardsというテーブルを用意し、これを利用した簡単なサンプルを作成しました。このサンプルでは、レコードの表示・追加・更新・削除といった基本的な機能を作成しました。今回は、このサンプルをもとに、実用面で必要となる機能を実装しながらGrailsの持つ機能について説明をしていくことにしましょう。今回取り上げるのは、入力された値のチェックを行う「バリデーション」と、複数テーブルを結合し処理するために用意された「リレーションシップ」についてです。 対象読者 JSPを書くのは正直しんどい……と近頃感じる人。 Ruby on Railsスタイルの開発に興味があるという人。 MVCフレームワークをJavaで学びたい、という人。 バリデーションについて まずは、入力値のバリデーションについてです。例えば、新しいレコードを追加したり、レコードの編集をしたりするとき、フォームに値を記入して送
日頃より楽天のサービスをご利用いただきましてありがとうございます。 サービスをご利用いただいておりますところ大変申し訳ございませんが、現在、緊急メンテナンスを行わせていただいております。 お客様には、緊急のメンテナンスにより、ご迷惑をおかけしており、誠に申し訳ございません。 メンテナンスが終了次第、サービスを復旧いたしますので、 今しばらくお待ちいただけますよう、お願い申し上げます。
Grailsは、Java EEで実績のあるSpringフレームワーク、Hibernate (O/Rマッピング) 等をベースにGroovy DSLを活用して実装された、Java環境で効率よくWebアプリケーション開発を行うことができるフルスタックフレームワークだ。 多くのダイナミックフレームワークのように、DRY(Don’t Repeat Yourself)、CoC(設定より規約)という哲学に基づいて実装されている。GrailsでのWeb開発では、主にGroovyを使用したDSL(ドメイン固有言語)で記述する。DSLでプログラムを記述する事によって、その内容から動作に必要な部分は動的に生成される。この実装によってJava環境でのWeb開発の複雑な部分を隠蔽している。 Grailsで主に使用する言語Groovyは、JVM上で稼働するオブジェクト指向型動的スクリプト言語だ。Javaとシームレスに
先日、PAGE2010という展示会にいろいろと印刷系な内容を出展してまして・・・。 展示会では、外回り担当・・・わかりやすく言うと他のブースを見て調査とかしたり。 まあ、暇ではなかったのですが、微妙にやることが無くなったので、印刷系の展示会と言うことで、今話題の(話題か?)InDesign CS4のIDMLとやらをちょいとごねごね。 さて、idmlとGrailsで何を作ろうかと。 ちょうどTwitter4jでも遊んでみたかったし。 GrailsのBuildConfig.groovyでの依存性管理とかも使ってみたかったのでその辺も一緒に。 題して「微妙なTwitterカードメーカー」 twiter アカウントを入力 ユーザ情報を取得 ユーザ情報を使って微妙なカードを作る。 アイコン画像とidmlファイルを含めたzipファイルを生成。 ダウンロード・解凍してidmlをInDesignで開くと、
この連載ではJavaプログラマを対象に、Groovyというスクリプト言語を使ってRuby on Railsライクな開発を行えるWebアプリケーションフレームワーク「Grails」を紹介します。今回は、MVCの「Model」の部分を担当するドメインクラスについて説明しましょう。 はじめに 今回は、MVCの「M(Model)」について説明を行うことにしましょう。Modelは、データベースとのやり取りなどを管理する部分です。データベースに問い合わせをしたり、必要なデータを受け取ったりするのはすべてモデルの担当となります。 ただし、勘違いしてはならないのが、「モデルの中に、特定のデータベースに接続しデータを取得する処理を作成するわけではない」という点でしょう。モデルの中で、データベース接続の処理を書いたり、クエリーを送信したりすることはありません。それらはすべて「ドメインクラス」が行ってくれるので
はじめに いよいよGrailsを使ってみることにしましょう。Grailsはコマンドを使ってアプリケーションの骨格を作っていきます。基本的なコマンドの役割と、そして生成されるプログラムファイル類、それらがGrailsのアプリケーションでどのような役割を果たしているか、といった基本的な事柄について説明をしていきましょう。 対象読者 JSPを書くのは正直しんどい……と近頃感じる人。 Ruby on Railsスタイルの開発に興味があるという人。 MVCフレームワークをJavaで学びたい、という人。 Grailsの入手とインストール Grailsの記述言語「Groovy」の基本的な使い方については前回大体頭に入れることができました。今回は、いよいよGrailsに挑戦してみましょう。まずはGrailsを入手します。GrailsのWebサイトからダウンロードすることができます。 本稿執筆時点では、1.
いまさらだけど書いてみる ここからダウンロード → http://grails.org/Download ダウンロードページからBinary ZIPあたりをダウンロード ダウンロードしたzipファイルを解凍 環境変数設定 解凍先が/opt/grails-1.0.3の場合 $ export GRAILS_HOME=/opt/grails-1.0.3 PATHを通す $ export PATH=$PATH:$GRAILS_HOME/bin 動作確認(1) $ grails Welcome to Grails 1.0.3 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /opt/grails-1.0.3 動作確認(2) $ grails create-app simple
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く