문제

What I Did:

Step 1: I have made two text element (let say name of elements are userName and UserId) in "Test" authoring Template. Step 2: I have customized the first element( userName) by using jsp.

But while customising first element(userName) I need to fetch the second text element( UserId) value into userName.

I am able to get the value of first Text element(UserName) by using below Code but How I will get the second element value?

<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %>
<%@ page import="com.ibm.workplace.wcm.api.authoring.CustomItemBean" %>

<portletAPI:init />


<% 
CustomItemBean customItem = 
(CustomItemBean) request.getAttribute("CustomItemBean"); 
customItem.setSubmitFunctionName("myoptionsubmit");
String fvalue = (String)customItem.getFieldValue();

%>

<script language='Javascript'>
function myoptionsubmit()
{
document.getElementById('<%=customItem.getFieldName()%>').value = 
document.getElementById('<%=customItem.getFieldName()%>_mycustomoption').value;
}
</script>

<INPUT id='<%=customItem.getFieldName()%>_mycustomoption' value="<%=fvalue%>">
도움이 되었습니까?

해결책

<%@ page import="com.ibm.workplace.wcm.api.*"%>
<%@ page import="com.ibm.workplace.wcm.api.exceptions.*"%>
<%@ page import="java.util.*,javax.servlet.jsp.JspWriter,java.io.*"%>
<%  
Workspace myworkspace=null;
try {
DocumentId docId=null;
DocumentIdIterator itemsIterator=null;
myworkspace = WCM_API.getRepository().getSystemWorkspace();  
DocumentLibrary MyLibrary = myworkspace.getDocumentLibrary("LIB_FOR_DEVICE");
DocumentIdIterator docIdIterator = myworkspace.findByName(DocumentTypes.Content,    "RENDER_TEST_CONTENT");
DocumentId docId1;
Content currentContent; 
LibraryRichTextComponent currentContent1; 
Object object=null;
TextComponent textComponent=null;
RichTextComponent richTextComponent=null;
ImageComponent imageComponent=null;
while(docIdIterator.hasNext()) 
{       
docId1 = (DocumentId)docIdIterator.next();
currentContent = (Content)myworkspace.getById(docId1); 

ContentComponentIterator contentComponentIterator=currentContent.componentIterator();
     while(contentComponentIterator.hasNext())
     {
     object=contentComponentIterator.next();
     if(object instanceof TextComponent)
     {
     textComponent=(TextComponent)object;
      out.println("<br/>TC:</br>"+ textComponent.getText());
     }
      if(object instanceof RichTextComponent)
     {
     richTextComponent=(RichTextComponent)object;
      out.println("<br/>RTC:</br>"+ richTextComponent.getRichText());
     } 
     }


 }

myworkspace.logout();

} catch (Exception e) {} %>

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top