Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
Solicitud de página al hacer clic en el botón con Spring, Thymeleaf y js

así que hice una implementación simple en la carga de contenido sin recargar. Utiliza AJAX para cargar contenido desde otro controlador.

 $(document.body).on('click', 'button#first', function() { $('#content').load("/first"); }); $(document.body).on('click', 'button#second',function() { $('#content').load("/second"); });

Por ahora tengo 3 controladores:

  • Controlador de inicio (localhost/)
  • FirstController (localhost/primero)
  • SecondController (localhost/segundo)
 @GetMapping("/first") public String getFirst() { return "includes/first:: content"; } @GetMapping("/second") public String getSecond() { return "includes/second :: content"; }

Y eso funciona bien, pero, por supuesto, también puedo ingresar /primero o /segundo y obtener contenido inadecuado, ya que son fragmentos. Entonces, mi pregunta, ¿hay alguna forma de evitar que las personas simplemente ingresen /first en su navegador o manejen la carga de contenido del lado del servidor en lugar de ajax?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!