Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home Topics xPages
Navigation
 

xPages

Jul 02, 2010

Generating pdf with iText and Xpages

by Andrea Baglioni — last modified Jul 02, 2010 10:15 AM
Filed Under:

Brief tutorial to simply create PDF's inside XPages

Many thanks to John Mackey:

http://www.jmackey.net/groupwareinc/johnblog/johnblog.nsf/d6plinks/GROC-7G9GT4

and to Daniele Vistalli http://factor-y.com for this idea, for their help and the great powers.

Since Domino 8.5 is Eclipse based, you can switch to the Java perspective and add Java code to your project. The nsf database is the project.  (If you haven't done this yet, it is interesting to switch perspectives and look around at the structure and the code.)  By switching to the Java perspective, you open up your code to the importing or referencing of Java libraries, or the creation of your own classes.

Now we investigate how to create PDF using XPages. This tutorial summarize John's article, with some other things that you have to pay attention to.

Step by step.....

  • Create your own .nsf
  • Switch to the Java perspective by selecting: Window->Open Perspective->Other.
  • Expand your project on the Left hand Project navigator.  Select the WebContent/WEB-INF Folder
  • right click and select New->Folder.  Name the folder source, click Finish. 
  • right click on the source folder and select New->Package.  Name the Package mypackage click Finish. 
  • right click on the mypackage package and select New->File. Enter Test.java for the name.  Click Finish
  • Now double click on the Test.java and paste in the following code: 
package mypackage;
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
/**
* First iText example: Hello World.
*/
public class Test {
      public static void createPdf(String filename) throws Exception {	
       try {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(filename));
            document.open();
            document.add(new Paragraph("Hello World!"));
            document.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
     }
}

 

  • select the project and then select Project->Properties from the menu (or right click)
  • select the Java Build Path and click on Add Folder button.  Select the new source folder.  Click OK.
  • In WebContent\WEB-INF add the folder called lib
  • Right-click on it and select Import->File System->Browse and select itext jar (i.e iText-5.0.2.jar)
  • import itext jar (i.e iText-5.0.2.jar) in your Java Build Path:  Project->Properties->Java Build Path->Libraries->Add Jar and select jar from WebContent\WEB-INF
  • Note: you have to deploy jar in your server, in data\domino\java and append this line in notes.ini, JavaUserClasses variable

JavaUserClasses=......;C:\Programmi\IBM\Lotus\Domino\data\domino\java\iText-5.0.2.jar

 

this will not cause security problem when you call iText methods to generate PDF

  • Create a Script Library Server Side called SLCode and save this code on it
function create(){ 
        mypackage.Test.createPdf("hello.pdf");
}

 

  • Now create an xpage
  • in Resources section, include SLCode library
  • Drag a Button control in Xpage
  • Goto Event section of this button, onClick event, and put this JSS code
create();

 

  • Open your XPage in a browser and click the button: pdf will be created in domino directory on server

That's all!

Jan 18, 2010

AD106 - XPages just keep getting better

by Andrea Baglioni — last modified Jan 18, 2010 10:55 PM

Last year at Lotusphere, XPages burst onto the Lotus Domino application development landscape. Since then, the developer community has embraced XPages and delivered compelling Lotus Domino Web solutions. 8.5.1 delivered on the vision by providing the ability to build an application once for the Web, the Notes client or expose as an iWidget.Come hear about other 8.5.1 enhancements, what is coming in 8.5.2 and glimpse towards the future.**

Lotusphere 2010 banner

Annunciate le novità per le XPages (nella 8.5.2)

- REST e nuovi advanced controls
- modalità off-line e repliche locali
- wiring con le composite applications
- Performance improvements
- iWidget mashup
- hidden field text control
- RichText editor migliorato
- riuso delle funzionalità esistenti: LS libraries, forms, vies
- utility per convertire vecchi form, viste in xpages
- nuovi DataSource (jdbc, db relazionali)

AD109 - XPages perfomance and scalability

by Andrea Baglioni — last modified Jan 18, 2010 10:00 PM

Understanding the XPages architecture is key to building performant scalable enterprise-ready Lotus Domino web applications. We'll show how to go under the hood to discover functional features that help your application perform and scale well. You'll learn about design patterns and techniques that ensure your applications are optimally tuned for your business requirements, and we'll show how to integrate existing business logic -- without increasing performance cost.**

Lotusphere 2010 banner

Tips&Tricks veramente utili per incrementare le performace

- i tool di monitoring consigliati: Firebug, YSlow, PageSpeed
- IBM Xpages Profiling tool: database per il tuning delle XPages in termini di CPU, cache ecc...
- consigli per il rendering delle pagine e per migliorare il JSF cycle lifecycle

- dataCache per le viste (nuovo nella 8.5.1)

- come usare Java nelle XPages per mantenere performance ridotte

Lotusphere Day 1 - JMP105 - XML and Web Services Jumpstar

by Andrea Baglioni — last modified Jan 18, 2010 02:50 AM

Most companies today know that the easiest way to integrate with other entities (both internally and externally) is to provide their solution as a Service that can be called from any system regardless of the operating system or software. Web Service providers and consumers provide this much needed resource. This jumpstart will provide developers with an solid foundation in XML (the language of web services) as well as proven techniques for implementing Web Service providers and consumers in Lotus Notes and Domino 6,7,8 and 8.5. You'll will be provided with resources and examples of Web Service consumers and providers in both LotusScript and Java. You'll see how to integrate Web Services with Lotus Domino form designs and XPages.***t

Lotusphere 2010 banner

Ottimo talk di Paul Calhoun su WebService.

Retrospettiva su provider e consumer, nulla che già non si sappia, ma la chicca è che ha promesso di rendere disponibile per il download un db che offre tra le altre cose (utility per la gestione XML, agenti ecc.) un xslt che permette, attraverso il transformer di DXL, di convertire form Notes in XPages. Ancora in stato semi-embrionale (per esempio, non gestisce correttamente combobox e radiobutton), ma di sicuro effetto ed utilità

Tra le altre cose, tips&tricks, esempi di testing provider in Eclipse Galileo e integrazione tra Xpages e Webservice.

Sep 10, 2009

XPages - L'evoluzione della specie

by Andrea Baglioni — last modified Sep 10, 2009 12:55 PM
Filed Under:

Con la versione 8.5 del server Domino, IBM ha introdotto la tecnologia XPages, che promette di migliorare e facilitare la creazione di applicazioni Web 2.0

Le XPages sono un nuovo elemento di un'applicazione Domino 8.5 che consente di creare un'interfaccia Web 2.0 basata sulla tecnologia JSF.

Con le XPages si rimuovono le barriere per la programmazione Web in Domino; esse permettono di accedere ad una moltitudine di dati e
di realizzare facilmente la localizzazione delle applicazioni.

Uno strumento di sviluppo che "puo'" sostituire il "metodo classico" aumentando le possibilità e riducendo drasticamente i tempi di sviluppo e manutenzione.

Perchè sono importanti?

  • Separazione della presentazione dei dati dalla logica applicativa (si possono collegare piu' database in una sola UI)
  • Usano tutto cio' che già si conosce (stesse classi e funzioni @)
  • Semplificano drasticamente la realizzazione di applicazioni Web "moderne" (in stile Web 2.0)
  • Performance maggiori
  • Portano finalmente in Domino alcuni costrutti del mondo J2EE (eg. variabili di sessione, JSE ecc.)


Il 16-17 Luglio 2009 RedTurtle ha partecipato a Milano al workshop tecnico sulle Xpages presso la sede IBM di Segrate.

Date un'occhiata a come funzionano le Xpages:

Video su YouTube