How to get context in javascript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2011 03:26 PM
Hi! I want to get the alfresco share context ([server]:9080/share) in one javascript function of my custom dashlet (not the .get.js)
Any idea?? Thanks
Any idea?? Thanks
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2011 04:09 PM
If you are asking about how to get the context path directly from JavaScript (in the client), I do not think that is possible.
You can however, define the value in a JSP like so;
You can however, define the value in a JSP like so;
<script …>var contextPath = '<%= request.getContextPath() %>';</script>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2011 04:35 PM
No I can't…there is no JSP, just ftl, js…a share dashlet.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2011 12:40 PM
The freemarker templates have the TemplateNode Model to your disposal. You can inject the context path into your template similar to how I suggested using JSP's using the url templateNode object (url.context). Implementation details really :wink:
http://wiki.alfresco.com/wiki/Template_Guide#TemplateNode_Model_API
http://wiki.alfresco.com/wiki/Template_Guide#TemplateNode_Model_API
