O'Reilly logo

Alfresco 3 Web Content Management by Vinita Choudhary, Pallika Majmudar, Amita Bhandari, Munwar Shariff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calling web scripts from a JSP page

Now we will create a simple JSP page from which we will make a call to our web script to render the news page. This JSP can be a part of any of your web applications.

To call a web script from the JSP, this will be an HTTP call. Just add the following scriptlet in the JSP file wherever you want to include the HTML output of this web script:

<%
String resultString = "";
HttpClient client = new HttpClient();
client.getState().setCredentials(
new AuthScope("localhost", 8080, "Alfresco"),
new UsernamePasswordCredentials("admin", "admin")
);
GetMethod get = new
GetMethod("http://localhost:8080/alfresco/service/org/cignex/news/getNewsItem.html?storeId=wwwcignex&newsId=newsAlfrescoBookRelease.xml"); get.setDoAuthentication(true); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required