• Post Reply Bookmark Topic Watch Topic
  • New Topic

forward vs sendredirect vs include

 
bairava surya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • 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?
 
Tapas Chand
Ranch Hand
Posts: 602
9
BSD Java
  • Mark post as helpful
  • send pies
  • 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
    • 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: 602
    9
    BSD Java
    • Mark post as helpful
    • send pies
    • 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
    • Quote
    • Report post to moderator
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!