0 Replies Latest reply: May 14, 2012 7:36 AM by 933141 RSS

    Problem in SelectOneMenu

    933141
      Hi All,

      I have created a JSF Page. In JSF i will be providing a wsdl url in inputText. After entering the wsdl url it should parse the wsdl and fetch its operations. All the operations has to be populated in a combo box. Created a managed bean class and in that we have a method getOperations().Then trying to populate the operations in dropdown. Problem is during runtime i couldnt see the components after Operations. From dropdown it is not displaying any of the components. Can anyone help me out.

      Here is my JSF code:
      *<?xml version='1.0' encoding='windows-1252'?>*
      *<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"*
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
      *<jsp:output omit-xml-declaration="true" doctype-root-element="HTML"*
      doctype-system="http://www.w3.org/TR/html4/loose.dtd"
      doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
      *<jsp:directive.page contentType="text/html;charset=windows-1252"/>*
      *<f:view>*
      *<html>*
      *<head>*
      *<meta http-equiv="Content-Type"*
      content="text/html; charset=windows-1252"/>
      *<title>TestWSDL</title>*

      *</head>*
      *<body style="text-align:left;">*
      *<h:form>*

      *<table id="jobs_table">*

      *<tr>*
      *<td>*
      *<h:outputLabel value="Enter WSDL URL"/>*
      *</td>*
      *<td>*
      *<h:inputText id="wsdl" size="150"*
      *valueChangeListener="#{operationBean.getOperations}"/>*
      *</td>*
      *</tr>*
      *<tr>*
      *<td>*
      *<h:outputLabel value="Operation"/>*
      *</td>*
      *<td>*
      *<h:selectOneMenu id="som1"*
      *value="#{operationBean.operationName}">*
      *<f:selectItems value="#{operationBean.listOperations}"/>*
      *</h:selectOneMenu>*
      *</td>*
      *</tr>*



      *<tr>*
      *<td align="justify">*
      *<h:outputLabel value="Payload"/>*
      *</td>*
      *<td>*
      *<h:inputTextarea id="textArea"*
      *label="Payload" rows="20" cols="110"/>*
      *</td>*
      *</tr>*


      *<tr>*
      *<td>*
      *<h:commandButton value="Test" id="test"/>*
      *</td>*
      *</tr>*

      *</table>*
      *</h:form>*
      *</body>*
      *</html>*
      *</f:view>*
      *</jsp:root>*

      Here is my Java class:
      *package com.java.bean;*


      *import com.java.ServiceDetails;*
      *import com.java.WsdlDefinitions;*

      *import java.util.ArrayList;*
      *import java.util.List;*
      *import javax.faces.event.ValueChangeEvent;*
      *import javax.faces.model.SelectItem;*


      *public class operationBean {*

      *public operationBean() {*
      *}*
      *String operationName = null;*
      *List<SelectItem> listOperations;*

      *public void setOperationName(String operationName) {*
      *this.operationName = operationName;*
      *}*

      *public String getOperationName() {*
      *return operationName;*
      *}*


      *public void getOperations(ValueChangeEvent valueChangeEvent) {*
      *// Add event code here...*
      *final String WSDL_ENDPOINT_URL=valueChangeEvent.getNewValue().toString();*
      *String oldWSDL = valueChangeEvent.getOldValue().toString();*
      *System.out.println(" CurrentWSDL: " + WSDL_ENDPOINT_URL);*
      *System.out.println(" OldWSDL: " + oldWSDL);*
      *String wsdlOperations = null;*
      *List<SelectItem> operationsList = null;*
      *ServiceDetails serviceDetails = new ServiceDetails(WSDL_ENDPOINT_URL);*
      *WsdlDefinitions wsdlDefinitions = serviceDetails.getWsdlDefinitions();*
      *wsdlOperations = wsdlDefinitions.getPortType().getOperation().getName();*
      *if(operationsList == null){*
      *operationsList=new ArrayList<SelectItem>();*
      *operationsList.add(new SelectItem(wsdlOperations));*
      *System.out.println(" operationName: " + operationName);*
      *this.setOperationName(wsdlOperations);*
      *this.setListOperations(operationsList);*
      *}*
      *}*


      *public void setListOperations(List<SelectItem> listOperations) {*
      *this.listOperations = listOperations;*
      *}*

      *public List<SelectItem> getListOperations() {*
      *return listOperations;*
      *}*


      *}*

      Thanks.