This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 25, 2011, 4:13 PM
63 Posts

Xpages Framesets: Xpages within HTML tags

  • Category: Managed Beans in NSF
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: Xpages Frameset,Faces Redirect
  • Replies: 4

Knowledge Sharing:

 

Domino Designer Environment provides a ton of resources developers need to build successful web apps from scratch.  I am still learning, therefore I like to poke around or think up new ways to make it all work, per my requirements.

 

Looks like one can use framesets in DDE, but I have not found a good way to use with Xpages.  I was fortunate to attend a training session (Xpages BootCamp) held in March by Paul Calhoun and Russel Maher.  My understanding is developers should stand clear of the built-in DDE framesets.   @ the bootcamp we were also alerted of a wonderful tool to use; the OneUI is already built into DDE...  What a stupendous idea I thought, now I can section out my pages and information, while giving the user a friendly experience, lesser clicks to get to the data.

 

The OneUI has helped solved a lot of my problems.  However, I needed more, after all, what developer would not want to write more code and get sound or specific results. 

 

Below is probably already doable in DDE, again, my lack of Xpages experience may be the issue,  could not quite get what I needed.  I just wanted to be able to build own Framesets into Xpages from HTML tags

 

[First issue]:

 

·         <FRAMESET></FRAMESET> are not recognized in Xpages, or perhaps I just could not figure out how to include them.  Not just with errors, even after closing the tags properly, (Xpages must be well-formed) I got a blank page in return.

·         Adding rendererType="javax.faces.Text" in the header protion of the page did not help.  I knew I could build frames in JSF, but no go with Xpages

 

 

[Second issue]:

 

·         Why not pull the files (link.html, index.html, etc...) in through Resources/Files load the files that way, no go.  Page loads empty here again, could not figure out how to load HTML pages within DDE's elements window

 

 

 

[Finding]:

 

Then it hit me like a ton of bricks.  Why not use the WebContent folder to load my HTMs, pull my Xpages into frames that way...  Rumbling sounds, crash, bricks falling all over... after the smoke cleared  IT WORKED!!!  Can’t believe it was that simple.

 

As said, it’s probable that we’re looking at old news here, and there are options to frames within Xpages, as in the HTML format, but I did not find any.  So do submit an URL to fetch it and try if something’s out there.  For now, here are the steps:

 

Step 1

 

Assuming you do have DDE open and have a current Xpages project, we're going to skip building a new application

·         Go to Open Perspective in DDE (Window + Open Perspective)

·         Find Java from the List (or click Other to browse for it)

·         Look for Project Explorer

·         Select and Open

 

Note: Alternatively, you can dock Project Explorer by choosing Show Eclipse Views from Window menu in DDE and selecting Project Explorer from there

 

Step 2

Assuming you do have Java code written for Xpages, we're going to skip building resource folder to hold your packages/classes

 

·         Go to WebContent, further below your folders in Project Explorer, right above Xpages folder

·         Right-click on WebContent, add your HTML pages

 

Note: Alternatively, you can write your HTMs in NotePad, copy and paste the files right into WebContent folder

 

Step 3

 

·         Plug in necessary links, I used some OneUi components in mine, just to grab the links already built

·         Run the App

·         Click link of choice

·         Page should load in content.html frame

 

 

[Resources]:

 

HTML framesets:

http://www.tizag.com/htmlT/frames.php

 

 

Xpages Cheat Sheet:

http://notesin9.com/wp-content/uploads/2011/01/XPagesCheatSheet-11x17-v1.pdf

 

JSF Redirect:

http://stackoverflow.com/questions/973732/redirect-from-jsf

 

Managed Bean:

Own Bean, built using converted JavaAgent + hints from Karsten’s series and Xpages Blog (Notes in 9 videos)

http://www-12.lotus.com/ldd/doc/domino_notes/rnext/help6_designer.nsf/f4b82fbb75e942a6852566ac0037f284/143ae0d1dbbee6b685256c54004dd58a?OpenDocument

 

http://www.mindoo.com/web/blog.nsf/dx/18.03.2011104725KLEDH8.htm?opendocument&comments

 

http://xpagesblog.com/xpages-blog/category/tutorial

 

OneUI:

http://www.youatnotes.de/web/youatnotes/wiki-xpages.nsf/dx/Work_with_oneUI_theme

 

 

[Code]:

 

HTML pages, Xpages, Faces file, and Managed Bean

 

 

Index.html

 
[CODE] 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Index</title>

</head>

 

<frameset border="2" frameborder="1" framespacing="2" rows="20%,*">

<frame src="header.html" noresize scrolling="no">

<frameset border="4" frameborder="1" framespacing="4" cols="30%,*">

<frame src="link.html" scrolling="auto" noresize>

<frame src="content.html" name="colours" scrolling="yes" noresize>

 

</frameset>

</html>

[/CODE] 
 

 

Content.html

 

[CODE] 
 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Content</title>

</head>

<body>

 

Content Here

 

</body>

</html>

 

[/CODE] 
 

 

Link.html

 
[CODE] 
 

 Similar to the other HTMs but with OneUI theme code added.  You are looking at the main divs that makes this work...

