Can you send me any example to customize the page with angular js
You need to provide more information about what you are trying to do.
Are you trying to use LiveSite components to generate the view/model?
Or do you just want to know how to use AngularJS? http://lmgtfy.com/?q=how+to+use+angularjs
I want to use LiveSite components to generate the view/model.
In that case you should look up the use of "AjaxOutput" in both these forums and the TeamSite/LiveSite manuals.
AjaxOutput is similar a component External except it doesn't require you to return an XML document - you can return anything you like, in your case an angular Javascript model. Just be aware that you'll be having to implement it all in Java. If you want to be able to update the data on the server, you'll need to handle that as well.
You can get the URL to use to call the AjaxOutput method by outputting the token "$AJAX_URL[]" in the component XSL.
Can you send me any example to use AjaxOutput in place of external call.
At the very least you need to have the AjaxOutput element in you component XML:
<Data> <AjaxOutput Object="com.example.your.namespace.YourComponent" Method="executeAjaxComponent"/></Data>
And you also need to have an appropriate Java method to output something directly to the HTTP response as JSON:
package com.example.your.namespace;public class YourComponent{ public void executeAjaxComponent(RequestContext context) { context.getResponse().setContentType("application/json"); PrintWriter writer = null; try { writer = context.getResponse().getWriter(); writer.print("Whatever data you want to output here in JSON format."); } catch (IOException e) { System.out.println("ERROR: Cannot get HTTP response writer: " + e.getMessage()); } finally { if (writer != null) { writer.flush(); writer.close(); } } }}
That's pretty much all I'm going to help you with. The rest you need to Google or look in the TeamSite manuals.
Thanks for your reply but here i have one issue that how to pass the value inside context. we can use datum here.
Yes you can. You've got a couple of options on how to do it, but I usually have the Datum as an External parameter, for example:
<Data> <External> <Parameters> <Datum ID="parameter1" Type="String" Name="parameter1">value1</Datum> <Datum ID="parameter2" Type="String" Name="parameter1">value2</Datum> </Parameters> </External> <AjaxOutput Object="com.example.your.namespace.YourComponent" Method="executeAjaxComponent"/></Data>
You can then access the values of the Datum via their "Name" attribute. Be aware that doing them as an external means you can adjust them via the query string. You can access them in your Java code using:
String param1 = context.getParameterString("parameter1");String param2 = context.getParameterString("parameter2");
What I often do to have the same component support the traditional output and an "AJAX" form (NOTE: That although you need to call the Ajax method, you can output anything you want: ICalander feeds, documents etc.) is to do something along the lines of:
<Data> <External> <Parameters> <Datum ID="parameter1" Type="String" Name="parameter1">value1</Datum> <Datum ID="parameter2" Type="String" Name="parameter1">value2</Datum> </Parameters> <Object Scope="local">com.example.your.namespace.YourComponent</Object> <Method>executeComponent</Method> </External> <AjaxOutput Object="com.example.your.namespace.YourComponent" Method="executeAjaxComponent"/></Data>
package com.example.your.namespace;public class YourComponent{ public Document executeComponent(RequestContext context) { Object whatever = executeCommonCode(context); // Then create and return the XML document from the "whatever" } public void executeAjaxComponent(RequestContext context) { Object whatever = executeCommonCode(context); // Then manually write your response from "whatever" // For example, using the example I posted previously. } private Object executeCommonCode(RequestContext context) { // Here you can just write what you want once. String param1 = context.getParameterString("parameter1"); String param2 = context.getParameterString("parameter2"); // do whatever and return whatever }}
There are other solutions to building a LSDS page to return non-XML/HTML results. We do it all the time to product JSON output using standard XSL. It requires creating a custom page layout and components to produce the output you want.
In
<iw-home>\local\config\lib\content_center\livesite_customer_src\etc\conf\livesite_customer\pagetype-config.xml
We have a layout of:
<layout id="stripped-xml-page"> <name>Stripped XML Page</name> <stylesheet>com/****/xsl/runtime/stripped-xml-page.page.layout.xsl</stylesheet> <class>com.interwoven.livesite.layout.impl.NoLayout</class></layout>
<layout id="stripped-json-page"> <name>JSON Page</name> <stylesheet>com/****/xsl/runtime/stripped-json-page.page.layout.xsl</stylesheet> <class>com.interwoven.livesite.layout.impl.NoLayout</class></layout>
The stripped-xml-page xsl was created by taking any of the freeform layouts and stripped out 99% of what's in it to just leave "loop though the components and echo what they contain." We did wrap the output in one <****> tag so multiple components could be put on one page to create valid XML output.
The other one we created was stripped-json-page xsl to generate non-XML pages (JSON mostly). That one was similar to the XML one but didn't include the outer <****> tag. We were surprised at the usefulness of this page. It worked well with an angular site built outside of our area (they wanted to consume our content.)
Just another option.
As an added note - the parameters on the URL, when added as <Data><External><Parameters>... also end up in the <Properties> XML when doing the XSLT on the components. The key used for component caching includes parameters in the URL when included this way.
I guess what I'm point out is that you don't need to pull out the heavy hammer of Java to do some very simple things that can be done in XSL.
Good Luck.