Boa noite gente, já inseri o arquivos .jar do jsp e jstl , mais continua apresentando erro.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head />
<h:body>
<h1>Novo Livro</h1>
<h:form>
<h:messages id="messages" />
<fieldset>
<legend>Dados do Livro</legend>
<h:panelGrid columns="2">
<h:outputLabel value="Titulo:" for="titulo" />
<h:inputText id="titulo" value="#{livroBean.livro.titulo}"
required="true" requiredMessage="Título obrigtório"
validatorMessage="Título não pode ser superior a 40 caracteres">
<f:validateLength maximum="40" />
<f:ajax event="blur" render="messages" />
</h:inputText>
<h:outputLabel value="ISBN:" for="isbn" />
<h:inputText id="isbn" value="#{livroBean.livro.isbn}"
validator="#{livroBean.comecaComDigitoUm}">
<f:ajax event="keypress" render="messages"/>
</h:inputText>
<h:outputLabel value="Preço:" for="preco" />
<h:inputText id="preco" value="#{livroBean.livro.preco}"
label="Preço">
<f:validateDoubleRange minimum="1.0" maximum="1000.00" />
</h:inputText>
<h:outputLabel value="Data de Lançamento:" for="dataLancamento" />
<h:inputText id="dataLancamento"
value="#{livroBean.livro.dataLancamento.time}">
<f:convertDateTime pattern="dd/MM/yyyy"
timeZone="America/Sao_Paulo" />
</h:inputText>
</h:panelGrid>
</fieldset>
<fieldset>
<legend>Dados do Autor</legend>
<h:outputLabel value="Selecione Autor:" for="autor" />
<h:selectOneMenu value="#{livroBean.autorId}" id="autor">
<f:selectItems value="#{livroBean.autores}" var="autor"
itemLabel="#{autor.nome}" itemValue="#{autor.id}" />
</h:selectOneMenu>
<h:commandButton value="Gravar Autor"
action="#{livroBean.gravarAutor}">
<f:ajax execute="autor" render="tabelaAutores" />
</h:commandButton>
<h:commandLink value="cadastrar novo autor" action="#{livroBean.formAutor}" immediate="true" />
<br />
<h:dataTable value="#{livroBean.autoresDoLivro}" var="autor"
id="tabelaAutores">
<h:column>
<h:outputText value="#{autor.nome}" />
</h:column>
</h:dataTable>
</fieldset>
<h:commandButton value="Gravar" action="#{livroBean.gravar}">
<f:ajax execute="@form" render="@form :tabelaLivros" />
</h:commandButton>
</h:form>
<h:dataTable value="#{livroBean.livro}" var="livro" id="tabelaLivros">
<h:column>
<f:facet name="header">Título</f:facet>
<h:outputText value="#{livro.titulo}" />
</h:column>
<h:column>
<f:facet name="header">ISBN</f:facet>
<h:outputText value="#{libro.isbn}" />
</h:column>
<h:column>
<f:facet name="header">Preco</f:facet>
<h:outputText value="#{livro.preco}">
<f:convertNumber type="currency" pattern="R$ 0.00 "
currencySymbol="R$" locale="pt_BR" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">Data</f:facet>
<h:outputText value="#{livro.datalancamento.time}">
<f:convertDateTime timeZone="America/Sao_Paulo" pattern="dd/MM/yyyy"></f:convertDateTime>
</h:outputText>
</h:column>
</h:dataTable>
</h:body>
</html>
package br.com.caelum.livraria.bean;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
import br.com.caelum.livraria.dao.DAO;
import br.com.caelum.livraria.modelo.Autor;
import br.com.caelum.livraria.modelo.Livro;
@ManagedBean
@ViewScoped
public class LivroBean {
private Livro livro = new Livro();
private Integer autorId;
public Integer getAutorId() {
return autorId;
}
public void setAutorId(Integer autorId) {
this.autorId = autorId;
}
public Livro getLivro() {
return livro;
}
public List getAutores(){
return new DAO(Autor.class).listaTodos();
}
public List getAutoresDoLivro(){
return this.livro.getAutores();
}
public void gravarAutor(){
Autor autor = new DAO(Autor.class).buscaPorId(this.autorId);
this.livro.adicionaAutor(autor);
System.out.println("Livro escrito por: " + autor.getNome());
}
public void gravar() {
System.out.println("Gravando livro " + this.livro.getTitulo());
if (livro.getAutores().isEmpty()) {
FacesContext.getCurrentInstance().addMessage("autor", new FacesMessage("Livro deve ter pelo menos um Autor"));
return;
}
new DAO(Livro.class).adiciona(this.livro);
this.livro = new Livro();
}
private String formAutor() {
System.out.println("Chamando o formulário do Autor");
return "autor";
}
public void comecaComDigitoUm(FacesContext fc, UIComponent component, Object value) throws ValidatorException {
String valor = value.toString();
if (!valor.startsWith("1")) {
throw new ValidatorException(new FacesMessage("Deveria começar com 1"));
}
}
}
```
jan 05, 2017 6:39:40 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:livraria' did not find a matching property.
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version: Apache Tomcat/7.0.63
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built: Jun 30 2015 08:08:33 UTC
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number: 7.0.63.0
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name: Windows 10
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version: 10.0
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture: amd64
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home: C:\Program Files\Java\jre1.8.065
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version: 1.8.0_65-b17
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor: Oracle Corporation
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE: C:\Users\Pri\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME: C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.63
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\Users\Pri\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.63
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\Users\Pri\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.63\endorsed
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
jan 05, 2017 6:39:40 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_65\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.8.0_45/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_45/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_45/bin/../jre/lib/amd64;ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0];C:\Program Files (x86)\Brackets\command;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\WINDOWS\system32\config\systemprofile.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Ruby23-x64\bin;C:\Program Files\Java\jdk1.8.0_45\bin;C:\Users\Pri.lein\bin;C:\Users\Pri\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Java\eclipse;;.
jan 05, 2017 6:39:40 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-bio-8081"]
jan 05, 2017 6:39:40 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-bio-8010"]
jan 05, 2017 6:39:40 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 820 ms
jan 05, 2017 6:39:40 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
jan 05, 2017 6:39:40 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/7.0.63
jan 05, 2017 6:39:41 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFORMAÇÕES: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [102] milliseconds.
jan 05, 2017 6:39:42 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
jan 05, 2017 6:39:42 PM com.sun.faces.config.ConfigureListener contextInitialized
INFORMAÇÕES: Inicializando Mojarra 2.1.14 ( 20121023-1153) para o contexto '/livraria'
jan 05, 2017 6:39:43 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFORMAÇÕES: JSF1048: Anotações PostConstruct/PreDestroy presentes. Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas.
jan 05, 2017 6:39:43 PM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator 4.3.0.Final
jan 05, 2017 6:39:43 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-bio-8081"]
jan 05, 2017 6:39:43 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-bio-8010"]
jan 05, 2017 6:39:43 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 3433 ms
jan 05, 2017 6:39:54 PM org.hibernate.annotations.common.Version
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
jan 05, 2017 6:39:54 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.8.Final}
jan 05, 2017 6:39:54 PM org.hibernate.cfg.Environment
INFO: HHH000206: hibernate.properties not found
jan 05, 2017 6:39:54 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
jan 05, 2017 6:39:55 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
jan 05, 2017 6:39:55 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
jan 05, 2017 6:39:55 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: true
jan 05, 2017 6:39:55 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/livrariadb]
jan 05, 2017 6:39:55 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=**, autocommit=true, release_mode=auto}
jan 05, 2017 6:39:55 PM org.hibernate.dialect.Dialect
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
jan 05, 2017 6:39:55 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
jan 05, 2017 6:39:55 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
INFO: HHH000397: Using ASTQueryTranslatorFactory
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000228: Running hbm2ddl schema update
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000102: Fetching database metadata
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000396: Updating schema
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000261: Table found: livrariadb.autor
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000037: Columns: [nome, id]
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000108: Foreign keys: []
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000126: Indexes: [primary]
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000261: Table found: livrariadb.livro
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000037: Columns: [preco, isbn, titulo, id, datalancamento]
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000108: Foreign keys: []
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000126: Indexes: [primary]
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000261: Table found: livrariadb.livro_autor
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000037: Columns: [livro_id, autores_id]
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000108: Foreign keys: [fk9590997ad70c7e4a, fk9590997afa17418]
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.TableMetadata
INFO: HHH000126: Indexes: [fk9590997afa17418, fk9590997ad70c7e4a]
jan 05, 2017 6:39:56 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete
Hibernate: select autor0.id as id1, autor0.nome as nome1 from Autor autor0
jan 05, 2017 6:39:56 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/livraria] threw exception [javax/servlet/jsp/jstl/sql/Result] with root cause
java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.sql.Result
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1722)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
at javax.faces.component.UIData.getDataModel(UIData.java:1806)
at javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:483)
at javax.faces.component.UIData.setRowIndex(UIData.java:472)
at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:82)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
at javax.faces.component.UIData.encodeBegin(UIData.java:1117)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:437)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Gravando autor Agatha Cristine
Hibernate: insert into Autor (nome) values (?)
Gravando autor Agatha Cristine
Hibernate: insert into Autor (nome) values (?)
```