Commit 96238cba86b67e5c0783dea3a148f56c341ceb29
1 parent
15c3ae55
Exists in
master
Correções de charset e de mensagem de erro no envio de email(contato).
Showing
10 changed files
with
113 additions
and
137 deletions
Show diff stats
WebContent/WEB-INF/jsp/formularioOrgao/formularioOrgao.jsp
1 | -<%@page contentType="text/html" pageEncoding="UTF-8"%> | |
2 | 1 | <%@taglib prefix="t" tagdir="/WEB-INF/tags"%> |
3 | 2 | <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
4 | 3 | <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> |
5 | - | |
4 | +<%@page contentType="text/html" pageEncoding="UTF-8"%> | |
6 | 5 | <t:baseLayout> |
7 | 6 | <jsp:body> |
8 | 7 | ... | ... |
WebContent/WEB-INF/jsp/index/formulario.jsp
1 | -<%@page contentType="text/html" pageEncoding="UTF-8"%> | |
2 | 1 | <%@taglib prefix="t" tagdir="/WEB-INF/tags"%> |
3 | 2 | <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
4 | 3 | <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> |
5 | - | |
4 | +<%@page contentType="text/html" pageEncoding="UTF-8"%> | |
6 | 5 | <t:baseLayout> |
7 | 6 | <jsp:body> |
8 | 7 | <div class="funcionalidades"> |
... | ... | @@ -42,7 +41,7 @@ |
42 | 41 | <div id="introducao"> |
43 | 42 | |
44 | 43 | <h2 class="titulo">Questionário Acessibilidade</h2> |
45 | - <form id="formulario" method="post" action="${pageContext.request.contextPath}/salvar-formulario" onSubmit="return enviarDados();"> | |
44 | + <form id="formulario" method="post" action="${pageContext.request.contextPath}/salvar-formulario" accept-charset="UTF-8" onSubmit="return enviarDados();"> | |
46 | 45 | <fieldset> |
47 | 46 | <legend>Dados Acessibilidade</legend> |
48 | 47 | ... | ... |
WebContent/WEB-INF/mail.properties
... | ... | @@ -7,4 +7,4 @@ prop.email.authpass = "" |
7 | 7 | prop.email.auth = false |
8 | 8 | prop.email.to = govbr@planejamento.gov.br |
9 | 9 | prop.email.from = govbr@planejamento.gov.br |
10 | -prop.email.copiaEmailTo = govbr@planejamento.gov.br | |
11 | 10 | \ No newline at end of file |
11 | +prop.email.copiaEmailTo = gibran.sodre@planejamento.gov.br | |
12 | 12 | \ No newline at end of file | ... | ... |
WebContent/WEB-INF/tags/baseLayout.tag
1 | -<%@ tag language="java" pageEncoding="UTF-8"%> | |
2 | -<%@attribute name="body" fragment="true"%> | |
3 | - | |
4 | 1 | |
5 | 2 | <!DOCTYPE html> |
6 | 3 | <html lang="pt-br" id="principal"> |
7 | 4 | |
8 | 5 | <head> |
9 | - <title>Formulário Acessibilidade</title> | |
10 | - <meta charset="utf-8" /> | |
11 | - <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
6 | + <title>Formulário Acessibilidade</title> | |
7 | + | |
8 | + | |
12 | 9 | <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/default.css" media="screen"> |
13 | 10 | <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/breadcrumb.css" media="screen"> |
14 | 11 | <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/formulario.css" media="screen"> |
... | ... | @@ -20,9 +17,9 @@ |
20 | 17 | <header id="topoPagina"> |
21 | 18 | <div id="topo"> |
22 | 19 | <ul id="accessibility"> |
23 | - <li><a accesskey="1" href="#inicioConteudo" id="link-conteudo">Ir para o conteúdo <span>1</span></a></li> | |
20 | + <li><a accesskey="1" href="#inicioConteudo" id="link-conteudo">Ir para o conteúdo <span>1</span></a></li> | |
24 | 21 | <li><a accesskey="2" href="#menu" id="link-menu">Ir para o menu <span>2</span></a></li> |
25 | - <li><a accesskey="4" href="#fimConteudo" id="link-rodape">Ir para o rodapé <span>4</span></a></li> | |
22 | + <li><a accesskey="4" href="#fimConteudo" id="link-rodape">Ir para o rodapé <span>4</span></a></li> | |
26 | 23 | </ul> |
27 | 24 | <ul id="portal-siteactions"> |
28 | 25 | <li id="siteaction-accessibility"><a id="acessibilidadeLink" href="${pageContext.request.contextPath}/acessibilidade-site" accesskey="5">ACESSIBILIDADE <span>5</span></a></li> |
... | ... | @@ -33,8 +30,8 @@ |
33 | 30 | </div> |
34 | 31 | <div id="logoTitulo"> |
35 | 32 | <h1> |
36 | - <span id="tituloUm">Ministério do Planejamento, Desenvolvimento e Gestão</span><br> | |
37 | - <a href="${pageContext.request.contextPath}/" id="logoFormulario"><span id="tituloDois">Relatório Circunstanciado</span></a><br> | |
33 | + <span id="tituloUm">Ministério do Planejamento, Desenvolvimento e Gestão</span><br> | |
34 | + <a href="${pageContext.request.contextPath}/" id="logoFormulario"><span id="tituloDois">Relatório Circunstanciado</span></a><br> | |
38 | 35 | <span id="tituloTres">Governo Federal</span> |
39 | 36 | </h1> |
40 | 37 | </div> |
... | ... | @@ -44,11 +41,11 @@ |
44 | 41 | <nav id="menu"> |
45 | 42 | <ul> |
46 | 43 | <li id="portalservicos-Instrucao" class="portalservicos-item"> |
47 | - <a href="${pageContext.request.contextPath}/instrucao-site" id="instrucaoLink">Instruções de Preenchimento |</a> | |
44 | + <a href="${pageContext.request.contextPath}/instrucao-site" id="instrucaoLink">Instruções de Preenchimento |</a> | |
48 | 45 | </li> |
49 | 46 | |
50 | 47 | <li id="portalservicos-relatorio" class="portalservicos-item"> |
51 | - <a href="${pageContext.request.contextPath}/relatorio-site" id="relatorioLink">Emitir Relatório |</a> | |
48 | + <a href="${pageContext.request.contextPath}/relatorio-site" id="relatorioLink">Emitir Relatório |</a> | |
52 | 49 | </li> |
53 | 50 | |
54 | 51 | <li id="portalservicos-contato" class="portalservicos-item"> |
... | ... | @@ -59,14 +56,14 @@ |
59 | 56 | |
60 | 57 | <div id="main"> |
61 | 58 | <div id="content"> |
62 | - <a id="inicioConteudo" class="oculto">InÃcio do Conteúdo</a> | |
63 | - <!-- InÃcio Conteudo --> | |
59 | + <a id="inicioConteudo" class="oculto">Início do Conteúdo</a> | |
60 | + <!-- Início Conteudo --> | |
64 | 61 | |
65 | 62 | <jsp:doBody /> |
66 | 63 | |
67 | - <!--Término Conteudo--> | |
64 | + <!--Término Conteudo--> | |
68 | 65 | |
69 | - <a id="fimConteudo" class="oculto">Fim do Conteúdo</a> | |
66 | + <a id="fimConteudo" class="oculto">Fim do Conteúdo</a> | |
70 | 67 | </div> |
71 | 68 | <div id="voltar-topo"> |
72 | 69 | <a href="#topoPagina">Voltar para o topo</a> |
... | ... | @@ -79,7 +76,7 @@ |
79 | 76 | <div> |
80 | 77 | <ul><li id="acessoInf"> |
81 | 78 | <a href="http://www.acessoainformacao.gov.br/" class="logo-acesso"> |
82 | - <img src="${pageContext.request.contextPath}/imgs/acesso-a-infornacao.png" alt="Acesso a Informação"></a> | |
79 | + <img src="${pageContext.request.contextPath}/imgs/acesso-a-infornacao.png" alt="Acesso a Informação"></a> | |
83 | 80 | </li> |
84 | 81 | <li id="last-item"> |
85 | 82 | <a href="http://www.brasil.gov.br/" class="logo-brasil"> | ... | ... |
WebContent/WEB-INF/web.xml
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
3 | - xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
4 | - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
5 | - id="WebApp_ID" version="2.5"> | |
6 | - <display-name>Formulario Acessibilidade</display-name> | |
7 | - | |
8 | - <!-- | |
9 | - VRaptor will scan classpath for all @Component and | |
10 | - @Resource inside WEB-INF/classes | |
11 | - | |
12 | - If you want to load them also from WEB-INF/lib/ jars, | |
13 | - you need to specify from which packages they will | |
14 | - be loaded, comma separated: | |
15 | - --> | |
16 | - | |
17 | - <!-- | |
18 | - <context-param> | |
19 | - <param-name>br.com.caelum.vraptor.packages</param-name> | |
20 | - <param-value>br.com.caelum.vraptor.blank</param-value> | |
21 | - </context-param> | |
22 | - --> | |
23 | - | |
24 | - <!-- | |
25 | - if you are using a servlet 3.0 container | |
26 | - as glassfish 3 or jetty 8, you dont need this | |
27 | - filter configuration | |
28 | - --> | |
29 | - | |
30 | - <!-- <context-param> | |
31 | - <param-name>br.com.caelum.vraptor.provider</param-name> | |
32 | - <param-value>br.com.caelum.vraptor.ioc.guice.GuiceProvider</param-value> | |
33 | - </context-param>--> | |
34 | - | |
35 | - <filter> | |
36 | - <filter-name>vraptor</filter-name> | |
37 | - <filter-class>br.com.caelum.vraptor.VRaptor</filter-class> | |
38 | - </filter> | |
39 | - | |
40 | - <filter-mapping> | |
41 | - <filter-name>vraptor</filter-name> | |
42 | - <url-pattern>/*</url-pattern> | |
43 | - <dispatcher>FORWARD</dispatcher> | |
44 | - <dispatcher>REQUEST</dispatcher> | |
45 | - </filter-mapping> | |
46 | - | |
47 | - | |
48 | -</web-app> | |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> | |
3 | + <display-name>Formulario Acessibilidade</display-name> | |
4 | + <filter> | |
5 | + <filter-name>vraptor</filter-name> | |
6 | + <filter-class>br.com.caelum.vraptor.VRaptor</filter-class> | |
7 | + </filter> | |
8 | + <context-param> | |
9 | + <param-name>br.com.caelum.vraptor.encoding</param-name> | |
10 | + <param-value>UTF-8</param-value> | |
11 | + </context-param> | |
12 | + <filter-mapping> | |
13 | + <filter-name>vraptor</filter-name> | |
14 | + <url-pattern>/*</url-pattern> | |
15 | + <dispatcher>FORWARD</dispatcher> | |
16 | + <dispatcher>REQUEST</dispatcher> | |
17 | + </filter-mapping> | |
18 | + | |
19 | + | |
20 | +</web-app> | |
49 | 21 | \ No newline at end of file | ... | ... |
src/br/com/controller/contatoController.java
... | ... | @@ -9,8 +9,6 @@ import javax.servlet.ServletContext; |
9 | 9 | |
10 | 10 | import org.apache.commons.mail.EmailException; |
11 | 11 | |
12 | - | |
13 | - | |
14 | 12 | // import br.com.model.utilities.Validate; |
15 | 13 | import br.com.caelum.vraptor.Path; |
16 | 14 | import br.com.caelum.vraptor.Post; |
... | ... | @@ -48,44 +46,57 @@ public class contatoController { |
48 | 46 | } |
49 | 47 | |
50 | 48 | @Post("/confirmacao") |
51 | - public void confirmation(Contato contato){ | |
52 | - | |
53 | - Validacao validate = new Validacao(); | |
54 | - | |
55 | - List<Validacao> mensagens = new ArrayList<Validacao>(); | |
56 | - | |
57 | - mensagens = validate.ValidarContato(contato); | |
58 | - | |
59 | - if(mensagens.size() > 0) | |
60 | - { | |
61 | - result.include("mensagens", mensagens); | |
62 | - this.validator.add(new ValidationMessage("", "")); | |
63 | - this.validator.onErrorUsePageOf(contatoController.class).contato(); | |
64 | - | |
65 | - }else | |
66 | - { | |
67 | - String respSendEmail; | |
68 | - | |
69 | - Email email = new Email(this.application.getRealPath("") + "/WEB-INF/mail.properties"); | |
70 | - | |
71 | - EnvioEmailSemAutenticacao envioEmailSemAutenticacao = new EnvioEmailSemAutenticacao(email.getHost(), Integer.toString(email.getPort())); | |
72 | - | |
73 | - respSendEmail = envioEmailSemAutenticacao.sendMailSemCopia(contato.getEmail(),email.getTo(), "Formulário Circunstanciado - " + StringHelper.convertFromUTF8(contato.getAssunto()), StringHelper.convertFromUTF8(contato.getMensagem()),email.getAuth(), email.getAuthUser(), email.getAuthPass()); | |
74 | - | |
75 | - | |
76 | - /*String respSendEmail = email.sendEmail("Contato","govbr@planejamento.gov.br", contato.getNome(),contato.getEmail(),StringHelper.convertFromUTF8(contato.getAssunto()), | |
77 | - StringHelper.convertFromUTF8(contato.getMensagem()), true);*/ | |
78 | - | |
79 | - if (respSendEmail.equals("")) { | |
80 | - result.include("mensagem", "Mensagem enviada com Sucesso"); | |
81 | - result.include("status", "success"); | |
82 | - | |
83 | - } else { | |
84 | - result.include("mensagem", | |
85 | - "N�o foi poss�vel enviar a mensagem! Ocorreu o problema: " + respSendEmail); | |
86 | - result.include("status", "error"); | |
87 | - } | |
88 | - this.result.redirectTo(contatoController.class).contato(); | |
89 | - } | |
49 | + public void confirmation(Contato contato) { | |
50 | + | |
51 | + Validacao validate = new Validacao(); | |
52 | + | |
53 | + List<Validacao> mensagens = new ArrayList<Validacao>(); | |
54 | + | |
55 | + mensagens = validate.ValidarContato(contato); | |
56 | + | |
57 | + if (mensagens.size() > 0) { | |
58 | + result.include("mensagem", mensagens); | |
59 | + result.include("status", "error"); | |
60 | + // this.validator.add(new ValidationMessage("", "")); | |
61 | + this.validator.onErrorUsePageOf(contatoController.class).contato(); | |
62 | + | |
63 | + } else { | |
64 | + String respSendEmail; | |
65 | + | |
66 | + Email email = new Email(this.application.getRealPath("") + "/WEB-INF/mail.properties"); | |
67 | + | |
68 | + EnvioEmailSemAutenticacao envioEmailSemAutenticacao = | |
69 | + new EnvioEmailSemAutenticacao(email.getHost(), Integer.toString(email.getPort())); | |
70 | + | |
71 | + respSendEmail = | |
72 | + envioEmailSemAutenticacao.sendMailSemCopia(contato.getEmail(), email.getTo(), | |
73 | + "Formulário Circunstanciado - " + StringHelper.convertFromUTF8(contato.getAssunto()), | |
74 | + StringHelper.convertFromUTF8(contato.getMensagem()), email.getAuth(), | |
75 | + email.getAuthUser(), email.getAuthPass()); | |
76 | + | |
77 | + | |
78 | + /* | |
79 | + * String respSendEmail = email.sendEmail("Contato","govbr@planejamento.gov.br", | |
80 | + * contato.getNome(),contato.getEmail(),StringHelper.convertFromUTF8(contato.getAssunto()), | |
81 | + * StringHelper.convertFromUTF8(contato.getMensagem()), true); | |
82 | + */ | |
83 | + | |
84 | + if (respSendEmail.equals("")) { | |
85 | + validate.setCampo(""); | |
86 | + validate.setMensagem("Mensagem enviada com Sucesso!"); | |
87 | + mensagens.add(validate); | |
88 | + result.include("mensagem", mensagens); | |
89 | + result.include("status", "success"); | |
90 | + } else { | |
91 | + validate.setCampo(""); | |
92 | + validate.setMensagem("Não foi possível enviar a mensagem! Ocorreu o problema: " | |
93 | + + respSendEmail); | |
94 | + mensagens.add(validate); | |
95 | + result.include("mensagem", mensagens); | |
96 | + result.include("status", "error"); | |
97 | + } | |
98 | + | |
99 | + } | |
100 | + this.result.redirectTo(contatoController.class).contato(); | |
90 | 101 | } |
91 | 102 | } | ... | ... |
src/br/com/controller/indexController.java
1 | 1 | package br.com.controller; |
2 | 2 | |
3 | + | |
3 | 4 | import java.util.ArrayList; |
4 | 5 | import java.util.List; |
5 | 6 | import java.util.Map; |
... | ... | @@ -424,7 +425,7 @@ public class indexController { |
424 | 425 | |
425 | 426 | switch (respostaQuestionario.getPergunta().getIdPergunta()) { |
426 | 427 | case 1: |
427 | - result.include("nomeOrgao", respostaQuestionario.getTextoResposta().replace("null", "").trim()); | |
428 | + result.include("nomeOrgao", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", ""):respostaQuestionario.getTextoResposta()); | |
428 | 429 | break; |
429 | 430 | case 7: |
430 | 431 | result.include("perguntaAcessibilidade", respostaQuestionario.getOpcaoResposta() |
... | ... | @@ -435,7 +436,7 @@ public class indexController { |
435 | 436 | .getIdOpcaoResposta()); |
436 | 437 | break; |
437 | 438 | case 9: |
438 | - result.include("espacoReclamacao", respostaQuestionario.getTextoResposta().replace("null", "").trim()); | |
439 | + result.include("espacoReclamacao", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", ""):respostaQuestionario.getTextoResposta()); | |
439 | 440 | break; |
440 | 441 | case 10: |
441 | 442 | result.include("perguntaEstimulo", respostaQuestionario.getOpcaoResposta() |
... | ... | @@ -449,8 +450,7 @@ public class indexController { |
449 | 450 | .getIdOpcaoResposta()); |
450 | 451 | break; |
451 | 452 | case 13: |
452 | - result.include("justificativaRequisito", respostaQuestionario.getTextoResposta().replace("null", "") | |
453 | - .trim()); | |
453 | + result.include("justificativaRequisito", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", ""):respostaQuestionario.getTextoResposta()); | |
454 | 454 | break; |
455 | 455 | case 14: |
456 | 456 | result.include("opcaoContrat", respostaQuestionario.getOpcaoResposta() |
... | ... | @@ -468,7 +468,7 @@ public class indexController { |
468 | 468 | .getIdOpcaoResposta()); |
469 | 469 | break; |
470 | 470 | case 18: |
471 | - result.include("outroAvaliador", respostaQuestionario.getTextoResposta().replace("null", "").trim()); | |
471 | + result.include("outroAvaliador", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", ""):respostaQuestionario.getTextoResposta()); | |
472 | 472 | break; |
473 | 473 | case 20: |
474 | 474 | result.include("nivelWcag", respostaQuestionario.getOpcaoResposta() |
... | ... | @@ -489,11 +489,10 @@ public class indexController { |
489 | 489 | assistiva.add(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta()); |
490 | 490 | break; |
491 | 491 | case 25: |
492 | - result.include("justificativaAssistiva", respostaQuestionario.getTextoResposta().replace("null", "") | |
493 | - .trim()); | |
492 | + result.include("justificativaAssistiva", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", ""):respostaQuestionario.getTextoResposta()); | |
494 | 493 | break; |
495 | 494 | case 26: |
496 | - result.include("dificuldadePrazo", respostaQuestionario.getTextoResposta().replace("null", "").trim()); | |
495 | + result.include("dificuldadePrazo", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", ""):respostaQuestionario.getTextoResposta()); | |
497 | 496 | break; |
498 | 497 | default: |
499 | 498 | break; | ... | ... |
src/br/com/controller/relatorioController.java
... | ... | @@ -93,19 +93,19 @@ public class relatorioController { |
93 | 93 | |
94 | 94 | switch (respostaQuestionario.getPergunta().getIdPergunta()) { |
95 | 95 | case 1: |
96 | - result.include("nomeOrgao", respostaQuestionario.getTextoResposta()); | |
96 | + result.include("nomeOrgao", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
97 | 97 | break; |
98 | 98 | case 2: |
99 | - result.include("nomePessoa", respostaQuestionario.getTextoResposta()); | |
99 | + result.include("nomePessoa", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
100 | 100 | break; |
101 | 101 | case 3: |
102 | - result.include("cargo", respostaQuestionario.getTextoResposta()); | |
102 | + result.include("cargo", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
103 | 103 | break; |
104 | 104 | case 4: |
105 | - result.include("telefone", respostaQuestionario.getTextoResposta()); | |
105 | + result.include("telefone", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
106 | 106 | break; |
107 | 107 | case 5: |
108 | - result.include("email", respostaQuestionario.getTextoResposta()); | |
108 | + result.include("email", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
109 | 109 | break; |
110 | 110 | case 7: |
111 | 111 | result.include("perguntaAcessibilidade", respostaQuestionario.getOpcaoResposta() |
... | ... | @@ -116,7 +116,7 @@ public class relatorioController { |
116 | 116 | .getDescOpcaoResposta()); |
117 | 117 | break; |
118 | 118 | case 9: |
119 | - result.include("espacoReclamacao", respostaQuestionario.getTextoResposta()); | |
119 | + result.include("espacoReclamacao", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
120 | 120 | break; |
121 | 121 | case 10: |
122 | 122 | result.include("perguntaEstimulo", respostaQuestionario.getOpcaoResposta() |
... | ... | @@ -130,7 +130,7 @@ public class relatorioController { |
130 | 130 | .getDescOpcaoResposta()); |
131 | 131 | break; |
132 | 132 | case 13: |
133 | - result.include("justificativaRequisito", respostaQuestionario.getTextoResposta()); | |
133 | + result.include("justificativaRequisito", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
134 | 134 | break; |
135 | 135 | case 14: |
136 | 136 | result.include("opcaoContrat", respostaQuestionario.getOpcaoResposta() |
... | ... | @@ -148,7 +148,7 @@ public class relatorioController { |
148 | 148 | .getDescOpcaoResposta()); |
149 | 149 | break; |
150 | 150 | case 18: |
151 | - result.include("outroAvaliador", respostaQuestionario.getTextoResposta()); | |
151 | + result.include("outroAvaliador", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
152 | 152 | break; |
153 | 153 | case 19: |
154 | 154 | |
... | ... | @@ -173,10 +173,10 @@ public class relatorioController { |
173 | 173 | assistiva.add(respostaQuestionario.getOpcaoResposta().getDescOpcaoResposta()); |
174 | 174 | break; |
175 | 175 | case 25: |
176 | - result.include("justificativaAssistiva", respostaQuestionario.getTextoResposta()); | |
176 | + result.include("justificativaAssistiva", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
177 | 177 | break; |
178 | 178 | case 26: |
179 | - result.include("dificuldadePrazo", respostaQuestionario.getTextoResposta()); | |
179 | + result.include("dificuldadePrazo", respostaQuestionario.getTextoResposta().equalsIgnoreCase("null") ?respostaQuestionario.getTextoResposta().replace("null", "Não Respondido"):respostaQuestionario.getTextoResposta()); | |
180 | 180 | break; |
181 | 181 | default: |
182 | 182 | break; | ... | ... |
src/br/com/dao/HashDao.java
... | ... | @@ -21,13 +21,13 @@ public class HashDao { |
21 | 21 | Questionario questionario = new Questionario(); |
22 | 22 | |
23 | 23 | try { |
24 | - String hashAutenticacao = GeradorCodigoHash.gerarHash(valorHash); | |
24 | + //String hashAutenticacao = GeradorCodigoHash.gerarHash(valorHash); | |
25 | 25 | estado = con.createStatement(); |
26 | 26 | |
27 | 27 | estado.execute(sql.toString()); |
28 | 28 | sql.append("SELECT id_questionario, dt_inicio_questionario, dt_fim_questionario,"); |
29 | 29 | sql.append("no_orgao, hash_autenticacao, questionario_respondido"); |
30 | - sql.append(" FROM questionario where hash_autenticacao = '" + hashAutenticacao + "'"); | |
30 | + sql.append(" FROM questionario where hash_autenticacao = '" + valorHash + "'"); | |
31 | 31 | sql.append(" and (dt_inicio_questionario <= '" + DateUtil.dataHoraAtual() + "')"); |
32 | 32 | sql.append(" and (dt_fim_questionario >= '" + DateUtil.dataHoraAtual() + "');"); |
33 | 33 | |
... | ... | @@ -47,9 +47,6 @@ public class HashDao { |
47 | 47 | System.out.println("Deu erro!"); |
48 | 48 | e.printStackTrace(); |
49 | 49 | |
50 | - } catch (NoSuchAlgorithmException e) { | |
51 | - | |
52 | - e.printStackTrace(); | |
53 | 50 | } finally { |
54 | 51 | if (con != null) { |
55 | 52 | try { | ... | ... |
src/br/com/dao/RespostaQuestionarioDao.java
1 | 1 | package br.com.dao; |
2 | 2 | |
3 | +import java.nio.ByteBuffer; | |
4 | +import java.nio.charset.Charset; | |
3 | 5 | import java.sql.Connection; |
4 | 6 | import java.sql.DriverManager; |
5 | 7 | import java.sql.ResultSet; |
... | ... | @@ -268,13 +270,13 @@ public class RespostaQuestionarioDao { |
268 | 270 | resultado = amostragemSiteQuestionarioDao.salvarAmostragem(respostaQuestionario.getAmostragemSiteQuestionario(), con, estado); |
269 | 271 | resultadoAmostragem = String.valueOf(resultado); |
270 | 272 | } |
271 | - | |
273 | + | |
272 | 274 | sql.append("INSERT INTO resposta_questionario(id_pergunta, id_opcao_resposta, texto_resposta, dt_resposta_questionario, id_questionario, id_amostra_site_questionario)"); |
273 | 275 | sql.append("VALUES (" + respostaQuestionario.getPergunta().getIdPergunta() + "," |
274 | 276 | + respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() + ",'"); |
275 | 277 | sql.append(respostaQuestionario.getTextoResposta() + "','" + dataHoraRespostaQuestionario + "',"); |
276 | 278 | sql.append(respostaQuestionario.getQuestionario().getIdQuestionario() + "," + resultadoAmostragem + ");"); |
277 | - | |
279 | + | |
278 | 280 | resultado = estado.executeUpdate(sql.toString()); |
279 | 281 | |
280 | 282 | idQuestionario = respostaQuestionario.getQuestionario().getIdQuestionario(); | ... | ... |