<div id="lotusMain">

      <div id="lotusColLeft">

            <span class="scrollAreaMargin">

                  <ul class="tabs" id="formtabs">

                  <li>

                        <b>MAIN DASHBOARD</b>

 

                  </li>

                  <li>

            <a href="xpnotices.xsp" target ="colours">Notices to Group</a>

                  </li>

                  <li><a href="#tab3" id="tab3"

                                                onclick="settab(this, document.getElementById('formtabs'), document.getElementById('container_formcontent'));">Keywords</a>

                  </li>

 

[/CODE] 
 

 

Header.html

 
[CODE] 
 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Logo</title>

</head>

<body>

 

My LOGO

 

</body>

</html>

 

 

[/CODE] 
 

Faces-Config.xml

 
[CODE] 
 

 

      <managed-bean>

               

            <managed-bean-name>SendAppIssuesBean

            </managed-bean-name>

               

            <managed-bean-class>

                  com.dev.dashboards.JavaBeans.SendAppIssuesBean

            </managed-bean-class>

               

            <managed-bean-scope>request</managed-bean-scope>

      </managed-bean>

      <managed-bean>

 

[/CODE] 

 

For the Xpages, built two from scratch, name the first one xpnotices.xsp, the other can be whatever you want, I'd name it xpoksubmitting.xsp.  Build using drag and drop feature of DDE

 

Then change from document1.Subject in the XSP code to SendAppIssuesBean.subject

 

SendAppIssuesBean.java

 
[CODE] 
 

 

/**

 * Created: 2010.12.10.9.17.AM

 * New Posting for Xpage form via JavaBean

 *

 * Copied: 2011.05.03.12.18.PM

 * Adding to Project Dashboards for Xpages

 *

 * Modified: 2011.05.18.9.00.AM

 * Removed print statements

 *

 * Modified: 2011.05.25.9.03.AM

 * Added redirect code

 */

package com.dev.dashboards.JavaBeans;

 

import java.io.IOException;

import java.text.SimpleDateFormat;

import java.util.Calendar;

 

import javax.faces.context.ExternalContext;

import javax.faces.context.FacesContext;

import lotus.domino.NotesException;

import lotus.domino.local.Database;

import lotus.domino.local.Document;

 

/**

 * @author kcherizard

 * @version 2010.12.10.9.17.AM

 */

public class SendAppIssuesBean {

     

//declare variables, and add static values as test

     

      //declare variables

      private String Subject;

      //@version: 2011.01.06.1.30.PM

      private String Categories;

      private String Body;

      //added To and from User to allow emails to go to the right party

      //2011.05.19.10.41.AM

      private String ToUser;//="memail@mememe.org";

      private String FromUser;//="memail@mememe.org ";

      //Switched over to date datatype

      //@version: 2010.12.17.8.12.AM

      private String Date_Format = "MM/dd/yyyy";

    SimpleDateFormat simpledateformat = new SimpleDateFormat(Date_Format);

    Calendar calendar = Calendar.getInstance();

  

    private String ExpireDate = simpledateformat.format(calendar.getTime());

 

      /**

       * @return the subject

       */

      public String getSubject() {

            return Subject;

      }

      /**

       * @param subject the subject to set

       */

      public void setSubject(String subject) {

            Subject = subject;

      }

      /**

       * @return the Amenities

       */

      public String getCategories() {

            return Categories;

      }

      /**

       * @param Amenities the Amenities to set

       */

      public void setCategories(String categories) {

            Categories = categories;

      }

      /**

       * @return the body

       */

      public String getBody() {

            return Body;

      }

      /**

       * @param body the body to set

       */

      public void setBody(String body) {

            Body = body;

      }

     

      //TO DO: Add Email capability to this item, remove comments below

     

/*    *//**

       * @return the expireDate

       *//*

      public String getExpireDate() {

            return ExpireDate;

      }

      *//**

       * @param expireDate the expireDate to set

       *//*

      public void setExpireDate(String expireDate) {

            ExpireDate = expireDate;

      }

     

      *//**

       * @return the toUser

       *//*

      public String getToUser() {

            return ToUser;

      }

      *//**

       * @param toUser the toUser to set

       *//*

      public void setToUser(String toUser) {

            ToUser = toUser;

      }

      *//**

       * @return the fromUser

       *//*

      public String getFromUser() {

            return FromUser;

      }

      *//**

       * @param fromUser the fromUser to set

       *//*

      public void setFromUser(String fromUser) {

            FromUser = fromUser;

      }*/

 

      //the actual button fired through the Xpages form

      //javascript:SendAppIssuesBean.submitEntry()

