aspose file tools*
The moose likes Struts and the fly likes html:javascript  is displaying all the javascript on the browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:javascript  is displaying all the javascript on the browser" Watch "html:javascript  is displaying all the javascript on the browser" New topic
Author

html:javascript is displaying all the javascript on the browser

Arthur Ford
Greenhorn

Joined: Sep 06, 2006
Posts: 22
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??
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Arthur Ford
Greenhorn

Joined: Sep 06, 2006
Posts: 22
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?
divya chamarti
Ranch Hand

Joined: Jul 28, 2006
Posts: 56
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:javascript is displaying all the javascript on the browser