Displaying Bean values

I have a database bean that works well when I select from a drop down list and get the lastname and it also gives me the count of how many lastnames I have that are a match in the database.
Now I added a firstname list with the lastname list and the count shows up on the JSP and the lastname shows on the JSP but the firstname doesnt show up.
mypage.jsp is this code:
<jsp:useBean id="countandfielda" class="colors.Countandfielda" />
<form post="post" action="colors/Countandfielda.jsp">
First Name: <select name="firstName">
<option value=""></option>
<option value="Joe">Joe</option>
<option value="Dave">Dave</option>
<option value="Edward">Edward</option>
<option value="Will">Will</option>
<option value="%">All</option>
</select>
<br>
Last Name:
<select name="lastName">
<option value=""></option>
<option value="Smith">Smith</option>
<option value="Jones">Jones</option>
<option value="Pope">Pope</option>
<option value="Edwards">Edwards</option>
<option value="%">All</option>
</select>
<input type="submit">
</form>
<jsp:setProperty name="countandfielda"  property="lastName" />
<jsp:setProperty name="countandfielda"  property="firstName" />
LastName<br> <jsp:getProperty name="countandfielda" property="lastName" /><br>
FirstName<br> <jsp:getProperty name="countandfielda" property="firstName" /><br>
<jsp:setProperty name="countandfielda"  property="mycount" />
count = <jsp:getProperty name="countandfielda" property="mycount" />I tried changing the setProperty and getProperty order for the firstName and lastName but it didnt work.
Here is my output if for example I select a firstname of Dave and select lastname of Jones and get a successful hit on the database:
LastName
Jones
FirstName
count = 1 It doesnt want to output the FirstName value (which should be Dave). My Tomcat log shows the firstname and lastname but cant get it to show on my JSP Bean page.
Please advise.

Thanks,
I tried this and it shows the names on the JSP but it doesnt seem to read the database because it shows the firstname and lastname of whatever I select in the options list (whether a hit or not in the database) and the count doesnt show any hits.
Please advise:
public class Countandfielda
   protected int mycount = 0;
   protected String lastName;
   protected String firstName;
   protected String query;
public Countandfielda()
   //Calling this method in my no arg constructor
    viewDatabaseTable();
public int getMycount()
  return mycount;
public void setMycount(int aMycount)
   mycount = aMycount;
public String getLastName()
   return lastName;
public void setLastName(String aLastName)
   lastName = aLastName;
public String getFirstName()
   //this.viewDatabaseTable();
   return firstName;
public void setFirstName(String aFirstName)
   firstName = aFirstName;
public void viewDatabaseTable()
  //I tried putting the mutators here and it didnt work where it gave no results from database
  //setFirstName(firstName);
  //setLastName(lastName);
  //setMyCount(mycount);
  exq(query);
public void exq(String query)
try          
Class.forName("org.gjt.mm.mysql.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/myfirst?user=root&password=aaaaaa");
PreparedStatement ps = conn.prepareStatement("SELECT * FROM user WHERE lastname like ? and firstname like ?");
ps.setString(1, lastName);
ps.setString(2, firstName);
        ResultSet results = ps.executeQuery();
          lastName = "";
          firstName = "";
          while(results.next())               
     firstName += results.getString("firstName") + " ";
     lastName += results.getString("lastName") +"<br>";          
          mycount++;
          System.out.println(mycount);     
     catch(Exception e)          
     System.out.println("Exception here. Did not work.");               
}I also tried changing my bean calling page:
<form select area...>
<jsp:setProperty name="countandfielda"  property="firstName" />
FirstName<br> <jsp:getProperty name="countandfielda" property="firstName" /><br>
<jsp:setProperty name="countandfielda"  property="lastName" />
LastName<br> <jsp:getProperty name="countandfielda" property="lastName" /><br>
<jsp:setProperty name="countandfielda"  property="mycount" />
count = <jsp:getProperty name="countandfielda" property="mycount" />

