public void configure ( ) { ServletContext servletContext = ServletActionContext . getServletContext ( ) ; ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver ( servletContext ) ; templateResolver . setTemplateMode ( templateMode ) ; templateResolver . setCharacterEncoding ( characterEncoding ) ; templateResolver . setPrefix ( prefix ) ; templateResolver . setSuffix ( suffix ) ; templateResolver . setCacheable ( cacheable ) ; templateResolver . setCacheTTLMs ( cacheTtlMillis ) ; templateEngine . setTemplateResolver ( templateResolver ) ; StrutsMessageResolver messageResolver = new StrutsMessageResolver ( ) ; templateEngine . setMessageResolver ( new StrutsMessageResolver ( ) ) ; if ( templateEngine instanceof SpringTemplateEngine ) { ( ( SpringTemplateEngine ) templateEngine ) . setMessageSource ( messageResolver . getMessageSource ( ) ) ; } // extension diarects. FieldDialect fieldDialect = new FieldDialect ( TemplateMode . HTML , "sth" ) ; templateEngine . addDialect ( fieldDialect ) ; }
Configure settings from the struts . xml or struts . properties using sensible defaults if values are not provided .