Class: Kwartz::StrutsTranslator

Inherits:
JstlTranslator show all
Defined in:
lib/kwartz/binding/struts.rb

Overview

translator for php

Constant Summary

Constants inherited from JstlTranslator

JstlTranslator::JSTL11_EMBED_PATTERNS, JstlTranslator::JSTL12_EMBED_PATTERNS

Instance Attribute Summary

Attributes inherited from BaseTranslator

#escape, #footer, #header

Instance Method Summary collapse

Methods included from JstlExpressionParser

#parse_expr_str, #parse_expr_str!

Methods inherited from BaseTranslator

#translate, #translate_native_stmt, #translate_print_stmt, #translate_string

Methods inherited from Translator

get_class, register_class, #translate, #translate_native_stmt, #translate_print_stmt, #translate_string

Constructor Details

#initialize(properties = {}) ⇒ StrutsTranslator

Returns a new instance of StrutsTranslator.



85
86
87
88
89
90
# File 'lib/kwartz/binding/struts.rb', line 85

def initialize(properties={})
  super
  self.header << '<%@ taglib uri="/tags/struts-html" prefix="html" %>'   << @nl
  #self.header << '<%@ taglib uri="/tags/struts-bean" prefix="bean" %>'   << @nl
  #self.header << '<%@ taglib uri="/tags/struts-logic" prefix="logic" %>' << @nl
end

Instance Method Details

#translate_native_expr(expr) ⇒ Object



93
94
95
96
97
98
99
100
101
102
# File 'lib/kwartz/binding/struts.rb', line 93

def translate_native_expr(expr)
  assert unless expr.is_a?(NativeExpression)
  flag_escape = expr.escape?
  flag_escape = @escape if flag_escape == nil
  if flag_escape == false
    @sb << @expr_l << expr.code << @expr_r       # ex. <c:out value="${expr}" escapeXml="false"/>
  else
    @sb << @escape_l << expr.code << @escape_r   # ex. <c:out value="${expr}"/>
  end
end