Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rereshing after modification / Listing

 
Julie Desuza
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...

JULIE.
 
Maki Jav
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Julie,

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

Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic