File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Rereshing after modification / Listing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Rereshing after modification / Listing" Watch "Rereshing after modification / Listing" New topic

Rereshing after modification / Listing

Julie Desuza

Joined: Sep 06, 2004
Posts: 3
I am currently working with Java + MYSQL and found following situation.

JSP1 lists the entire records of a table. User can use this screen for listing records or selects a record from the list and modify it. User selects a record from the list and clicks on change button on JSP1 page, which opens a new JSP2 having details the record, which user selected in JSP1. User modifies the record and when hits save button of JSP2, the data should be updated and refreshed list of records should be shown to user.

Problem: I would like to make JSP1 in very generic way so it works fine when user lists only records or refreshes the list after modification.

I have written statements that extract data from JSP2 before listing program. Here JSP1 is executed first and then JSP2 so I get an error of Null pointer exception because JSP1 has not found any data from JSP2 and it�s trying to fetch data from JSP2.

Is there any statement through which, I can check�.

If (request.getParameter(�id�) is NULL)
Then ����simply retrieve data
Else ����.. fetch data from JSP2 + Update record + retrieve data.

Comments��. I know it�s pretty difficult to explain what I mean.

Any help will be appreciated...

Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 439

Using javascript window.opener code on close button of JSP2
like this...

on_Click="javascript:window.opener.window.history.go(0) ;window.close() "

This will reload JSP1 page and close the JSP2

Hope it works for you

Sorry I cannot show you the correct javascript due to restriction on this forum!

Maki Jav

Help gets you when you need it!
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211


Try to find some good articles and books on using MVC and Front Controller pattern, that is what you need to write generic, easily extended and managed web apps.

Here's a link that looks promising front controller pattern


The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
I agree. Here's the link:
subject: Rereshing after modification / Listing
It's not a secret anymore!