if using freemarker, i have to code using servlet
No, FreeMarker doesn't need Servlets instead of Actions.
FreeMarker is fully integrated in Struts2, it just needs the library in your libs directory and some little configuration in struts.xml and web.xml.
According to Struts2 documentation,
Template Loading
The framework looks for FreeMarker templates in two locations (in this
order):
- Web application
- Class path
This ordering makes it ideal for providing templates inside a
fully-built jar, but allowing for overrides of those templates to be
defined in your web application. In fact, this is how you can override
the default UI tags and Form Tags included with the framework.
In addition, you can specify a location (directory on your file
system) through the templatePath or TemplatePath context variable (in
the {{web.xml)}. If a variable is specified, the content of the
directory it points to will be searched first. This variable is
currently NOT relative to the root of your application.
So, if you want to use .FTL files (FreeMarker Templates) INSTEAD of JSP files, you can put them outside the ear, in the file system.
Like this (web.xml):
<!-- FreemarkerServlet settings: -->
<init-param>
<param-name>TemplatePath</param-name>
<param-value>/apps/template/path</param-value>
</init-param>