• 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

do i have to submit all the time

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i made a page with a form and button in it.
is it possible? that when i click on the button something will happen
(process stuffs) without submitting the form ?
thnx ...
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not Exactly,

you may do your processing using a javascript function. When you click on
the button, invoke the javascript function.

Vijay
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Leo,

Like Vijay has replied, write a JavaScript function that will return either true or false based on what you want to do (I mean, the processing that you spoke about). Then, have the following syntax for your form's onsubmit() function:



So, the form will be submitted only if the JavaScript function validateForm( ) returns true
 
Leonardo Go
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but can i call a java function i wrote in the jsp using javascript ?
because i was thinking of reacting events using java code instead of javascript.
but i think its not posible right ?
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Leonardo Go:
but can i call a java function i wrote in the jsp using javascript ?



As far as I know, you cannot call a Java method from a JavaScript function.
 
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the JSPs are residing on the server and can only be reached trough HTTP(S) calls so there is no way to invoke your JSPs but to send a HTTP request (by clicking a link or by submitting a form or by some javascript code).


pascal
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suppose this thread could find a home in either the JSP forum or the HTML and JavaScript forum.

(Flipping coin...)

Moving this to the HTML and JavaScript forum...
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Leonardo,

What you want to do is to submit each action (e.g. add, remove, save, close, etc.) to the server side (your JSP) and handle it there with a controller. The controller, another JSP or perhaps a servlet, which is on the server-side, can then get the supplied action from the request object and call the appropriate Java method to handle the action (do the processing).

You might want to Google for the "Model View Controller" design pattern, which is a time-honoured tradition of achieving the above.

Jules
 
Leonardo Go
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
things clearing up now .. thnx a lot
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic