• 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

Use of Javascript with struts custom tag <html:button> and <html:submit>

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Can somebody help me please?

How we can use Javascript functions to do some operation at client side with the struts taglibs, i.e. <html:submit>, <html:reset>, <html:button> and so on.....???
Please reply me soon....

Thanks.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can write validation rules.Read about validation rules provided by struts
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about last Post..
You can use onsubmit method & write your javascript function there
 
Kishore Sahu
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried, but it is giving some error in java and JSP.
Can you try a simple alert inside a javascript function, and call it by some event like onClick or onSubmit through a <html:button> or a <html:submit> taglib ???
And please give me that example, whatever you will try, OK.
 
Kishore Sahu
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks SuryaKant, for your suggestions.
But please give me a tried example.
Please help me.
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refer this link
http://struts.apache.org/1.2.x/userGuide/struts-html.html#form

I Cant post any code now as my organization doesn't allow me to do that.I will upload the code after some time
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kishore Sahu wrote:But please give me a tried example.



you mean , you ask surya to do your work ? search in google , get some sample and make your needs ,if any suggestion you can get help from here(javaranch) . in this way only you can learn i believe
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and kishore Welcome to javaranch
 
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
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The original poster wrote:I tried, but it is giving some error in java and JSP.


"Some error"? How can anybody help if you don't provide more information than "some error"?!

The JavaScript-oriented onxxx handler attributes all work as they're supposed to, as far as I know.
 
Kishore Sahu
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Seetharaman.

And I am not asking Surya to do my work..
I am really harassed. because I am new to struts and JSP too.
I don't know much about it. So I asked an example.
Please help me.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kishore Sahu wrote:Thanks Seetharaman.

And I am not asking Surya to do my work..
I am really harassed. because I am new to struts and JSP too.
I don't know much about it. So I asked an example.
Please help me.


Have you looked what David said? http://faq.javaranch.com/java/ItDoesntWorkIsUseless

The onClick, onblur, all this JS events will work as they work with non Struts tags, And if you see the JSP code with struts tags, you ll find they are translated into simple html code,
So If you wrote

get resulted into
 
Kishore Sahu
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yaah Sagar, that's right
but I tried with <html:button> with its onClick attribute, but no output.
I just tried to get an alert through a javascript function, which I called by the event onClick of <html:button> taglib.
So, I am really waiting for you guys, to reply something sensible to me.

Thanks.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't provide the JSP used to create the HTML *or* the JavaScript.

Here's an analogy: my car doesn't work--what's wrong with it?

Here's a start: is the HTML being emitted correctly?
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kishore Sahu wrote:
So, I am really waiting for you guys, to reply something sensible to me.


provided you post something, which make some sense to us..
Please answer,
Which code has problem, What you're expecting and What you got ?
 
Kishore Sahu
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok Buddies.,, I got success.
I did it. I don't know what was the problem, but I am done by myself.
Anyway, Thanks.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kishore Sahu wrote:Ok Buddies.,, I got success.



But you can tell us the what new you added, which helps us to learn ?
 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic