Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2003
    Messaggi
    1,258

    servlet java problema con indirizzo

    Ciao a tutti,
    ho una servlet java, che nel metodo doGet gli faccio fare:

    dispatcher = getServletContext().getRequestDispatcher("/login.jsp");
    if(dispatcher != null){
    dispatcher.forward(req,res);
    }

    viene richiamata da una pagina jsp in cui c'è questo link:
    [Log-out]

    il problema è che...va bene ci va alla pagina login.jsp ma sulla barra del browser..rimane:

    http://localhost:8080/servlet/Contro...ction=invalida

    funziona tutto bene...ma mi chiedevo...è normale?

  2. #2

    Re: servlet java problema con indirizzo

    Originariamente inviato da Lucked
    Ciao a tutti,
    ho una servlet java, che nel metodo doGet gli faccio fare:

    dispatcher = getServletContext().getRequestDispatcher("/login.jsp");
    if(dispatcher != null){
    dispatcher.forward(req,res);
    }

    viene richiamata da una pagina jsp in cui c'è questo link:
    [Log-out]

    il problema è che...va bene ci va alla pagina login.jsp ma sulla barra del browser..rimane:

    http://localhost:8080/servlet/Contro...ction=invalida

    funziona tutto bene...ma mi chiedevo...è normale?
    Si, in quanto fai un forward non un redirect

    A Controller servlet may perform either a forward or a redirect operation at the end of processing a request.

    Forward

    * forward is performed internally by the servlet
    * the browser is completely unaware that it has taken place, so its original URL remains intact
    * any browser reload will simple repeat the original request, with the original URL

    Redirect

    * redirect is a two step process, where the web application instructs the browser to fetch a second URL, which differs from the original
    * a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL
    * redirect is always slower than a forward, since it requires a second browser request
    * beans placed in the original request scope are not available to the second request

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.