• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

html:javascript is displaying all the javascript on the browser  RSS feed

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using struts validator for the first time and It is giving me some nice headaches.

I have given this line in my jsp page -

What this does is I have the complete javascript displayed on the browser!!! Check out this(This is displayed on the browser) -

function validateFloatRange(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); oRange = new floatRange(); for (x in oRange) { var field = form[oRange[x][0]]; if ((field.type == 'text' || field.type == 'textarea') && (field.value.length......etc..


Let me put down the code I have written -
My validator form bean:


My struts-config.xml

........

........

My validation.xml



I have no clue where I seem to going wrong.
I tried setting

Any suggestions??
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fact that your JavaScript is being displayed could mean that you've put it in the wrong place in your JSP. In my experience, the best place to put it is directly before your </html:form> tag.

A coupld of more things to mention:

1-By overriding the validate() method with your own logic, you have overridden the Struts Validator Framework logic. I'd suggest removing this method.

2-you should specify validate="true" in your action mapping in the struts-config.xml file to make sure that validation is performed for that action.
 
Arthur Ford
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have tried putting the tag inside the form. It doesnt work. My html was a hash of <html> and </html> tags. I removed them too. But still no luck. Do you think I shoudl check somethign else? Pretty wierd problem, eh?
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
please try to use validator frame work by removing the validate() method from FormBean class as you are overriding the validate method so finally the validate method() of ValidatorForm class will not be called and second thing that provide html:javascript tag before html:html tag and also in html:form add onclick event
try out these
regards
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!