• Empleos
  • Sobre nosotros
  • Empleos
    • Inicio
    • Empleos
    • Cursos y retos
  • Empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

238
Vistas
Cómo pasar el parámetro de jsp al controlador spring mvc

Tengo un problema al pasar un parámetro (data:image/png;base64 generado a partir de un gráfico) desde jsp (porque generé esa URL de datos con javascript) al controlador Spring.

 My controller is this: @ResponseBody @RequestMapping(value = "/generateChartImg", method = RequestMethod.GET,produces = "image/jpeg") public byte[] generateChartImg(@RequestParam("img") String img){ final String methodName = "generateChartImg()"; img = img.replace("data:image/png;base64,", ""); logger.info("{} - url immagine chart: {}", methodName,img); byte[] decodeBase64 = Base64.getDecoder().decode(img.getBytes(StandardCharsets.UTF_8)); return decodeBase64; } and the jsp is: <body> <div id="chart" style="width:400px;height:300px;"></div> <input type="hidden" id="img" name="img" value="" /> </body> and javascript script is: < script type = "text/javascript" > var options = { series: [44, 55, 13, 43, 22], chart: { width: 380, type: 'pie', }, labels: ['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], responsive: [{ breakpoint: 480, options: { chart: { width: 200 }, legend: { position: 'bottom' } } }] }; var chart = new ApexCharts(document.querySelector("#chart"), options); chart.render().then(() => { window.setTimeout(function() { chart.dataURI().then((uri) => { document.getElementById('img').value = uri; }) }, 1000) })

Espero que alguien pueda ayudarme a resolverlo porque solo necesito obtener una imagen generada por apexchart y enviarla al controlador para que cuando llamo a la URL del controlador me muestre la imagen. Hice una prueba pasando un dataurl estático y funciona, pero ahora quiero generar dataurl y pasarlo desde jsp. GRACIAS

over 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda