This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionForward adicionarEtiqueta(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ApplicationException { | |
try{ | |
setActionForward(mapping.findForward("pgAjaxEtiqueta")); | |
String etiqueta = request.getParameter("etiqueta"); | |
// Inicio Validações | |
if(StringUtils.isBlank(etiqueta)){ | |
throw new ApplicationException("errors.required",new String[]{"Etiqueta"}, ApplicationException.ICON_AVISO); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ao lançar uma exceção no java, em método ajax que retorna uma jsp, se for usado o tratamento puro como código abaixo a msg de exceção será retornada dentro da div de retorno do ajax. | |
Para corrigir este problema setar a tagGeral com a div de retorno ajax e depois chamar processaErro() da prototype.js | |
new Ajax.Updater({success: divAtualizar}, url,{ | |
method: 'post', | |
parameters: params, | |
onSuccess: function(response){ | |
if (tipoContratado === "${TIPO_CONTRATADO_PRINCIPAL}") { | |
buscarPessoaFisicaResponsavelCadastroFornecedorAjax(cnpjCpfCodInternacional.value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page import="br.gov.pr.celepar.spiweb.enumeration.TipoEtiqueta"%> | |
<c:set var="TIPO_ETIQUETA_TEXTO" value="<%= TipoEtiqueta.TEXTO.getValor() %>"/> | |
<c:set var="TIPO_ETIQUETA_NUMERO_DECIMAL" value="<%= TipoEtiqueta.NUMERO_DECIMAL.getValor() %>"/> | |
<c:set var="TIPO_ETIQUETA_VALOR_MONETARIO" value="<%= TipoEtiqueta.VALOR_MONETARIO.getValor() %>"/> | |
var tipoEtiquetaTexto = '${TIPO_ETIQUETA_TEXTO}'; | |
var tipoEtiquetaNumeroDecimal = '${TIPO_ETIQUETA_NUMERO_DECIMAL}'; | |
var tipoEtiquetaValorMonetario = '${TIPO_ETIQUETA_VALOR_MONETARIO}'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$jQ("#formModelo").attr("action", "manterDocumentoModelo.do?action=gerarDocumentoPdf&listaNomesEtiquetas="+JSON.stringify(jsonObj)+"&conteudoDocumento="+$jQ("#corpoDocumentoDiv").html()).submit(function(e) { | |
$jQ("#listaModelos").val(0).change(); | |
carregarModelo(""); | |
}); | |
$jQ("#formModelo").submit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Obter um objeto pelo hibernate que possua somente alguns atributos e que possua listas usando o SELECT new objeto() | |
1 - Obter o objeto usando o new do hibernate selecionando os campos necessários; | |
2 - Fazer uma query separada para obter as listas e setar no objeto. | |
public List<Modelo> listarPorParametro(String nomeModelo, Integer codigoTipoModelo, Integer codigoEspecie, String codigoLocal, Integer codigoSituacao) throws ApplicationException { | |
try { | |
Session session = HibernateUtil.currentSession(); | |
StringBuffer sql = new StringBuffer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Integer> listaTipoAnexo = new ArrayList<Integer>(Arrays.asList(Dominios.TIPO_RASCUNHO_PROCESSO, Dominios.TIPO_RASCUNHO_DOCUMENTO_MODELO)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you want to load the response you are getting from your ajax server page to the div with Id dvShiftDialog, you can use the html method to do so. | |
html method will replace the current inner html of that element with the new content (in this case the content of msg variable) | |
var url="some-valid-url-to-handle-ajax"; | |
$.ajax({ | |
type : "POST", | |
url : url, | |
cache : false, | |
success : function(msg) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function exibirNotificacao(id){ | |
$jQuery("#dlg_notificacao").load("consultarProtocoloDigital.do?action=ajaxCarregarNotificacao", {id:id}, function(){ | |
dlgAbreNotificacao.dialog("open"); | |
}); | |
} | |
Passar form via jquery: | |
var teste = $jQuery('#form1').serialize(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Pelo Nome | |
$jQ("form[name='gerarListagemEliminacaoForm']").serialize() | |
2. Pela posição do form na jsp | |
$jQ("form:eq(0)").serialize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var form = document.getElementById('frm_upload'); | |
var formData = new FormData(form); | |
************************************************** Com arrayBuffer *************************************************************** | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', 'exibirProtocoloDigital.do?action=exibirVolumePDF&arquivo='+codArquivo+'&codigoOrgaoPara='+codigoOrgaoPara, true); | |
xhr.responseType = 'arraybuffer'; | |
xhr.send(formData); | |
xhr.onload = function(e) { |