• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Bean qns

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem which contains 3 fields : m1, m2 and result respectively. m1 and m2 are input fields. m3 is also an input field ,but the attribute is read only. Users have to input number into m1 and m2. In the OnChange status, it'll call a function to validate and calculate like m1 * m2 = result in javascript. e.g. input ... onChange=cal(this)..
As I don't want the logic exposure to users, how can I call a bean to do it?
Thanks
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can only use the bean on the server after your form is submitted.
I doubt that onChange will exactly do what you intend. It doesn' t react untill one clicks somewhere else in the page. This only irritates users.
I'd rather make it clear that the submit button has to be clicked to proceed. "1. Step: fill out m1 and m2, then hit 'calculate'. 2. Step... "
cb
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Chris pointed out, you cannot mix client-side and server-side operations.
Remember that any Java in your JSP pages is executed on the server to format the HTML page to send to the browser. Once the browser has the page, all Java (including beans) is long gone and you must perform operations using client-side technology, or submit a new request to cause server-side processing to create a new page.
bear
 
reply
    Bookmark Topic Watch Topic
  • New Topic