Hi,

how can I call another JSP without transferring control to that. The response.sendRedirect is transferring control to the next jsp page. I still have some code after the response line which needs to be executed but it doesnt gets executed.

Any suggestions?

Thanks

Recommended Answers

All 4 Replies

Sorry I do no see logic in what you trying to do. Redirect is for giving up current document and moving on next one and not holding on old location.

Will you explain what you are up to?

ok. let's say I have Main.jsp and newpage.jsp. let statements in main.jsp be like
int i = 1;
response.sendredirect("newpage.jsp");
i=3;
out.println(i);

currently, running this code will transfer control to newpage.jsp and will not execute the next two lines. how can i execute the next commands after running newpage.jsp. I do not wish to transfer control to newpage.jsp. it may run in background. I know only of response.sendRedirect now. Is there a way to achieve the above mentioned objective?

Start using servlets...

hello

int i = 1;
<%@include file= "newpage.jsp"%>
i=3;
out.println(i);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.