Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>How about to use a java bean background? Create a java bean called NameConverter...</p> <pre><code>package converters; import java.util.ArrayList; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import lotus.domino.Name; import lotus.domino.NotesException; import com.ibm.xsp.model.domino.DominoUtils; public class NameConverter implements Converter { private Name createName(String name) { Name n = null; try { n = DominoUtils.getCurrentSession().createName(name); } catch (NotesException e) { e.printStackTrace(); } return n; } public Object getAsObject(FacesContext context, UIComponent component, String value) { String[] names = value.split(","); Name name = null; ArrayList&lt;String&gt; tmpNames = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt;= names.length - 1; i++) { name = this.createName(names[i].trim()); try { tmpNames.add(name.getAbbreviated()); } catch (NotesException e) { e.printStackTrace(); } } return tmpNames.toString().replace("[", "").replace("]", ""); } public String getAsString(FacesContext context, UIComponent component, Object value) { String[] names = value.toString().split(","); Name name = null; ArrayList&lt;String&gt; tmpNames = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt;= names.length - 1; i++) { name = this.createName(names[i].trim()); try { tmpNames.add(name.getAbbreviated()); } catch (NotesException e) { e.printStackTrace(); } } return tmpNames.toString().replace("[", "").replace("]", ""); } } </code></pre> <p>Register your converter in faces-config.xml...</p> <pre><code>&lt;converter&gt; &lt;converter-id&gt;nameConverter&lt;/converter-id&gt; &lt;converter-class&gt;converters.NameConverter&lt;/converter-class&gt; &lt;/converter&gt; </code></pre> <p>And then create a field with a simple converter in your xPage...</p> <pre><code>&lt;xp:inputText id="userName" style="width:300px"&gt; &lt;xp:this.converter&gt; &lt;xp:converter converterId="nameConverter" /&gt; &lt;/xp:this.converter&gt; &lt;/xp:inputText&gt; </code></pre> <p>Simple as hell and perfectly scalable. Enjoy, JiKra</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload