Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

onClick button and JSP

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all of you,
Tell me if it's possible to do this...
I want when a button is pressed to validate the information with JavaScript THEN...AND PERHAPS i need to include a JSP file or HTML file with this operation, it would look like this.
...........................................................
<INPUT TYPE="button" VALUE=" Add a row." ONCLICK="return addRow(this)">
------------------------------------------------*/
function addRow(objForm)
{
// inTheActualForm.open("extraRow.html");
// OR
<jsp:include page="extraRow.html">
</jsp:include>
return false;
}
// End of addRow().
..............................................................
I sure hope i make it clear enough for you, tell me please how i could manage such an inclusion.
Thanks kindly.
MC (*_*)
 
Saloon Keeper
Posts: 24894
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaScript in a web page runs on the client's machine - it can't directly talk to the JSP server. What you want to do is make the onClick() method do a submit and supply the URL of the JSP as the target.
 
mc moisan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Tim,
Perhaps I'm not sure how to do what you suggest me to do.
I'm new with JavaScript and JSP, so could you please be more descriptive on how i should submit and activate the URL.
Thanks again for you time.
MC (*_*)
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is an example. Do something similar.
<FORM NAME = "yourformName" ACTION=" the URL of your JSP METHOD="POST">
In the onClick() event of your button, hace it submit your form.
ex yourformName.submit()

Bosun
 
mc moisan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you kindly Bosun,
You were of great help, have a great day !!!
MC (*_*)
 
mc moisan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem still !!!
I did what Bosun suggested PERHAPS it always open in another window, i wish to get it open in the actual form which contains a table... is that possible ??? if so, please help.
I tried the ...this.open(URL) /and many other possibilities,
but nothing works as i want it to. !!!
Thanks for your time all
MC (*_*)
reply
    Bookmark Topic Watch Topic
  • New Topic