Japanese FAQ

Last updated by admin 3 years ago

??????(FAQ) {excerpt:hidden=true}Frequently Asked Questions (FAQ){excerpt}

??????????? {excerpt:hidden=true}Application Servers{excerpt}

Q: JBoss 4.0?????????????????????????????? {excerpt:hidden=true}I'm getting errors when deploying on JBoss 4.0. What do I do?{excerpt}

{excerpt:hidden=true} JBoss' unified class loader can cause problems with conflicting Jar files. One issue commonly encountered is with log4j, which is part of both JBoss and Grails. This can be resolved by removing log4j.jar from your deployed .war file.{excerpt} JBoss???????????????????jar???????????????????????????????????????? JBoss?Grails????????log4j???????????????????????????.war??????log4j.jar??????????{excerpt:hidden=true} Alternatively, you can try disabling the unified classloader by modifying "jboss-service.xml" file by changing this line:{excerpt} ??????????"jboss-service.xml"????????????????????????????????????????:
<attribute name="UseJBossWebLoader">true</attribute>
{excerpt:hidden=true}to{excerpt} ????????
<attribute name="UseJBossWebLoader">false</attribute>

Q: Oracle AS?????????Grails????????????????? {excerpt:hidden=true}How do I setup Grails on Oracle AS?{excerpt}

{excerpt:hidden=true} There is a great tutorial on the Oracle website detailing exactly how to setup Grails on Oracle{excerpt} Oracle?websites??Oracle????Grails????????????????????????????

??????? {excerpt:hidden=true}View Technologies{excerpt}

Q: ???GSP(Groovy Server Pages)??????????? {excerpt:hidden=true}Can I view my GSP's (Groovy Server Pages) directly?{excerpt}

{excerpt:hidden=true} A: Yes, but they need to into the web-app directory of your Grails application{excerpt} A: ???????????Grails?????????web-app??????????????????

?????? {excerpt:hidden=true}Controllers{excerpt}

Q: ?????????????????????render????????????? {excerpt:hidden=true}Can I use the render method to return a binary file to the client?{excerpt}

{excerpt:hidden=true} A: Not at the moment. However the servlet response instance can be used. For example, a zip file is created on the server and returned to the client:{excerpt} A: ?????????????????????????????????????????????????????????????zip????????????????:
def createZip = {
  byte[] zip = createZipForClient()
  response.contentType = "application/octet-stream"
  response.outputStream << zip
}

Q: ????????????????????JFreeChart????????? {excerpt:hidden=true}Can I use JFreeChart to display charts to the client?{excerpt}

{excerpt:hidden=true} Of course you can! Just use JFreeChart to create an image of the chart you want to show and then stream that back through the response.{excerpt} ????????! ????????????????????JFreeChart????????????response??????????????????????{excerpt:hidden=true} An example of a controller that creates a Pie Chart:{excerpt} Pie???????????????????:
import org.jfree.chart.ChartFactory
import org.jfree.data.general.DefaultPieDataset
import org.jfree.chart.encoders.EncoderUtil

class PiechartController {

def index = {

// create the data for the pie chart def slices = [ [label:"One", percent:43.2], [label:"Two", percent:10.0], [label:"Three", percent:27.5], [label:"Four", percent:17.5], [label:"Five", percent:11.0], [label:"Six", percent:19.4] ]

// load the data into a dataset def dataset = new DefaultPieDataset(); slices.each { slice -> dataset.setValue(slice.label, slice.percent) }

// create the pie chart and stream it back to the client def chart = ChartFactory.createPieChart("Pie Chart Demo 1", dataset, true, true, false) EncoderUtil.writeBufferedImage(chart.createBufferedImage(800, 600), "png", response.getOutputStream()) }

}

{excerpt:hidden=true} You will also need to copy jfreechart-1.0.1.jar and jcommon-1.0.0.jar into the libs folder of your grails app.{excerpt} Grails????libs?????jfreechart-1.0.1.jar?jcommon-1.0.0.jar??????????????

?????? {excerpt:hidden=true}Security{excerpt}

Q: ??????????????????????????????? {excerpt:hidden=true}How can I secure my application?{excerpt}

{excerpt:hidden=true} The most commons way to secure a Grails app is through Controllerinterceptors. If you want a declaritive approach to security another way of securing your applications might be to use Acegi. This article might give you a solution.&nbsp;{excerpt} Grails????????????????????????????????????????????????????????????????????????????????Acegi???????????????????????????????????