Dashboard > RIFE > ... > Web engine > Groovy support > Information > Page Comparison
RIFE Log In   View a printable version of the current page.
Groovy support


Version 7 by Geert Bevin
on May 22, 2004 09:15.


compared with
Current by Geert Bevin
on Apr 10, 2005 20:09.

(show comment)
 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 6 changes. View first change.

  
  
 When [Groovy|http://groovy.codehaus.org/] is present in the classpath of the web application, it's now possible to implement elements in this very nice scripting language. The only requirement is that the source files have to have the .groovy extension.
  
 For example, {{Simple.groovy}}:
  
 {code:java}
 import com.uwyn.rife.engine.Element
  
 class Simple extends Element
  class simple extends Element
 {
  void processElement()
  {
  if (hasSubmission("login"))
  {
printContent(getParameter("login")+","+getParameter("password"))
   print(getParameter("login")+","+getParameter("password"))
  }
  else
  {
  switch (getInput("input1"))
  {
  case "form":
printContent(<<<EOS
  
  print("""
 <html><body>
 <form action="${getSubmissionQueryUrl("login")}" method="post">
 <input name="login" type="text">
 <input name="password" type="password">
 <input type="submit">
 </form>
 </body></html>
EOS)
  """)
  break
  default:
printContent(getInput("input1")+","+getInput("input2"))
   print(getInput("input1")+","+getInput("input2"))
  break
  }
  }
  }
 }
 {code}
  
 {panel:title=Important Note|borderStyle=dashed|borderColor=orange|borderWidth=1|bgColor=#ffffee|titleBGColor=#ffeebb}
 Current versions of Groovy have a bug that makes it impossible to use RIFE's {{print}} method. Therefore, {{printContent}} methods have been added that simply wrap around the {{print}} methods.
  
 You can track [GROOVY-105|http://jira.codehaus.org/browse/GROOVY-105] to check when it's resolved.
 {panel}


Are you enjoying Confluence? Please consider purchasing it today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.1a Build:#515 May 19, 2006) - Bug/feature request - Contact Administrators