Diferentemente de um servlet, a action não monta a view, ou seja, o html que visualizará a resposta. No struts montamos a view com uma página JSP que será interconectada com a action.
Então, para criar o JSP, vá na pasta WebContent e escolha a opção New → JSP File.
O JSP deverá ter o seguinte código:
<%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>Oi Mundo</title> </head> <body> A mensagem da action é <s:property value="mensagem"/> </body> </html>
Chame-o de HelloOK.jsp.
A linha <%@ taglib prefix="s" uri="/struts-tags" %> instrui ao servlet container (servlet que executa o struts framework) que os tags iniciados por “s” são do struts.
A linha <s:property value="mensagem"/> instrui que o servlet container irá colocar aqui a mensagem retornada por HelloAction.getMensagem().