• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Invoking another JSP in Iframe

 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 3 jsp jsp1 contains iframe jsp 2 contains a button and jsp3 contains some business logic , i open jsp 2 in jsp1 b y setting the src atrribute of iframe now when i click the button of jsp2 i want the iframe src to change from jsp2 to jsp3 how could this be done can anybody tell me





As it is seen from above code in JSP2 i set the iframe src attribute point to JSP3 but here the iframe is not visible to jsp 2 and jsp3 Can anybody suggest me how do i do this .
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in JSP1 add another javascript functin that redirects to the page JSP3



then in JSP2 when adjust the handler of the button to call the moveToPageThree() of its parent by putting this code



hope it works ...

(peace)
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just change the onClick event in your 2.jsp page


<script>
function onclk()
{
parent.document.getElementById('if').src="http://localhost:8080/BDR/src/jsp/3.jsp";
}
</script>
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

if i have certain form values in JSP2 and while moving back from jsp3 to jsp2 i dont want to reload the page how could i show up the same selected form values while moving back from jsp 3 to jsp 2.
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
store data in session, or pass the data forth and back between JSP2 and JSP3.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the data to be stored was small then i would have stored them in session but here i have to store large data (JSP 2 contains a grid with 10000 to 60000 rows and form field values) i cannot store them in session and pass between jsp which consumes time
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow. Do you display all the 10000 to 60000 rows at once? I as visitor wouldn´t like it. Introduce table paging (100 rows at once or so, which is much, much more user friendly) and a search tool so that the user don´t need to scan all the thousands records for the one he is looking for. If you write efficient paging code, then storing 100 rows in session or re-querying it from the DB won´t harm that much.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah i am doing paging in the grid and i provided slect From row to To row option (so that the user can select from row 100 to row 10000) also the user can select arbitrary rows not necessary consequent, now i have to pass this selected row from jsp 2 to jsp 3 .. now when i move back from jsp 3 to jsp 2 i dont want to loose the selected rows ...
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then only store the row ID's of the selected rows.
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what if you put the last selected row in session.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not make it clear in the previous post....

As i said in JSP2 the user's selected form field values populate grid from database with around 10000 to 60000 rows and user again select few rows(selected rows shows different color) from the grid.... and these selected rows are passed to JSP3 now when i move back from JSP3 to JSP2 i want the same page to be displayed i.e all the rows populated based on form field selection and also the selected rows(with diff color so that the user should not select the already selected again) and to do this is it feasible to store all the 10000 to 60000 rows in session.. also if i re query the database it will take long time again as it took for the first time when the selection was made.
Can anybody suggest me on this.

 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you will be facing a lot of problems in this mode, its not a good idea to send back 1000000 rows and then make the pagination on the client side, just suppose that the user will refresh the page then you will have to query the server again to obtain that 100000 rows. and i am pretty sure that the majority of the users will click on the "2" link to get the second page of your results so rarely maybe (1%) of the users will do this.

so the idea will be to make the pagination on the server side, and you send back to the user only the results of the first page and the total count so that you can make the pagination, however when the user wants to check the next page then another query will be done on the server. by this you will remove a huge overhead on the server. and at this point you will be able to put only the parameters of your form in the http session and the selected rows so that when the user comes back from page jsp3 to page jsp2 you will be able to regenerate the old query to obtain the same results and show the selected rows ;)

i really really advice you not to use the pagination in this mode its very inefficient and will cause you a lot of problems, if not now later when your application gets used by many users.

if the rows you get out from the DB are always the same and its rarely that they change you can make a caching mechanism to cache these data

(peace)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!