web.xml:
<jsp-config>
<taglib>
<taglib-uri>/WEB-INF/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
</jsp-config>
chamando taglib no jsp:
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
ERRO:
org.apache.jasper.JasperException: File "/tags/struts-bean" not found
Que estou fazendo de errado ???
Não versões mais recentes dos containers nem é necessário mapear essas taglibs no web.xml, esses arquivos devem estar dentro WEB-INF/tld
troque isso
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
por
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>
Qual container vc está usando? o Tomcat acima de 5.x já é assim.
Aproveitando a deixa do struts, estou tentando executar uma aplicação exemplo pra ver se consigo entender um pouco de struts, agora está dando um outro erro, no index.jsp tem o seguinte:
<html:html locale="true">
<head>
<title><bean:message key="welcome.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
</body>
</html:html>
ERRO:
javax.servlet.ServletException: Missing message for key "welcome.title"
Que erro é esse?? e pra que serve este “key” ??
Obrigado!!!
Conteúdo do application.properties:
welcome.title=Seja bem-vido ao sistema!
<bean:message key="welcome.title"/>
Faz a impressão de “Seja bem-vido ao sistema!” na tela da chave welcome.title que deve estar dentro do application.properties que é mapeado dentro do struts-config.xml através da declaração:
<message-resources parameter="[nome do projeto].application" />
A impressão através do bean:message e utilização do .properties serve para internacionalização.
Esse erro deve ser porque ou você não tem uma .properties declarado ou dentro do seu properties não possui a chave welcome.title:
javax.servlet.ServletException: Missing message for key "welcome.title"
Espero ter sido claro…