[jboss-user] [JBoss Portal] - Re: where should i include my javascript file?

saigon_man do-not-reply at jboss.com
Thu Aug 2 14:45:02 EDT 2007


Thanks for the hint, I followed the instruction but somehow, the browser could  not find the javascript. 
Here what I've done

in my jboss-portlet.xml

<portlet>
  |       <portlet-name>HelloWorldJSPPortlet</portlet-name>
  |       <transaction>
  |          <trans-attribute>Required</trans-attribute>
  |       </transaction>
  |       <header-content>
  |             <script type="text/javascript" src="/js/myscript.js"/>
  |       </header-content>
  |    </portlet>
  | 
  | 

i created a folder called js at the same level as WEB-INF and put myscript.js in there. When I click on the button in that jsp portlet to invoke the function in javascript, the browser complaints that it can not find that file. So, my war structure is: 

mywar.war
    ---- js
          ---- myscript.js
    ---- WEB-INF
          ---- jboss-portlet.xml
          ---- some more xml files

here is the code in my jsp file



  | <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
  | 
  | <portlet:defineObjects/>
  | <div id="msg">I am default</div>
  | <br/>
  | <button onclick="testing();">Change me</button>
  | 

in myscript.js


  | function testing(){
  | 	document.getElementById("msg").innerHTML = "I am changed";
  | }
  | 

Am I missing something here?

Thanks

TL

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070247#4070247

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070247



More information about the jboss-user mailing list