• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to refresh popup screen and coding can't unload

 
Sharon Wong
Ranch Hand
Posts: 35
IBM DB2 Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team,

This is pop up screen coding.


This is code from servlet.



coding ajax MrktProdDetailValidation.jsp

first question:

When the servlet found mandatory or validate error, the popup screen is succession prompt out the error, but after reedit , when it running function isMrktPrdtExist(mrktcd,prodcd) at popup screen, it prompt message the product is exit( my data base sure no have this product). But if i change the field Product Code to small letter at popup screen, it can insert to database without error.
sometime, if without change the field Product Code to small letter at popup screen, it will running servlet two time, then i will get error duplicate data.
Please kindly advice what should i do? is it i need to always refresh my pop up screen? and what code to refresh popup screen?

second question:

When the servlet success insert my data, it will running onload= fnconfirm(). but it can't running this function. After success insert data, it can't go to function fncnfirm(), it will prompt out message ' prBean.setTopErrMsg( hashErr.get( "50505" ).toString() );'
Why? how to solve it?

Thanks and best regards
Sharon
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a lot of poor practices, bad habits, and anti-patterns throughout that code. But let's start at the worst of them. Please explain why the following is in your JSP:
 
Sharon Wong
Ranch Hand
Posts: 35
IBM DB2 Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The JSP can't write try...catch function? it only do when have exception.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, with that code in the JSP (or anywhere in Java code), what will happen when an exception is thrown? Do you know enough about exception handling to be able to answer that question?
 
Sharon Wong
Ranch Hand
Posts: 35
IBM DB2 Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suitable for specific, recoverable errors which the application’s workflow can continue in case the exceptions occurred.
I have just research found
Catching exceptions directly in JSP page,This approach is generally not recommended, because it’s not a good practice to put Java code directly into JSP pages which are designed to represent view layer, not containing logic code.It’s inefficient if we want to handle exceptions for many JSP pages as with this approach, it requires to duplicate try-catch blocks in every single JSP page.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's never suitable to just eat an exception, even if processing can continue. At minimum, it should be logged. What if an unexpected exception that you shouldn't continue from occurs? How can you know every possible scenario?

And yes, code in a JSP has been obsolete for over 15 years. That's another anti-pattern.

But what it all boils down to is that you have posted a lot of code, and two questions. That's a bit too overwhelming for most people to deal with. I'd recommend whittling your problem down to an SSCCE so we con focus on a single problem at a time, with a focus on the code in which the issue occurs.
 
Sharon Wong
Ranch Hand
Posts: 35
IBM DB2 Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My issued Solve.

Thanks for reply and adviced.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic