-
Conteúdo Similar
-
Por Adriano Costa
Fala galera!!!
Eu sou novo na programação e estou precisando de uma ajuda, estou tentando fazer um for dentro dos scriplets mas esta dando erro. É a parte do read do meu crud. Quando eu aço o for através da camada controller ele funciona, mas na pagina jsp ele da um erro.
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@page import="model.JavaBeans"%>
<%@page import="java.util.ArrayList"%>
<%
ArrayList<JavaBeans> lista = (ArrayList<JavaBeans>)request.getAttribute("contatos");
for (int i = 0; i < lista.size(); i++){
out.print(lista.get(i).getIdlista());
}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Lista de Tarefas</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div id= "login-container">
<h1>Lista de Tarefas</h1>
<table>
<thead>
<tr>
<th>Código</th>
<th>Titulo</th>
<th>Descrição</th>
<th>Data</th>
<th>Status</th>
<th>Prioridade</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<form name="frmContato" action="listarTarefa">
<input type="submit" value="Cadastrar" onclick="validar()">
</form>
</div>
<script src="scripts/validador.js"></script>
</body>
</html>
E esse é o erro
HTTP Status 500 – Internal Server Error
Type Exception Report
Message An exception occurred processing [/listaTarefas.jsp] at line [8]
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: An exception occurred processing [/listaTarefas.jsp] at line [8] 5: 6: <% 7: ArrayList<JavaBeans> lista = (ArrayList<JavaBeans>)request.getAttribute("contatos"); 8: for (int i = 0; i < lista.size(); i++){ 9: out.print(lista.get(i).getIdlista()); 10: } 11: %> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:611) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:500) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:378) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:326) javax.servlet.http.HttpServlet.service(HttpServlet.java:733) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) Root Cause
java.lang.NullPointerException org.apache.jsp.listaTarefas_jsp._jspService(listaTarefas_jsp.java:126) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71) javax.servlet.http.HttpServlet.service(HttpServlet.java:733) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:467) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:378) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:326) javax.servlet.http.HttpServlet.service(HttpServlet.java:733) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) Note A pilha de erros completa da causa principal está disponível nos logs do servidor.
esse é o Medoto
// Listar tarefa
protected void tarefas(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//Criando um objeto que irá receber os dados do JavaBeans
ArrayList<JavaBeans> lista = dao.listarTarefa();
request.setAttribute("tarefas", lista);
RequestDispatcher rd = request.getRequestDispatcher("listaTarefas.jsp");
rd.forward(request, response);
//Teste de recebimento da lista
for(int i = 0; i<lista.size(); i++) {
System.out.println(lista.get(i).getIdcon());
System.out.println(lista.get(i).getTitulo());
System.out.println(lista.get(i).getDescricao());
System.out.println(lista.get(i).getData());
System.out.println(lista.get(i).getStatus());
System.out.println(lista.get(i).getPrioridade());
}
}
-
Por Thiago Ladislau
Bom dia gostaria de compartilhar um erro que vem ocorrendo há muito tempo na empresa em que trabalho. Porem nunca foi identificada a causa origem do mesmo, Isso ocorre de forma aleatória não tem data nem hora, acontece de repente. Sendo obrigado ao 'fechamento forçado' do sistema que pode gerar problemas na base. Em anexo imagem do Erro. Grato
-
Por José Peixoto
Olá, estou com um problema onde a aplicação me retorna
java.lang.NoSuchFieldError: EXCLUDE_EMPTY at org.glassfish.jersey.client.ClientConfig$State.<init>(ClientConfig.java:147) ~[jersey-client-2.8.jar:na] at org.glassfish.jersey.client.ClientConfig.<init>(ClientConfig.java:451) ~[jersey-client-2.8.jar:na] at org.glassfish.jersey.client.JerseyClientBuilder.<init>(JerseyClientBuilder.java:94) ~[jersey-client-2.8.jar:na] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_171] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_171] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_171] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_171] at java.lang.Class.newInstance(Class.java:442) ~[na:1.8.0_171] at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:116) ~[javax.ws.rs-api-2.0.jar:2.0] at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:206) ~[javax.ws.rs-api-2.0.jar:2.0] at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:86) ~[javax.ws.rs-api-2.0.jar:2.0] at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114) ~[javax.ws.rs-api-2.0.jar:2.0] at br.com.integracaohuggy.clinicasim.endpoint.HuggyController.IntegrationTest(HuggyController.java:29) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) ~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.31.jar:8.5.31] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.31.jar:8.5.31] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
Segue a função:
@RequestMapping("/integrationTest") public void IntegrationTest() { // String de teste // https://api.powerzap.com.br/v2?page=2 Client client = ClientBuilder.newClient(); Response response = client.target("https://api.powerzap.com.br/v2?page=1") .request(MediaType.APPLICATION_JSON_TYPE) .header("X-Authorization", "Bearer xxxxxxxxxx") .get(); System.out.println("status: " + response.getStatus()); System.out.println("headers: " + response.getHeaders()); System.out.println("body:" + response.readEntity(String.class)); } Alguém saberia do que se trata? Como posso resolver ou alguma coisa dessa natureza?
Obrigado desde já!
Abraços!!!!
-
Por Guilherme do Vale
ola pessoal, Estou com um problema chato que não consigo resolver. Criei um datatable com cellEditor dentro de uma tab e, dentro dessa tab, eu coloquei um ajax que muda a lista do datatable toda vez que muda para outra tab. O problema é que, quando eu clico em outra tab e carrega o outro datatable eu perco a edição das células e só aparece o output da célula. Gostaria de uma ajuda pra saber o que está acontecendo e como resolver: xhtml <p:tabView value="#{cadastroContasBean.listaTabela}" dynamic="true" closeable="true" activeIndex="#{cadastroContasBean.idTabela}" var="tabela" style="heigth:100%;width:100%" id="tabView"> <p:tab title="tab" closable="true" id="tab"> <div> <p:dataTable binding="#{cadastroContasBean.dataTable}" var="gasto" value="#{cadastroContasBean.listaGasto}" scrollable="true" scrollHeight="150" editable="true" editMode="cell" id="Tabela" widgetVar="wTabela"> <p:column headerText="Nome"> <p:cellEditor> <f:facet name="output"> <p:outputLabel value="#{gasto.nome}" /> </f:facet> <f:facet name="input"> <p:inputText id="inputTextNome" required="true" value="#{cadastroContasBean.nome}" style="width:96%" binding="#{cadastroContasBean.inputTextNome}"> <p:ajax event="change" update="Tabela" listener="#{cadastroContasBean.atualizaVT('inputTextNome')}" execute="inputTextNome" process="@this"> </p:ajax> </p:inputText> </f:facet> </p:cellEditor> </p:column> <p:column headerText="Quantidade"> <p:cellEditor> <f:facet name="output"> <p:outputLabel value="#{gasto.quantidade}" /> </f:facet> <f:facet name="input"> <p:inputText id="inputQtd" required="true" value="#{cadastroContasBean.qtd}" style="width:96%" onkeydown="MascaraNumero()" onkeyup="MascaraNumero()" binding="#{cadastroContasBean.inputTextQtd}"> <p:ajax event="change" update="Tabela" listener="#{cadastroContasBean.atualizaVT('inputTextQtd')}" execute="inputQtd" process="@this" /> </p:inputText> </f:facet> </p:cellEditor> </p:column> <p:column headerText="Valor"> <p:cellEditor> <f:facet name="output"> <p:outputLabel value="#{gasto.valor}"> <f:convertNumber currencySymbol="R$" type="currency" /> </p:outputLabel> </f:facet> <f:facet name="input"> <p:inputText id="inputValor" required="true" value="#{cadastroContasBean.valor}" style="width:96%" binding="#{cadastroContasBean.inputTextValor}"> <f:convertNumber pattern="#,##0.00"></f:convertNumber> <f:validator validatorId="MoedaValidator" /> <p:ajax event="change" update="Tabela" listener="#{cadastroContasBean.atualizaVT('inputTextValor')}" execute="inputValor" process="@this"> </p:ajax> </p:inputText> </f:facet> </p:cellEditor> </p:column> <p:column headerText="Valor Total" id="vt"> <p:outputLabel id="outputVT" value="#{gasto.valorTotal}"> <f:convertNumber currencySymbol="R$" type="currency" /> </p:outputLabel> </p:column> </p:dataTable> <div id="addGasto"> <p:commandButton value="Add gasto" style="width:100%" actionListener="#{cadastroContasBean.addGasto}" update="Tabela"></p:commandButton> </div> </div> <div> <p:outputLabel value="Comentários: " for="comentario"></p:outputLabel> <p:inputTextarea value="#{tabela.comentarios}" id="comentario" autoResize="true" style="width: 100%; height: 50%"></p:inputTextarea> </div> </p:tab> <p:ajax event="tabChange" execute="tab" listener="#{cadastroContasBean.mudaTab}" process="@this" /> </p:tabView> MB public void mudaTab(TabChangeEvent event) { tabelaAtual = (Tabela)event.getData(); idTabela =(tabelaAtual).getId(); listarGastos(); } public void listarGastos(){ listaGasto = tabelaAtual.getListaGastos(); } Tabela public class Tabela { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String comentarios; @OneToMany (mappedBy="tabela") private List<Gastos> listaGastos = new ArrayList<Gastos>(); @ManyToOne private MesAno mesano; public List<Gastos> getListaGastos() { return listaGastos; } public void setListaGastos(List<Gastos> listaGastos) { this.listaGastos = listaGastos; } public MesAno getMesano() { return mesano; } public void setMesano(MesAno mesano) { this.mesano = mesano; } public String getComentarios() { return comentarios; } public void setComentarios(String comentarios) { this.comentarios = comentarios; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } Obs: não consigo identar o xhtml ¬¬
-