JSF 2.0: InputText element of type Integer have become pre-filled with '0'

Hello to all!
I have invested a lot of time, but unfortunately without success. I hope intensely that somebody of you can help me!
I have an inputText element of type Integer, which pre-filled my input field with a '0' when I'm loading/starting my form.
When I'm loading my form for the first time I would like to have an empty field and not a field, which is pre-filled with a '0'.
Is this possible?
I have some code:
<h:inputText id="field" value="#{customerBean.field}" converter="javax.faces.Integer" validator="#{validatorBean.validateField}" />
@ManagedBean(name = "customerBean")
public class Customer
   private int field;
   public int getfield()
      return field;
   public void setfield(int field)
      this.field = field;
@ManagedBean(name = "validatorBean")
public class Validator
  public void validateField(FacesContext ctx, UIComponent comp, Object inValue) throws ValidatorException
     int value = (Integer) inValue;
     if (!(value >= 0 && value <= 100) && !(value == -9))
        throw new ValidatorException(new FacesMessage("Illegal entry! Legal values are: '0' to '400', '-9'.", null));
}Thanks for helping!

Hello!
With "private Integer field" it works.
I did not know that for any primitive data type it exists a corresponding object data type.
Now I know. :-)
Thanks for helping.

Similar Messages

  • Container element in BPM of type integer

    if i make a container element of type integer in my BPM, does it initiallize to some value

    Hi Pankaj,
    Check this out,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/78/62373f58502e48e10000000a114084/content.htm
    Go to Assigning Values
    <i>At runtime, you can assign a value to a container element, for example to increase a counter or to append a message to a list of messages.</i>
    Also refer this
    http://help.sap.com/saphelp_nw2004s/helpdata/en/59/e1283f2bbad036e10000000a114084/frameset.htm
    <i>[Reward if useful]</i>
    Regards,
    Prateek

  • Problems setting managed bean property of type Integer

    I got a problem when I use valueBinding #{param.productId} in faces-config.xml for my managed bean:
    My property 'productId' in bean Product is of type Integer, and my bean is in request scope. When I try to invoke some action on page, wich should navigate me to another view - JSF is trying to set productId for current view, and of course it is empty (""), and for the reasons given above I'm getting an error:
    javax.faces.FacesException: Can't set managed bean property: 'applicationId'.
    at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:576)
    at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:233)
    at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)
    ... 60 more
    Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:489)
    at java.lang.Integer.<init>(Integer.java:609)
    at com.sun.faces.config.ManagedBeanFactory.getConvertedValueConsideringPrimitives(ManagedBeanFactory.java:855)
    at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:555)
    Should I use requestScope instead of param to have my parameter null, and not "" ?
    If so, how should I pass requestScope parameter using commandLink?

    Hi! I have a problem with setting params too. Probably my one is different.
    I have a jsp page which show a datatable, where I can see a row for each Product. If I click on its name I would navigate to another page that shows product informations, as several ecommerce sites do.
    But I can't understand what and how I must set to inform the details page on which product have to show.
    I read in this forum that it's possible to set a parameter in productBean, and then the constructor of product bean loads others fields knowing its id.
    The snippet of my faces-config.xml is:
      <managed-bean>
        <managed-bean-name>product</managed-bean-name>
        <managed-bean-class>test.backing.ProductBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
          <property-name>idToLoad</property-name>
          <property-class>java.lang.Integer</property-class>
          <value>#{param.id}</value>
        </managed-property>
      </managed-bean>It is possible? is a correct solution? and if it is, how can I do that?
    Thanks very much if someone can resolve my problem.
    Claudio.

  • Value must be of type integer (between -2147483648 and 2147483647)

    Hi,
    Does anyone knows how to overcome this issue?
    NW7.01.05
    My Table in the View uses as dataSource a node called "DumpReport" - This has been created using a Structure type Zwd_S_Dumpage_Data.
    The structure has some elements, and my issue is in the Quantity element. This element is defined as:
    Element Name: Quantity
    Simple Type Package: [irrelevant]
    Simple Type: Zwd_E_Dumpqty
    Built-in Type: decimal
    Length: 13
    Decimals: 3
    I have one InputField, binding to this property. When I try to submit any decimal values, I get this error:
    " Value must be of type integer (between -2147483648 and 2147483647) " - related to that Context Property (Quantity).
    Regards,
    Daniel

    For future reference,
    External Length for this dataType was 17. We made it bigger in the R/3, since we compared to a Price field and it was 18 and working.
    Somehow this fixed our issue. I'm still looking for some additional information, since the Built-in type was a Decimal (WDP side) and it was being validated as an Integer?!!?
    Daniel

  • How to cast an Object into a specific type (Integer/String) at runtime

    Problem:
    How to cast an Object into a specific type (Integer/String) at runtime, where type is not known at compile time.
    Example:
    public class TestCode {
         public static Object func1()
    Integer i = new Integer(10); //or String str = new String("abc");
    Object temp= i; //or Object temp= str;
    return temp;
         public static void func2(Integer param1)
              //Performing some stuff
         public static void main(String args[])
         Object obj = func1();
    //cast obj into Integer at run time
         func2(Integer);
    Description:
    In example, func1() will be called first which will return an object. Returned object refer to an Integer object or an String object. Now at run time, I want to cast this object to the class its referring to (Integer or String).
    For e.g., if returned object is referring to Integer then cast that object into Integer and call func2() by passing Integer object.

    GDS123 wrote:
    Problem:
    How to cast an Object into a specific type (Integer/String) at runtime, where type is not known at compile time.
    There is only one way to have an object of an unknown type at compile time. That is to create the object's class at runtime using a classloader. Typically a URLClassloader.
    Look into
    Class.ForName(String)

  • Error while creating Communication Channel- No SLD elements of type  SAP_XI

    Hi Experts,
    I am getting an error when i am tring to create an Communication channel for File Adapter .
    Error message:
    No SLD elements of type  SAP_XI Adapter Framework Found.
    Could you let me know how to proceed and fix the issue.
    Regards
    Kiran Kumar.P

    Hi Kiran,
      Your Adapter Framework is probably not registered in the SLD.... perform the action as follows:
    1. In the J2EE administrator tool in cluster - server - services - deploy
    stop the J2EE applications:
    a. sap.com/com.sap.aii.af.service.cpa.monitor
    b. sap.com/com.sap.aii.af.
    2. Restart the sap.com/com.sap.aii.af application.
    Refer sapnote in chapter 8.2 for more in the link provided below on Trouble shooting.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/bd5950ff-0701-0010-a5bc-86d45fd52283
    Also try stop and start of the Java EE application "com.sap.xi.directory".
    for more info refer this thread..
    SLDAccess set to true, but not available with PI 7.10 SPS 7
    Regds,
    Pinangshuk.

  • No SLD elements of type SAP_XIAdapterFramework found in PI 7.1

    Hi Experts,
    I am working on PI 7.1 system.
    During configuration time while creating communication channel it gives error message as "No SLD elements of type SAP_XIAdapterFramework found".
    Even I am not able to see Adapter Engine in RWB.
    Any Clue?
    Gaurav Jain

    Hi Gaurav,
    In SLD You have to define all the systems and components. Under technical system in SLD , You should have entry for adapter Engine.I think that might be missing.
    Hope this will help.
    Vinod

  • Ho to set the format of an InputField of type integer?

    Hello,
    I have an input field bound to context attribute of simple type integer. I want to have the number entered into this input field in this format “57000”. Currently when I enter a number then navigate to another view and then return to this view where the input field is the number entered into the field become formatted like this “57,000” which is not what I want. Do you know how to explicitly set the format to such input field?
    Thanks
    Best Regards,
    Jeny

    Hi,
    Set the format you required as ##### in Representation Tab of Simpletype of type integer you have created previously
    Have a look at this thread,
    Re: How to change the format of a decimal input field?
    Regards
    Saravanan K

  • Simple type of type integer

    Hi All,
    I have create simple type which is of type integer. And i have set the maximum and minimum length for the simple type which is bounded with the input field. When i try to display it, it displayes with ",".
         Example 70,000,000.
    My require is to remove the commas in between the number. Is there solution for this.
    Regards,
    Revathy Madhavan.

    Hi Revathy,
    the display of numbers is localized, here in germany I see "70.000.000". So whenever you change the behaviour, consider that you skip the automated localization provided by sap.
    That said: Open your simple type and go to the "Representation" Tab. in the right upper corner, enter "#" into the field format.
    Problem solved.
    If you want to know more, read the java api of NumberFormat which describes various options for Number presentations based on String patterns.
    Jan

  • Create table of type integer

    How can we create a table of type integer in MDM. (what the code should be?)
    When I create a table, it only allows type Text.
    Thanks

    Hi R.N,
    we can create table of type Flat, Hierarachy, Taxanomy, Qualified Flat and Families.
    you are talking about field, by default whenever you create any table a field "Name" of type Text get generated, but here if you want this field to be integer, just create new field by right clickin "Add Field" by going into table in which you want that field. here you can give any name to that field and select type Integer . if you want only Integer field into your table then also make it "Display Field" only after that you can delete field "Name" of type Text.
    Note: For creating Table Click on your repository where you can see and create tables and for field just click on any table where you want to include that field into table
    Code takes important incase of Java APis and ABAP Apis. where APIs recognise table and fields with their code only.
    Remember to unload repository before creating Table and Fields and then load it.
    Hope it helps you,
    Mandeep Saini
    Edited by: Mandeep Saini on May 6, 2008 10:43 AM
    Edited by: Mandeep Saini on May 6, 2008 10:48 AM

  • Problem trying to compare 2 values of type Integer in IF condition

    I havd pop a value of type Integer from a stack into a variable, but the If conditions does not seem to work:
    iqueuedVar = conn3.removeFromFeed();
    System.out.println(iqueuedVar);
    Integer test = new Integer(123);
    if(test == iqueuedVar)
    System.out.println("It Works !!");
    The Integer test searched for the popped value 123 - which exists - but the IF condition is not working.
    I'm using API 1.4.2 - Please help ?

    I havd pop a value of type Integer from a stack into
    a variable, but the If conditions does not seem to
    work:
    iqueuedVar = conn3.removeFromFeed();
    System.out.println(iqueuedVar);
    Integer test = new Integer(123);
    if(test == iqueuedVar)
    System.out.println("It Works !!");
    The Integer test searched for the popped value 123 -
    which exists - but the IF condition is not working.
    I'm using API 1.4.2 - Please help ?get the int value from Integer.Then compare two int value

  • In a XSD, can a element's name & type attributes have same value ?

    Hi,
    Can i have a same value for the name & type attributes of an Element. For ex: in below XSD, the element 'ChildEL' has the same value('ChildEL') for the type attributes as the name('ChildEL') ?
    I am asking this because when i generate Java Classes using Castor Source Code generator using this XSD has input, the output classes do NOT compile since the class ChildEL inherits itself and which causes the cyclic inheritance. Please help.
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
         <xs:element name="ParentEL" type="ParentELType"/>
         <xs:complexType name="ParentELType">
              <xs:sequence>
                   <xs:element name="ChildEL" type="ChildEL" maxOccurs="unbounded"/>
              </xs:sequence>     
              <xs:attribute name="CreationDate" type="xs:dateTime"/>
         </xs:complexType>
         <xs:complexType name="ChildEL">
              <xs:sequence>
                   <xs:element name="Type" type="xs:string/>
                   <xs:element name="ID" type="xs:string/>
              </xs:sequence>
         </xs:complexType>
    </xs:schema>
    Thanks,
    Manoj

    I figured out that this is possible and to avoid the compilation error in Castor source code generator is to set the property org.exolab.castor.builder.javaclassmapping=type in castorbuilder.properties config file.

  • No SLD elements of type SAP_XIAdapterFramework found

    Hi,
    While doing a Cache Connectivity test from Runtime workbench I am getting a below mentioned error.
    Protocol Unknown (Could Not Be Determined)
    Hide Detailed Error Message
    Cache notification from Integration Directory
    failed: Error when accessing the System Landscape Directory
    Detailed Error Message
    No SLD elements of type SAP_XIAdapterFramework found.
    Any help on this would be highly appriciated.
    Regards
    SG

    Hi Sumit
    What version/SP release of XI are you using?
    Try applying SAP note #1278563 Specification of message server host in Exchange Profile.
    P.S. Try searching the forum for similar issues before posting. See Cache update not yet started
    Regards
    Mark

  • Is it possible to get the element data type of a Queue from itself?

    Hi everyone,
    i have a Q that has a cluster as element data type.
    now when i want to enqueue
    i'll use bundle-by-name
    and for that i'd have to have my data-type present
    (long cable from whereever (possibly from where i obtained the Q).
    my question is,
    whether there is a method/property-node/something that allows me to
    wire the Queue Refnum into it and receive the element-data-type,
    so i can then input into the top of bundle-by-name?
    (i really dont want to have that cable all over the place)
    the reason i ask here is that
    the help for the outgoing Queue Refnum from the Obtain Queue method,
    shows the element-data-type and so i hope there might be a solution.
    thx for your time
    and cheers
    j
    Solved!
    Go to Solution.

    If I understand your question correctly, the answer is "Yes, it's very easy ..."
    The answer is "Preview Queue".  Here I create a Queue of some mysterious type (it's a cluster having a Thing and a Center, but you don't know that yet).  I take the Queue reference from whereever I can find it and pass it into Preview Queue Element.  I take the output and use it to define my cluster in Bundle by Name.
    Two caveats.  This copies the first element of the Queue into the cluster, so you probably need to be sure to define all of the elements of your cluster.  But what if the Queue is empty (as mine is, above, as I just Obtained it) -- well, that's why 0 is wired into the TimeOut input, since I do not want to wait "forever" (-1) for the empty Queue to have an element!  Turns out that even in this case, you still get the correct Cluster elements!
    Neat, huh?
    Bob Schor

  • How can I restore move function and type tool which abruptly became balky with Elements 8 with OS10.10.2?

    How can I restore move function and type tool which abruptly became balky with Elements 8 with OS10.10.2?

    Follow-up: I'm worried about performing any actions without input, because I don't want to back myself into a corner.
    Will resetting Firefox fix the problem (instead of creating a new places database)? https://support.mozilla.org/en-US/kb/reset-firefox-easily-fix-most-problems
    According to this article, a reset will keep browsing history, which should allow me to access my lost tabs IF it will also fix my database problem.

Maybe you are looking for

  • Error in T-Code: F.5E

    Dear all, I am getting the following errors while executing T-Code: F.5E 01. No postings can be created for company code 4000 02. Errors occur when determining adjustment accounts 03. Correct the error 04. Run report SAPF180K and i didn't get any err

  • Java Sun Creator 2 (Windows version), misconfiguration?

    Hi there, I've downloaded Sun Creator 2 for my mac, linux and windows machines. I'm using the AppServer8 on a different server as a production machine. I used without problems the Creator on the Windows machine (deploying on the server) for a week or

  • Photoshop CS5 32 bit and Nik software crashes even before CS5 starts

    Hi, First of all - if my english is a bit poor, its because I´m from Norway. BUt I´m having problems with CS5 in 32 bit mode, and I have the Nik plugins innstalled, but I don´t know if they are the problem, or something else. Here is the complete log

  • IMovie won't import from iPhoto (this is different than all the other post)

    Before you think, "Oh... this is the typical 'iMovie 7 isn't importing iPhoto movies' question" this isn't. I've looked through a ton of threads and questions trying to find something similar to this. Q: I have all my digital camera (Canon SD500 came

  • Plug-ins in CC

    Does CC recognize plugins such as portraiture and others?