[Gridsphere-users] JAVASCRIPT_SRC.... have you used this before?
Jason Novotny
novotny at gridsphere.org
Wed Dec 6 10:02:01 PST 2006
Hi,
Make sure you are using GridSphere 2.2.7 or out of SVN.
Cheers, Jason
Wee Siong wrote:
> Hello Jason,
>
> It is very strange, I've done response.addProperty on both the
> JAVASCRIPT_SRC and the CSS_HREF variables,
> and only the CSS_HREF variable gets set.
>
> response.addProperty("CSS_HREF", request.getContextPath() +
> "/css/mystyle.css");
> response.addProperty("JAVASCRIPT_SRC", request.getContextPath() +
> "/js/validatecreatesubject.js");
>
> Viewing the source on the page, only shows the CSS_HREF set.
>
> <head>
> <title>GridSphere Portal</title>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
> <meta name="keywords" content="gridsphere"/>
> <meta http-equiv="Pragma" content="no-cache"/>
> <link type="text/css"
> href="/gridsphere/themes/default/css/default.css" rel="stylesheet"/>
> <link type="text/css" href="/mfarchive/css/mystyle.css"
> rel="stylesheet"/>
> <link rel="icon" href="/gridsphere/images/favicon.ico"
> type="imge/x-icon"/>
> <link rel="shortcut icon" href="/gridsphere/images/favicon.ico"
> type="image/x-icon"/>
> <script language="JavaScript"
> src="/gridsphere/javascript/gridsphere.js"></script>
> </head>
>
> Any suggestions?
>
> Thanks
> WeeSiong
>
>
> On 01/12/2006, at 12:29 PM, Jason Novotny wrote:
>
>>
>> Hi Wee,
>>
>> That sound work fine as long as you have configured a 0 in the
>> expiration-cache of your portlet.xml. You may want to use
>> response.addProperty so that it doesn't overwrite any other
>> javascript files you've added. If you need to debug the issue, the
>> properties are placed in the request as you can see from
>> PortletResponseImpl.java and the JAVASCRIPT_SRC var is looked for in
>> org.gridlab.gridsphere.layout.view.standard.Page.java#doStart where
>> the page is created.
>>
>> Cheers, Jason
>>
>> Wee Siong wrote:
>>> Hello all,
>>>
>>> Just wondering if anyone has any experience with using the
>>> JAVASCRIPT_SRC tag, The following is my code, but the javascript
>>> doesn't seem to be loaded.
>>>
>>> I tried writing the javascript code using writer.write instead, and
>>> it works, but preferably I'll
>>> like to be able to have all the javascript in a separate file.
>>>
>>> In portlet code:
>>>
>>> protected void doView(RenderRequest request, RenderResponse, response)
>>> throws PortletException, IOException
>>> {
>>> response.setContentType("text/html");
>>> response.setProperty("JAVASCRIPT_SRC", request.getContextPath() +
>>> "/js/validatecreatesubject.js");
>>>
>>> Writer writer = response.getWriter();
>>>
>>> writer.write(
>>> "<form onsubmit='return myalert()'>
>>> <input type='submit' value='click me' />
>>> </form>"
>>> );
>>> }
>>>
>>> In Javascript code:
>>>
>>> <script type="text/javascript">
>>>
>>> function myalert()
>>> {
>>> window.alert("Hi this proves that javascript is cool");
>>> return false;
>>> }
>>>
>>> </script>
>>>
>>> Thanks very much for your help!
>>>
>>> Regards,
>>> WeeSiong
>>> ------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> Gridsphere-users mailing list
>>> Gridsphere-users at gridsphere.org
>>> http://lists.gridsphere.org/mailman/listinfo/gridsphere-users
>>>
>>
>>
>> --Jason Novotny Chief Portal Architect
>> BIRN-CC / UCSD
>> 9500 Gilman Dr., La Jolla, CA
>> novotny at gridsphere.org
>> http://www.gridsphere.org
>>
>> _______________________________________________
>> Gridsphere-users mailing list
>> Gridsphere-users at gridsphere.org
>> http://lists.gridsphere.org/mailman/listinfo/gridsphere-users
>
> _______________________________________________
> Gridsphere-users mailing list
> Gridsphere-users at gridsphere.org
> http://lists.gridsphere.org/mailman/listinfo/gridsphere-users
>
--
Jason Novotny
Chief Portal Architect
BIRN-CC / UCSD
9500 Gilman Dr., La Jolla, CA
novotny at gridsphere.org
http://www.gridsphere.org
More information about the Gridsphere-users
mailing list