• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

forward vs sendredirect vs include

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The above code is called twice when i use forward or include but it called once when am using redirect
please suggest the reason behind it?
 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think more information is required to identify the cause.
This much code does not seem to cause it calling twice whether include or forward.

On a different note this code has few problems.
  • Request.getRequestDispatcher() method accepts an argument which must start with "/".
  • It is good design practice to program to interface not implementation. So 1st line can be rewritten.
  • Using raw type ArrayList is not good and is error prone.
  •  
    bairava surya
    Ranch Hand
    Posts: 134
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    when am using include or forward the the java code is executed twice but when i use sendredirect it is executed only once.
    In my view in the forward or include request the resource is executed again but in sendredirect it is not.please correct my view
     
    Tapas Chand
    Ranch Hand
    Posts: 624
    9
    BSD Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Looks like something to do with URL mapping.
    Can you post relevant part of web.xml and the URLs of the servlet(HospitalServlt) and URLs of the jsps(PatientProfile.jsp and the jsp which you have posted).
     
    bairava surya
    Ranch Hand
    Posts: 134
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
     
    reply
      Bookmark Topic Watch Topic
    • New Topic