You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2007/04/14 20:54:50 UTC

tks for help, but more question for html:javascript

Frank/Musachy,
   
  tks for your help, after i change OnSubmit to lower case, it works. But when i try to test html:javascript, give me more erros, is html:javascript only used for validor only, and can not used as regular javascript for include?
   
  tks in advance
   
  john
   
  The error message:
   
  Error: missing } in XML expression
Source File: /source.js
Line: 4, Column: 20
Source Code:
    alert("pls try");
   
   
  source.js
   
  <head>
  <script language="javascript">
  function showme() {
  alert("pls try");
  return false;
  }
  </script>
  </head>
   
  Search.jsp
   
  <head>
  <html:javascript src="source.js" />
  </head>
  <%@ taglib uri="/html" prefix="html" %>
  <%@ taglib uri="/bean" prefix="bean" %>
  <html:form action="/partsearchinput" onsubmit="return showme()">
  <table>
  <tr><td><bean:message key="label.search.part"/>:</td>
  <td><html:text property="part"/></td></tr>
  <tr><td><html:submit/></td></tr>
  </table>
  </html:form>

       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: tks for help, but more question for html:javascript

Posted by john lee <sh...@yahoo.com>.
tks frank, it works.
   
  john

"Frank W. Zammetti" <fz...@omnytex.com> wrote:
  Hmm, I've never actually used the html:javascript tag, so I'm not sure 
what its intended purpose is, or how it works... seems like the docs is 
talking about validation, so yeah, maybe it's not applicable... 
although, one thing I notice here... let's assume it DOES work just like 
a plain old   tag does... om that case, the contents of your .js 
file might cause a problem because it's not Javascript really, it's 
HTML... If you make source.js just the following:

   function showme() {
   alert("pls try");
   return false;
   }

...then it MAY work... if it still doesn't, I'd not use the 
html:javascript tag at all, just use a plain  tag... looks to me 
like your just trying to import the .js file, and I can't think of a 
good reason to use a Struts tag for something as basic as that anyway.

Frank

P.S. - I'd bet it's not a problem, but it's unusual to see the taglib 
declarations within the markup of the page... they are usually prior to 
the opening  tag... again, may not be a problem the way you have 
it, but I'd move them up, just to be safe.


john lee wrote:
> Frank/Musachy,
>    
>   tks for your help, after i change OnSubmit to lower case, it works. But when i try to test html:javascript, give me more erros, is html:javascript only used for validor only, and can not used as regular javascript for include?
>    
>   tks in advance
>    
>   john
>    
>   The error message:
>    
>   Error: missing } in XML expression
> Source File: /source.js
> Line: 4, Column: 20
> Source Code:
>     alert("pls try");
>    
>    
>   source.js
>    
>   
>   
>   function showme() {
>   alert("pls try");
>   return false;
>   }
>      
> 
> 
> Search.jsp
> 
> 
> 
> 
> 
> 
> 
>   
>       :
>   
>     
> 
> 
> 
> 
> ---------------------------------
> Ahhh...imagining that irresistible "new car" smell?
> Check outnew cars at Yahoo! Autos.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
(2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: tks for help, but more question for html:javascript

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hmm, I've never actually used the html:javascript tag, so I'm not sure 
what its intended purpose is, or how it works... seems like the docs is 
talking about validation, so yeah, maybe it's not applicable... 
although, one thing I notice here... let's assume it DOES work just like 
a plain old <script> tag does... om that case, the contents of your .js 
file might cause a problem because it's not Javascript really, it's 
HTML... If you make source.js just the following:

   function showme() {
   alert("pls try");
   return false;
   }

...then it MAY work... if it still doesn't, I'd not use the 
html:javascript tag at all, just use a plain <script> tag... looks to me 
like your just trying to import the .js file, and I can't think of a 
good reason to use a Struts tag for something as basic as that anyway.

Frank

P.S. - I'd bet it's not a problem, but it's unusual to see the taglib 
declarations within the markup of the page... they are usually prior to 
the opening <html> tag... again, may not be a problem the way you have 
it, but I'd move them up, just to be safe.


john lee wrote:
> Frank/Musachy,
>    
>   tks for your help, after i change OnSubmit to lower case, it works. But when i try to test html:javascript, give me more erros, is html:javascript only used for validor only, and can not used as regular javascript for include?
>    
>   tks in advance
>    
>   john
>    
>   The error message:
>    
>   Error: missing } in XML expression
> Source File: /source.js
> Line: 4, Column: 20
> Source Code:
>     alert("pls try");
>    
>    
>   source.js
>    
>   <head>
>   <script language="javascript">
>   function showme() {
>   alert("pls try");
>   return false;
>   }
>   </script>
>   </head>
>    
>   Search.jsp
>    
>   <head>
>   <html:javascript src="source.js" />
>   </head>
>   <%@ taglib uri="/html" prefix="html" %>
>   <%@ taglib uri="/bean" prefix="bean" %>
>   <html:form action="/partsearchinput" onsubmit="return showme()">
>   <table>
>   <tr><td><bean:message key="label.search.part"/>:</td>
>   <td><html:text property="part"/></td></tr>
>   <tr><td><html:submit/></td></tr>
>   </table>
>   </html:form>
> 
>        
> ---------------------------------
> Ahhh...imagining that irresistible "new car" smell?
>  Check outnew cars at Yahoo! Autos.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
  (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
  Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org