<%@page import="br.com.consultorgov.Hibernate.HFaq"%> <%@page import="br.com.consultorgov.Classes.Faq"%> <%@page import="br.com.consultorgov.Hibernate.HCategoria"%> <%@page import="br.com.consultorgov.Classes.Categoria"%>
<% String id_categoria = request.getParameter("id_categoria"); String id_faq = request.getParameter("id_faq"); HCategoria hibCategoria = new HCategoria(); if(id_categoria != null) { HFaq hibFaq = new HFaq(); Faq[] faqs = hibFaq.getFaqs(0,Integer.parseInt(id_categoria)); %>

Perguntas e Respostas
<%= hibCategoria.getCategoria(Integer.parseInt(id_categoria)).getNome() %>

 
<% if(faqs != null) { for(int i = 0;i < faqs.length;i++) { %>
  • <%= faqs[i].getPergunta() %>

  • <% } } %>
    <% } else if(id_faq != null) { HFaq hibFaq = new HFaq(); Faq faq = hibFaq.getFaq(Integer.parseInt(id_faq)); if(faq != null) { %>

    Perguntas e Respostas
    <%= hibCategoria.getCategoria(faq.getCategoria().getId()).getNome() %>

     
  • <%= faq.getPergunta() %>
  • R: <%= faq.getResposta().replaceAll("\n","
    ") %>

    <% } } else { Categoria[] categorias = hibCategoria.getCategorias(0); %>

    Perguntas e Respostas

    Selecione a categoria
     
    <% if(categorias != null) { for(int i = 0;i < categorias.length;i++) { %>
  • <%= categorias[i].getNome() %>

  • <% } } %>
    <% } %>