Similar Messages

  • Displaying bean values in different pages

    I have a bean that is set in a loop and it returns values according to the number of records selected in my checkbox. At the moment the bean displays the records one after the other on the same page. i am trying to figure out a way where I can display the first record's details then have a button<next> to click on for the next record.
    The bean is set like this in the servlet:
    String selected[] = request.getParameterValues("select");//from JSP
    int index = Integer.parseInt(selected);
    for(int j=0; j<trades.length; j++)
    if(index == j)
         doConfirmation();      
    displayVector.addElement(setConfirmerBean(trades[j]));
    session.setAttribute("displayVector", displayVector);
    public void setConfirmerBean()
    ABC bean = new ABC()
    bean.setCustNumber();
    In the JSP I get displayVector from the session and iterate through it to display the records it contains. I need to display records per page not all in one page, any ideas/help will be appreciated.
    thanx

    Take a look at
    http://java.sun.com/blueprints/patterns/j2ee_patterns/page_by_page_iterator/index.html

  • Bean Value display in JSP Page

    Hi,
    I am trying to display a value stored in my bean on the jsp page. The value is to be displayed on the initial jsp page.
       public void doInitialization()
              request = (IPortalComponentRequest) this.getRequest();
              response = (IPortalComponentResponse) this.getResponse();
              myContext = request.getComponentContext();
              myProfile = myContext.getProfile();      
              Statement += "doInitialization";
              BeanContainer = new MockUpBean();
              BeanContainer.setValues( Statement);
              myProfile.putValue( "myBean", BeanContainer);
              // reset String
              BeanContainer = ( MockUpBean) myProfile.getValue( "myBean");     
        }// public void doInitialization()
    On the JSP Page side:
    <jsp:useBean id="myBean" scope="application" class="MockUpBeanPackage.MockUpBean" />
    <%= myBean.getValues()%>
    The jsp page does no pick up the value I try to store in the doInitialise method.
    Any thoughts on what I may have done wrong in my code.
    I try response.write("Test"), this too does not show up in my JSP page.
    Any advice would be appreciated.
    Thank you
    NAC

    Marty,
    The portalapp.xml file is as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
      </application-config>
      <components>
        <component name="MockUpPage">
          <component-config>
            <property name="ClassName" value="MockUpPackage.MockUpPage"/>
            <property name="SecurityZone" value="MockUpPackage/low_safety"/>       
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/InitialPage.jsp"/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
          </component-profile>
        </component>
      </components>
      <services/>
    </application>
    Again any help would be apreciated. I have used this piece of code to write values to beans in various projects, never had any issues. This is the first time I am having an issue with this piece of code.
    NAC

  • Display Javascript array value OnChange instead of Bean value

    I intially loop through a collection of employees display the values within the employee loop I have a select statement that i loop through a collection of programs that has on OnChange. I want to display the javascript value instead of the bean value onChange. The following code displays the bean value initally and onChange it displays both because the if is never false?
    *<c:if test="${programs[programIndex] != emps.department}">${emps.department}</c:if>*
    * <div id="programText"> </div>*
    * <input name="department" type="hidden" id="department">*
    JSP page
    <jsp:useBean id="programs" scope="request" class="java.util.Collection"/>
    <jsp:useBean id="employeeList" scope="request" class="java.util.Collection"/>
    <script language="JavaScript" type="text/javascript">
    var programs = new Array();
    function setProgramFields() {
    nameField = document.getElementById("programList");
    idx = nameField.selectedIndex;
    emField = document.getElementById("programText");
    emHiddenField = document.getElementById("department");
    emField.innerHTML = programs[idx];
    emHiddenField.value = programs[idx];
    <c:forEach var="emps" items="${employeeList}">
    <td width="170px">
    *<c:if test="${programs[programIndex] != emps.department}">${emps.department}</c:if>*
    * <div id="programText"> </div>*
    * <input name="department" type="hidden" id="department">*
    </td>
    <td width="275px">
    <div class="selectBorder">
    <select name="programName" type="text" class="searchProgram" id="programList" onChange="setProgramFields()">
    <c:set var="programIndex" value="0"/>
    <c:forEach var="sp" items="${programs}">
    <c:if test="${sp.programName == emps.programName}">
    <option value="${emps.programName}" selected="selected">${emps.programName}</option>
    </c:if>
    <c:if test="${sp.programName != emps.programName}">
    <option value="${sp.programName}">${sp.programName}</option>
    </c:if>
    <script language="JavaScript" type="text/javascript">
    programs[${programIndex}] = "${sp.department}";
    </script>
    <c:set var="programIndex" value="${programIndex + 1}"/>
    </c:forEach>
    </select>
    </div>
    </td>
    </c:forEach>
    Edited by: kmb_ms on Sep 15, 2008 2:38 PM

    Apologize for not formatting the code. I used the status.index the code as suggested. The code if more efficient but the results are the same and I still have the same problem.
    <select name="programName" type="text" class="searchProgram" id="programList" onChange="setProgramFields()">
    <c:forEach var="sp" items="${programs}" varStatus="status">
    <c:if test="${sp.programName == emps.programName}">
    <option value="${emps.programName}" selected="selected">${emps.programName}</option>
    </c:if>
    <c:if test="${sp.programName != emps.programName}">
    <option value="${sp.programName}">${sp.programName}</option>
    </c:if>
    <script language="JavaScript" type="text/javascript">
    departments[${status.index}] = "${sp.department}";
    </script>
    </c:forEach>
    </select> How can I access the value of the array to compare with the value of the bean.
    <script language="JavaScript" type="text/javascript">
    var departments = new Array();
    function setProgramFields() {
    nameField = document.getElementById("programList");
    idx = nameField.selectedIndex;
    emField = document.getElementById("departmentText");
    emHiddenField = document.getElementById("department");
    emField.innerHTML = departments[idx];
    emHiddenField.value = departments[idx];
    </script>The following code displays both the value of the bean and the value of the array onChange b/c the if statement is always true???? This is where I need help.
    <td width="170px">
         <c:if test="${departments[idx] != emps.department}">${emps.department}</c:if>
         <div id="departmentText"> </div>
         <input name="department" type="hidden" id="department">
    </td>

  • How to assign bean value to a local variable in JSP using struts.

    Hi everybody!
    I've a problem that puzzled me on how to assign a bean value to a local variable like String in JSP using struts.
    we can have someting like this to display the value
    <bean:write name="detailService" property="status" />or
    <bean:define id="theStatus" name="detailService" property="status"/>
         This is country: <%=theStatus%>but an error occured when I tried like this:
    String currentStatus = "<bean:define id="theStatus" name="detailService" property="status"/>";
    or
    String currentStatus = "<bean:write name="detailService" property="status" />";Is there a way to do this?.....
    Any help pretty much appreciated

    Java != JSP.
    The <bean:define> and <bean:write> tags are custom tags meant to appear in the HTML section of a JSP file, as opposed to the scriptlet section. They actually get turned into java code as part of the translation process.
    The <bean:write> tag naturally just writes out what you tell it to.
    The <bean:define> tag defines a local variable, and gives it a value.
    this should do it.
    <bean:define id="theStatus" name="detailService" property="status" type="java.lang.String"/>
    <%
      String currentStatus = theStatus;
    %>With the advent of JSTL, you shouldn't really need to use scriptlet code anymore. Personally I am for 0% scriptlet code in any jsp I write.

  • Null Error in Displaying a value through view attribute

    I just want to display a value through message styled text bean from view attribute .
    For that i use the code in PR:
    But it gives null error: Please any one help me.
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("StaffInfoVO1");
    if(vo!=null)
    OARow row = (OARow)vo.getCurrentRow();
    System.out.println("vo is not null");
    String str1 = row.getAttribute("FullName").toString();
    OAMessageStyledTextBean stext1 = (OAMessageStyledTextBean)webBean.findChildRecursive("RFStaffName");
    stext1.setText(str1);
    While getattribute("FullName") executed it gives null error. Why?
    how to rectify?

    Hai,
    I can execute the query in toad which returns 1 row of data. It is not null rows.
    But my vo object, why it is not executed. Returning null. I dont know.. Too many hours i spent.
    VO query:
    select distinct papf.person_id,papf.FULL_NAME,
    papf.EMPLOYEE_NUMBER,
    papf.EMAIL_ADDRESS,
    papf.WORK_TELEPHONE,
    hla.COUNTRY,
    sysdate,
    pap.NAME,
    haou.NAMe department,
    ood.ORGANIZATION_NAME
    from
    per_all_people_f papf,
    per_all_assignments_f paaf,
    per_all_positions pap,
    per_jobs pj,
    per_grades pg,
    per_person_types ppt,
    hr_all_organization_units haou,
    hr_locations_all hla,
    org_organization_definitions ood
    where
    papf.PERSON_TYPE_ID=ppt.PERSON_TYPE_ID and
    papf.PERSON_ID=paaf.PERSON_ID and
    paaf.POSITION_ID=pap.POSITION_ID and
    paaf.JOB_ID=pj.JOB_ID and
    paaf.BUSINESS_GROUP_ID=haou.BUSINESS_GROUP_ID and
    papf.person_type_id=13 and
    haou.business_group_id=202 and
    haou.NAME like '%Global%Sales%' and
    papf.FULL_NAME like '%Stand%' and
    paaf.LOCATION_ID=hla.LOCATION_ID and
    paaf.ORGANIZATION_ID=ood.ORGANIZATION_ID and
    sysdate between papf.EFFECTIVE_START_DATE and papf.EFFECTIVE_END_DATE and
    sysdate between paaf.EFFECTIVE_START_DATE and paaf.EFFECTIVE_END_DATE
    Help Me.
    Thanks & Regards

  • Using bean value in NLS text entry

    Hi all,
    Is there a way I can use the JHeadstart NLS function like
    title="#{nls['HOME_PAGE_TITLE']}"
    and include a bean value in the title
    eg " Welcome #{jhsUser.userId} to my wonderful application".
    I use JHS_TRANSLATIONS to store my text - if I enter the value as above, the jhsUser expression does not get rendered
    Cheers,
    Brent

    Just after posting this message I saw that the exact same thing had been done in the page I had just generated !
    So, the answer is to use this
    text="#{nls['HOME_WELCOME_MSG: #{jhsUser.displayName}']}"Is there a way to inject this in through the JHeadstart application definition ? If I place the value in the Display Title property it further wraps the text with extra nls and {}.
    Is my only option to create a custom template for grouTemplate.vm ?
    Cheers,
    Brent

  • How to refresh bean value in advanced table from vo/database value in PR.

    Hi,
    I have requirement in which I have two OAF pages. First is the base page and second is popup page. Base page displays some values in table with messagetextinput. When user clicks button on the base page it is calling popup page. Now user changes value (Messagetextinout) in popup page and submits the popup page (which also closes popup page). Submit request in popup page does some calculation and also changes value of base page VO. But when control goes back to the base page, base page messagetestinput bean does not get changed even though VO is changed by submit request in popup page.
    Note: Popup page is closed using java script with following code.
    window.opener.submitForm('DefaultFormName'); // Submits base page to refresh the values in base page
    window.close(); // Closes popup page

    Thanks for the prompt reply.
    On base page, in advance table I am having a column called Value, it is either text field or LOV item based on the value of a list item called field type located in same advanced table, if value of the field type is FIELD we are displaying LOV else we are displaying text box. User can enter 4000 characters long value in Value column when field type value is not FIELD. Length of the Value text box in advanced table is limited so we have provided a link so that user can open the modal dialog box with the default value as base page's value column's value.
    We have set the destination URI property of the link on base page to open modal dialog box:
    javascript:var a = window.open('OA.jsp?page=/cummins/oracle/apps/perc/perc4681/g2config/webui/perc4681ValueModalDialogPG&retainAM=Y&pDetailSeqNo={@G2DetailSeqNo}','a','height=500,width=900,status=yes,toolbar=no,menubar=no,location=no'); a.focus();
    We have developed a page for modal dialog box, on PR of this page we are calling following method of AM to populate the default value.
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    Serializable[] params;
    params = new Serializable[] {pageContext.getParameter("pDetailSeqNo")};
    OAMessageTextInputBean value = (OAMessageTextInputBean) webBean.findChildRecursive("value");
    value.setValue(pageContext,(String)am.invokeMethod("getPopupValue",params));
    public String getPopupValue(String pSeqNumber)
    Perc4681G2DetailVOImpl vo1 = getPerc4681G2DetailVO1();
    Row[] r1 = vo1.getFilteredRows("G2DetailSeqNo",pSeqNumber);
    vo1.setCurrentRow(r1[0]);
    Perc4681G2DetailVORowImpl row = (Perc4681G2DetailVORowImpl) vo1.getCurrentRow();
    return (String)row.getAttribute("Value");
    On modal dialog box we have a button (it is not submit button) called done, we have set destination uri property of the button as below:
    javascript:opener.submitForm('DefaultFormName',1,{'XXX':'abc','Value':document.getElementById('value').value});window.close();
    we are sending the value entered in dialog box as parameter to base page.
    We have called below procedure of AM on PR of base page
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    Serializable[] params;
    OAPageLayoutBean oapagelayoutbean = pageContext.getPageLayoutBean();
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (!pageContext.isBackNavigationFired(false))
    some code
    else
    if((("abc").equals(pageContext.getParameter("XXX"))))
    String pop_up_attr_value= pageContext.getParameter("Value");
    params = new Serializable[] {pop_up_attr_value};
    am.invokeMethod("setPopupValue",params);
    enableDisable(webBean, pageContext);
    else if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, "G2DetailCreateTxn", true))
    OADialogPage dialogPage = new OADialogPage(STATE_LOSS_ERROR);
    pageContext.redirectToDialogPage(dialogPage);
    else if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, "G2DetailUpdateTxn", true))
    OADialogPage dialogPage = new OADialogPage(STATE_LOSS_ERROR);
    pageContext.redirectToDialogPage(dialogPage);
    public void setPopupValue(String pVal)
    Perc4681G2DetailVOImpl vo1 = getPerc4681G2DetailVO1();
    Perc4681G2DetailVORowImpl row = (Perc4681G2DetailVORowImpl) vo1.getCurrentRow();
    row.setAttribute("Value",pVal);
    Everything mentioned above is working as expected whereas I am not able to see the value ented in modal dialog window in value column of base page.
    Value is getting set in VO but it is not getting reflected in page.
    Could you please let me know where I am going wrong.
    Thanks in advance.

  • JSF keeps displaying old values after Validation Phase fails

    Hi all,
    I would like to ask some help in understanding a particular behaviour that JSF shows when Validation Phase fails.
    I'm using:
    - Tomcat 7.0.2
    - JSF 1.2_12
    - RichFaces 3.3.3
    Problem description.
    I wrote a form with 4 input fields: an inputText and 3 selectOneMenu. The inputText is required while the selectOneMenus don't require any validation.
    Attached to the first selectOneMenu (row 32), is an a4j:support tag so that, whenever the change event is fired, the list of items of the second
    and the third selectOneMenu (row 44 and 58) are correctly filled (note that the mandatory of the inputText is ignored thanks to the ajaxSingle attribute).
    In particular, after loading the two lists of items, the actionListener forces the value of the second and the third selectOneMenu to null.
    This mechanism seems to work fine until I submit the whole form without filling the input text: as expected, JSF validation fails but if I change the value of
    the first selectOneMenu again (causing a new submit), the page keeps displaying the values specified before JSF validation failed for the second and the third
    selectOneMenu (note that the actionListener is still called and the values of the second and the third selectOneMenu are still forced to null).
    Since I'm using a simple PhaseListener, I noticed the following: before JSF validation fails, every time I change the value of the first selectOneMenu, JSF life
    cycle always calls the get method for the second and the third selectOneMenu during the Render Response Phase. In this way, JSF is able to "see" that
    those values have been set to null during the Invoke Application Phase.
    After validation fails, JSF stops calling those getters when I change the value of the first selectOneMenu.
    I hope my explanation was clear enough, thanks a lot for your help.
    Regards,
    Nico
    Web Page
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich">
    <head>
      <title>Prove Rich</title>
    </head>
    <body>
      <h2>Prove Rich</h2>
      <f:view>
      <a4j:outputPanel ajaxRendered="true">
        <h:messages style="color:red" />
      </a4j:outputPanel>
      <h:form>
      <p>
         Input required: <h:inputText value="#{provaProbReplyBean.inputRequired}" required="true" />
      </p>
      <p>
           <h:outputText value="Scegli il canale:" />
           <h:selectOneMenu value="#{provaProbReplyBean.canale}">
            <f:selectItem itemLabel="--" itemValue="" />
            <f:selectItem itemLabel="Profamily" itemValue="Profamily" />
            <f:selectItem itemLabel="Captive" itemValue="Captive" />
            <a4j:support event="onchange" action="#{provaProbReplyBean.caricaProcBanche}"
                                  ajaxSingle="true" reRender="procedure, banche" />
         </h:selectOneMenu>
      </p>
      <p>
           <h:outputText value="Scegli la procedura:" />
           <h:selectOneMenu id="procedure" value="#{provaProbReplyBean.procedura}">
            <f:selectItem itemLabel="--" itemValue="" />
            <f:selectItems value="#{provaProbReplyBean.procedureList}" />
            <!-- immediately save the current value -->
            <a4j:support event="onchange" ajaxSingle="true" />
         </h:selectOneMenu>
      </p>
      <p>
           <h:outputText value="Scegli la banca:" />
           <h:selectOneMenu id="banche" value="#{provaProbReplyBean.banca}">
            <f:selectItem itemLabel="--" itemValue="" />
            <f:selectItems value="#{provaProbReplyBean.bancheList}" />
            <!-- immediately save the current value -->
            <a4j:support event="onchange" ajaxSingle="true" />
         </h:selectOneMenu>
      </p>
      <p><h:commandButton value="Submit" /></p>
      </h:form>
      </f:view>
    </body>
    </html>
    Bean
    public class ProvaProbReply {
         private String inputRequired;
         private String canale;
         private String procedura;
         private String banca;
         private Map<String, List<SelectItem>> canaliProc = new HashMap<String, List<SelectItem>>();
         private Map<String, List<SelectItem>> canaliBanche = new HashMap<String, List<SelectItem>>();
         private List<SelectItem> procedureList = new ArrayList<SelectItem>();
         private List<SelectItem> bancheList = new ArrayList<SelectItem>();
         public ProvaProbReply() {
              List<SelectItem> l = new ArrayList<SelectItem>();
              l.add(new SelectItem("Cessione del quinto"));
              l.add(new SelectItem("Credito al consumo"));
              l.add(new SelectItem("Mutui"));
              canaliProc.put("Profamily", l);
              l = new ArrayList<SelectItem>();
              l.add(new SelectItem("Credito al consumo"));
              canaliProc.put("Captive", l);
              l = new ArrayList<SelectItem>();
              canaliBanche.put("Profamily", l);
              l = new ArrayList<SelectItem>();
              l.add(new SelectItem("BDL"));
              l.add(new SelectItem("BM"));
              l.add(new SelectItem("BPM"));
              l.add(new SelectItem("CRA"));
              canaliBanche.put("Captive", l);
         public String getInputRequired() {
              return inputRequired;
         public void setInputRequired(String ir) {
              inputRequired = ir;
         public String getCanale() {
              return canale;
         public void setCanale(String c) {
              canale = c;
         public String getProcedura() {
              System.out.println("\ngetProcedura called\n");
              return procedura;
         public void setProcedura(String p) {
              procedura = p;
         public String getBanca() {
              System.out.println("\ngetBanca called\n");
              return banca;
         public void setBanca(String b) {
              banca = b;
         public List<SelectItem> getProcedureList() {
              return procedureList;
         public List<SelectItem> getBancheList() {
              return bancheList;
         public String caricaProcBanche() {
              System.out.println("\nListener called\n");
              procedureList.clear();
              bancheList.clear();
              if(canale != null && !canale.equals("")) {
                   procedureList.addAll(canaliProc.get(canale));
                   bancheList.addAll(canaliBanche.get(canale));
              System.out.println("BEFORE setting:\n");
              System.out.println("\nProcedura: "+procedura+"\n");
              System.out.println("Banca: "+banca+"\n");
              procedura = null;
              banca = null;
              System.out.println("\n\n\nAFTER setting:\n");
              System.out.println("\nProcedura: "+procedura+"\n");
              System.out.println("Banca: "+banca+"\n");
              return "";
    }Edited by: 869000 on 28-giu-2011 14.05

    I'm thinking this has to do with the fact that the UIComponents use the localValue after validation fails. This prevents the values from being overwritten when re-rendering the page, i.e. the inputs keep the value set by the user.
    The solution is to manipulate the components directly during the AJAX request when the first pull down is changed. Use the binding attribute to place them into your bean and clear the value directly. That way it will not matter that the expression is not evaluated.

  • Bean value disappear

    Hello,
    IDE: RAD 6.0.1
    WebSphere: 6.0 [BASE 6.0.2.5 cf50549.21]
    OS: Windows XP
    It looks like some bean (session scope) values disappear while displaying in JSF.
    I did the following check to make sure whether routine is really stores the value or not. The confusing part is it displayed some values and some not.
    In the following object.getValue() displays properly on console but not while JSF executed. I have some other parameters too and displayed properly.
    I also make sure that all values binded to output text properly or not.
    MyObject object = dataobj.selectData();
    System.out.println("going to display: "+object.getValue());
    if (object != null) {
    getFacesContext().getApplication().createValueBinding( "#{mybean}").setValue(getFacesContext(), object);
    } else {
    message = "There has been a problem in submitting to your request.";
    Any idea? Suggestions?
    Thanks,
    Pratik

    I want to store that value returned by the bean:write into a local variable so that i can pass it to a script ..
    eg:
    <logic:iterate name="resourceRequirementForm" property="grades" id="grade" indexId="index">
    str varname='<bean:write name="grade" property="value"/>';
    </logic:iterate>
    can this be done: storing of value i a variable

  • FacesContext killing my session bean values

    Hi
    i am using jdev 11.1.1.2
    After performing some operation in my UI i am using FacesContext to display some messages in my UI. But I have some session bean values which are displayed in the UI, when the FacesContext message is displayed all the session bean values vanishes from the UI and making it blank.
    Some of my session values are displayed as readonly and some are in input text..... The input text session values retains but the readonly one got vanishes from the UI.
    Please help!!
    Thanks
    Sudeep

    like in my jsff page ..........
    <af:inputText
    label="First Name"
    id="it10"
    value="#{modifyuser.fname}"
    valueChangeListener="#{modifyuserfields.modifyUserFName}"
    showRequired="true" required="true">
    />
    <af:validateRegExp pattern="^\s*[a-zA-Z.\\s'_-]+\s*$"
    messageDetailNoMatch="Please enter valid First Name! Use a-z,A-Z,'.',',_and - to enter."/>
    </af:inputText>
    <af:inputText
    label="Person Status"
    id="it12"
    value="#{modifyuser.personstatus}"
    readOnly="true">
    />
    </af:inputText>
    where modifyuseris a bean class of session type where fname and personstatus are two string object with setter and getter in it.
    now when i load this page ...... as i set the values in the bean class so the value holiding in it is getting displayed in my page .......... fname as input text editable and person status as readonly...
    i have a submit button so when i do any changes in the input text and submit ...... it perform an operation and on success of that i user FacesContext to display a success/error message... so when it is displayed on background the values from Person Status get vanishes from the UI .......... i do a submit again and i can see that in the bean it is holding the value but not getting displayed in UI after that message ........
    this is my facescontext code
    public String userModificationSuccess() {
    String msg="User has been successfully modified.";
    FacesContext ctx = getFacesContext();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, "");
    ctx.addMessage(null,fm);
    return null;
    please help!!
    this been an issue for me for the whole day !!
    Thanks
    Sudeep

  • Displaying the value of an variable on the stage

    I have managed to display the values contained in string variables on stage, and I am happy with that, however when I wish to display the value of an int and convert it to a string as one is supposed to do the output to the stage just calls it [class int] and does not give its value. any suggestions?
    My rogram contains a stage at frame 1 which displays a word. The user must input a word. Frame 30 then displays the word which was displayed and the word input by the user. That all works fine. But the value of the variable NumberRight, which has been assigned to that variable will only display as [class int] without showing its value. (even though I have converet it to a string using the .to string function you see below).
    My code is as follows;
    trace( "The number correct was" + NumberRight); //This works fine in the output window and shows the value of the variable as NumberRight [class int]1 (showing the value to be 1)
    outputText.appendText("in/"+textAtIN); //this works fine displaying the word presented and word input by user as in/in
    outputText.appendText( NumberRight.toString(     )); //here lies the problem as it just displays [class int] and nothing else.
    Yes I have managed to overcome that problem it was some code on the first frame, please excuse, however, now, is there any way to remove the [class int] bit from the displays, I wish to have the results as a clear copy of the results so that they can be printed out, without [class int] all over the place?

    Hi Ned thanks for that. Yes I had accidently created blank spaces in the String() argument. (wanted to check if there was a subsequent difference in display and forgot to return them to normal ...Sorted )
    Your next suggestion has eliminated the [class int] but I get a value now of 0.
    My code on the first frame for a correct response for example is;
    function keyPressedIN(event:KeyboardEvent):void
              if (event.keyCode == 13)/*Normally,this will move straight on to the next frame-
              recording a correct response and all that that implies in terms of scores etc. But now I have re directed it to Frame 30 to check are the variables working properly*/
                        //insert code for correct responses vowels etc.
                        VowelI = VowelI+1;
                        NumberRight = NumberRight +1;
                        stage.focus = stage;
                        //There is no need to display the text box as this is a correct response.
                        pupilsResponseIN.visible = false;
                        mainText.visible = false;
                        gotoAndPlay(30);//at the moment this takes me to the display frame to check if all is ok
    On the first frame when the user say hits the Return key my code assigns the value of +1 to the variable; eg
    NumberRight=NumberRight+1;
    and the value of +1 to the value of VowelI
    VowelI=VowelI+1
    At Frame 30 the code is as follows;
    stop();
    trace( "The number correct was"+ NumberRight);
    outputText.appendText("in/"+textAtIN);
    outputText.appendText( "\n");
    outputText.appendText("Vowels Correct ="+(int(VowelI).toString()));
    outputText.appendText( "\n");
    outputText.appendText("TotalCorrect="+(int(NumberRight).toString()));
    //outputText.appendText( VowelI.toString());
    Now what I am getting  is
    in/in
    Vowels Correct = O
    Total Correct = O
    Yet the trace (output box) records the Number correct as [class int]1 
    many years ago I wrote this same program in Authorware using similar code. I am trying to re write it in FlashCS5 using ActionScript 3 and It take days to solve small problems. I notice also that If for example the user of the program makes an error and I record the error as NumberRight =NumberRight -1 the program records it as Total Correct = NaN .
    I gave up on this a few months back but I am trying again. I think there must be a better way to do this. Variables do not seem to add up or subtract for me at present. no doubt its me thats got it wrong.

  • Form displays NULL values

    A page is using PL/SQL script to display data. There are 2 display variables. Instead of bringing initial set of data, it displays NULL values. It "fixes" itself after changing variable values from a drop down menu. Why is that and how to fix it?

    If you plan on performing all of the work under the Click event, then you won't need to worry about assigning a Script scope to the variables, but if you are planning on using those variables outside of the Event, then David's answer is the way to go.
    Another option is to use a hash table as it also works around the issue with variable scope in a UI Event.
    #Define at beginning of script
    $hashtable = @{}
    $OKButton.Add_Click({$hashtable.SelectedTemplate=$Something})
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • I am trying to build a basic TCL skeleton script that reads a remote SNMP OID and displays the value on the screen.

    I am trying to build a basic TCL skeleton script that reads a remote SNMP OID and displays the value on the screen.
    I don't want it to be an EEM Event, I just want to run it from the (tcl)# prompt.
    So I guess I'm asking if you can use cli_exec and other commands in the "namespace import ::cisco::eem::*" in a normal non-EEM script - can I do that?
    This is the error I get:
    OTN.159(tcl)#source flash:TCL_SNMP_Remote_Read.tcl
    invalid command name "::cisco::eem::event_register_none"             ^
    % Invalid input detected at '^' marker.
    What am I missing?
    =================  TCL_SNMP_Remote_Read.tcl  ==============================
    ::cisco::eem::event_register_none
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    if [catch {cli_open} RESULT]
        { error $RESULT $errorInfo }
        else { array set cli1 $RESULT }
    if [catch {cli_exec $cli1(fd) "snmp get v2c 192.168.1.100 public timeout 1 oid 1.3.6.1.2.1.1.1.0" } RESULT]
           { error $RESULT $errorInfo  }
           else { set SnmpSysDesc $RESULT }
    if [catch {cli_close $cli1(fd) $cli1(tty_id)} RESULT] {
                error $RESULT $errorInfo
    puts $SnmpSysDesc
    =========================================================================
    In the sho-run config I have:
    event manager directory user policy "flash:/"
    event manager session cli username "cisco"
    Any help to get me started would be greatly appreciated!
    Tim

    If you don't want an EEM policy, then don't use any of the EEM constructs.  Instead, all you need is this:
    set output [exec "snmp get v2c 192.168.1.100 public timeout 1 oid 1.3.6.1.2.1.1.1.0"]puts $output

  • Displaying default value for a field in ALV table

    Hai all,
         I am having an ALV table in which I want to display Requisition number by default using a value which i generated randomly and it is stored in a variable.
    While displaying ALV table my req number field should display that value by default when ever user is inserting a row( all the coloumns n my alv are editable.
    Is it possible?? 
    Kindly give some suggestions.
    Thanks in Advance,
    Nalla.B

    Hai Kris,
        I took help from ur link and i declared a global attribute request_number.
    and i created an event handler ON_ALV_INSERT and did the follwing coding for giving default value wen ever am inserting new row.
    FIELD-SYMBOLS: <wa_row> LIKE LINE OF r_param->t_inserted_rows.
      DATA bill_details TYPE REF TO zdom_bill_detail.
      LOOP AT r_param->t_inserted_rows ASSIGNING <wa_row>.
        bill_details ?= <wa_row>-r_value.
        IF bill_details->REQ_NUMBER IS INITIAL.
      DATA lo_nd_bill_detail TYPE REF TO if_wd_context_node.
      DATA lo_el_bill_detail TYPE REF TO if_wd_context_element.
      DATA ls_bill_detail TYPE wd_this->Element_bill_detail.
    navigate from <CONTEXT> to <BILL_DETAIL> via lead selection
      lo_nd_bill_detail = wd_context->get_child_node( name = wd_this->wdctx_bill_detail ).
    lo_el_bill_detail = lo_nd_bill_detail->get_element( index = <wa_row>-index ).
          lo_el_bill_detail->set_attribute(
            EXPORTING
              name  = 'REQ_NUMBER'
              value = wd_comp_controller->request_number
    Wen am  setting the value of wd_comp_controller->request_number to my context attribute am getting NULL object ref error.
    lo_el_bill_detail->set_attribute(
        name =  `REQ_NUMBER`
        value = wd_comp_controller->request_number ).
    Pls give some suggestions,
    Thanks in Advance,
    Nalla.B

Maybe you are looking for