      public void submitEntry() {

           

            try {

                 

                  //get the current database using faces implementation

                  //Alternatively, this could be done using Session with AgentContext as a JavaAgent

                  //grab the database that way, we need faces, so faces is what we’ll use.

                  Database database= (Database) FacesContext.getCurrentInstance()

??                 .getApplication().getVariableResolver()

                  .resolveVariable(FacesContext.getCurrentInstance(), "database");

                  //Load data to console for debugging purposes...

                  //System.out.println("Database info obtained..." + database);

                 

                  //instantiate the document create call

                  Document submitDocument = (Document) database.createDocument();

                  //Load data to console for debugging purposes...

                  //System.out.println("Document creation begins, info obtained..." + submitDocument);

                 

                  //submit using FormYouBuiltYourSubmissionXpageFrom form (Alternatively, one can add the alias of the form)

                  submitDocument.appendItemValue("form", "FormYouBuiltYourSubmissionXpageFrom");

                  //using appendItemValue to insert in the fields needed

                  //notice we are referencing the field on the xpage, and the JavaBean variables

                 

                  //IMPORTANT

                  //As of 2011.05.06.10.25.AM, we are now sending to FormYouBuiltYourSubmissionXpageFrom form and not Main Topic

                  //We are going to use Java and Xpages to do the basic submissions and emailing of users

                 

                  //TO DO: set up a list of user emails and groups to send data to...

                  submitDocument.appendItemValue("subject", Subject);

                  submitDocument.appendItemValue("subCat", Categories);

                  submitDocument.appendItemValue("body", Body);

                 

                  //ensure a document is available to create

                  //2011.05.25.9.38.AM

                  while (submitDocument !=null){

                  //this is needed to allow faces to tell us the redirect did not work

                  //NOTE: Xpages Cheat Sheet has facesContext.getExternalContext().redirect("http://abc.com")

                  //You need the getCurrentInstance in there to make it work

                  //Courtesy: http://stackoverflow.com/questions/973732/redirect-from-jsf

                  //2011.05.25.9.43.AM

                  try {

                        //redirect to submission successful

                        //TO DO: add statement to redicrec to failure page

                        FacesContext.getCurrentInstance().getExternalContext().redirect("xpoksubmitting.xsp");

                        //context.redirectToPage("xpindex.xsp");

                 

                  //saves the data, based on above fields to OSCBB form

                  submitDocument.save();

                 

                  //cleans up the system

                  submitDocument.recycle();

                  //throwable initialized if there is an error, either in the field or the query, or the redirect

                  //this is needed to allow faces to tell us the redirect did not work

                  //NOTE: Xpages Cheat Sheet has facesContext.getExternalContext().redirect("http://abc.com")

                  //You need the getCurrentInstance in there to make it work

                  //2011.05.25.9.44.AM

                  } catch (IOException e) {

                        // TODO Auto-generated catch block

                        //print this error to the server, in our case RTNDEV1's log, or current db server

                        e.printStackTrace();

                  }

     

        }

                  //throwable initialized if there is an error, either in the field or the query, or the redirect

                  //this is needed to allow Domino to tell us the document creation and submission pulled through okay                 

            }catch (NotesException e) {

                  //print this error to the server, in our case RTNDEV1's log, or current db server

                  e.printStackTrace();

            }

           

           

           

      }

 

}

 

[/CODE] 

 

 

 

The key for the redirect is this:

      FacesContext.getCurrentInstance().getExternalContext().redirect("xpoksubmitting.xsp");

 

Could not quite get it to work with redirectTopage option.  And could no longer use the built in redirect from Xpages.  The above sealed the deal…  And that’s it, please ask me anything, though I suspect you will not need to, so simpleJ

 

 

Köll

May 25, 2011, 4:51 PM
47 Posts
Re: Xpages Framesets: Xpages within HTML tags
 I haven't had any problems using the built in frameset capabilities (aside from an uninitialized variable in the lotus-specific CKEditor extensions which overwrote the frame's name attribute). I am upgrading an existing app in pieces to use xpages and it works fine. We only have one xpage active at a time though, not trying to do any cross-frame communication; perhaps that is where issues arise? 
 
Rich 
May 26, 2011, 12:25 AM
63 Posts
Re: Xpages Framesets: Xpages within HTML tags
Very cool Rich, thanks for your reply...  How do you go about choosing Xpages when it is not included as part of the element list?  That's always been the issue.  Looks like I can do this with the page element, add some links to it, put that in a frame, it does work beautifully with the Page element.  If you do have a recipe on how to do frames with Xpages in DDE, using technology available, I'd love to see it:-)  We're banking on Xpages, so this'll be good!
 
thanks again for your reply, sounds additional options!
 
Köll 
May 26, 2011, 3:45 PM
47 Posts
Re: Xpages Framesets: Xpages within HTML tags
 To tell you the truth, we just haven't had to deal with selecting them as targets. We have a typical left hand navigator which has links to views (traditional views, not yet updated to xpage goodness) and the documents linked in the views just open in the same frame and are configured in the form to open as an xpage. I guess the only place we've had to explicitly point to an xpage is in the 'new document' buttons and those have "computed" URLs, but those buttons were using computed URLs before xpages, so it was just a matter of changing the computed string.
 
Rich 
May 26, 2011, 5:41 PM
63 Posts
Re: Xpages Framesets: Xpages within HTML tags
You know, that sounds lile a great idea, have forms that require navigation load as Xpages, brilliant! if that's what I think you're saying... I am going to try it, put it on the table as options for us.
 
Thanks Rich! 
 
Köll 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal