String result of component method has newline

I really have a strange problem when returning a String as a
result from a component's method and trying to output this. I
always get an extra newline. Stripping does not help. Here is the
minimal code to reproduce this behaviour:
-Component Definintion:
<cfcomponent name="strtest" >
<cffunction name="test" returntype="String" >
<cfreturn "be">
</cffunction>
</cfcomponent>
-CFM
<cfset com=CreateObject("component","strtest")>
<cfoutput>
This should #com.test()# a single line
</cfoutput>
When I execute the script via my browser (IE or FF) and I
have a look at the source code then there will be a line break even
there shouldn't.
This only occurs when calling a method of a component...
calling a simple function or even temporarily store the result in a
variable does not bring up this behaviour.

I recommend you read through the other posts on these forums
before posting
your own questions, in case your issue is well-trod ground.
I answered someone else having this exact same issue only
yesterday: you
need to add output="false" into you <cffunction>
declaration.
Adam

Similar Messages

  • How to know that a method has been called and returning value of a method

    Hi, everyone! I have two questions. One is about making judgment about whether a method has been called or not; another one is about how to return "String value+newline character+String value" with a return statement.
    Here are the two original problems that I tried to solve.
    Write a class definition of a class named 'Value' with the following:
    a boolean instance variable named 'modified', initialized to false
    an integer instance variable named 'val'
    a constructor accepting a single paramter whose value is assigned to the instance variable 'val'
    a method 'getVal' that returns the current value of the instance variable 'val'
    a method 'setVal' that accepts a single parameter, assigns its value to 'val', and sets the 'modified' instance variable to true, and
    a boolean method, 'wasModified' that returns true if setVal was ever called.
    And I wrote my code this way:
    public class Value
    boolean modified=false;
    int val;
    public Value(int x)
    {val=x;}
      public int getVal()
      {return val;}
       public void setVal(int y)
        val = y;
        modified = true;
         public boolean wasModified()
          if(val==y&&modified==true)
          return true;
    }I tried to let the "wasModified" method know that the "setVal" has been called by writing:
    if(val==y&&modified==true)
    or
    if(x.setVal(y))
    I supposed that only when the "setVal" is called, the "modified" variable will be true(it's false by default) and val=y, don't either of this two conditions can prove that the method "setVal" has been called?
    I also have some questions about the feedback I got
    class Value is public, should be declared in a file named Value.java
    public class Value
    cannot find symbol
    symbol  : variable y
    location: class Value
    if(val==y&&modified==true)
    *^*
    *2 errors*
    I gave the class a name Value, doesn't that mean the class has been declared in a file named Value.java*?
    I have declared the variable y, why the compiler cann't find it? is it because y has been out of scale?
    The other problem is:
    Write a class named  Book containing:
    Two instance variables named  title and  author of type String.
    A constructor that accepts two String parameters. The value of the first is used to initialize the value of  title and the value of the second is used to initialize  author .
    A method named  toString that accepts no parameters.  toString returns a String consisting of the value of  title , followed by a newline character, followed by the value of  author .
    And this is my response:
    public class Book
    String title;
    String author;
      public Book(String x, String y)
       { title=x; author=y; }
       public String toString()
       {return title;
        return author;
    }I want to know that is it ok to have two return statements in a single method? Because when I add the return author; to the method toString, the compiler returns a complain which says it's an unreachable statement.
    Thank you very much!

    Lets take this slow and easy. First of all, you need to learn how to format your code for readability. Read and take to heart
    {color:0000ff}http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html{color}
    Now as to your first exercise, most of it is OK but not this:   public boolean wasModified()
          if (val == y && modified == true)
                return true;
    y being a parmeter to the setValue method exists only within the scope of that method. And why would you want to test that anyways? If modified evaluates to true, that's all you need to know that the value has been modified. So you could have   public boolean wasModified()
          if (modified == true)
                return true;
       }But even that is unnecessarily verbose, as the if condition evaluates to true, and the same is returned. So in the final analysis, all you need is   public boolean wasModified()
          return modified;
       }And a public class has to be declared in a file named for the class, yes.
    As for your second assignment, NO you cannot "return" two variables fom a method. return means just that: when the return statement is encountered, control returns to the calling routine. That's why the compiler is complaining that the statement following the (first) return statement is unreachable.
    Do you know how to string Strings together? (it's called concatenation.) And how to represent a newline in a String literal?
    db

  • How to get the result of a method on a page

    I use JDeveloper 11g
    I want the result of a method (String) in the ApplicationModule on a page (jspx)
    What I have done is:
    1. make a method (getValue) in the ApplicationModule Algemeen (also in Client interface)
    2. make a pagedef-file with executables and bindings, see
    <executables>
    <invokeAction id="doGetValue" Binds="getValue"
    Refresh="renderModel"/>
    <variableIterator id="variables" Refresh="renderModel">
    <variable Type="java.lang.String" Name="getValueReturn"
    IsQueriable="false" IsUpdateable="0"
    DefaultValue="${bindings.getValue.result}"/>
    </variableIterator>
    </executables>
    <bindings>
    <methodAction id="getValue" RequiresUpdateModel="true"
    Action="invokeMethod" MethodName="getValue"
    IsViewObjectMethod="false" DataControl="AlgemeenDataControl"
    InstanceName="AlgemeenDataControl.dataProvider"
    ReturnName="AlgemeenDataControl.methodResults.getValue_AlgemeenDataControl_dataProvider_getValue_result"/>
    <attributeValues IterBinding="variables" id="ValueReturn">
    <AttrNames>
    <Item Value="getValueReturn"/>
    </AttrNames>
    </attributeValues>
    </bindings>
    3. on the page (jspx) I have an outputText-component:
    <h:outputText value="#{bindings.ValueReturn.inputValue}"/>
    But, it does not work, I don't get the result of the method on the screen.
    Who can help me with this?

    Hi,
    Simple example below:
    Suppose you have this method in AppmoduleImpl:
    public void testHello( ) {
    return "Hello";
    1.After you expose this to clientInterface,drop this method on the jspx page as ADF Parameter
    form
    2.Drop the return String as outputText
    3.Run the page,click on the commandButton & the outputText returns 'Hello'
    Regards,
    Shantala

  • EXECUTE_METHOD_BOR - Application method has processed message 'E'; see long

    Hi All,
                I am having the following error in the workflow. Actually the WF was working fine and the past few days i am getting this error.
    EXECUTE_METHOD_BOR - Application method has processed message 'E'; see long text
    Actually the error occurs in the sub WF, in the method cancel invoice. it has one return variable the l_return but the method is not returning any value. The step is a background step.
    The error is
    Application method has processed message 'E'; see long text
    Message no. SWF_RUN669
    Diagnosis
    The workflow runtime system has called an application method in a tRFC or background context. A message was processed within this application method. This results in work item processing being terminated in this context.
    The processed message has the following parameters:
    ID: CRM_ORDER_MISC
    Type: E
    Number: 106
    System ResponseThe workflow runtime system has recognized this status and has caught the message. The status of the active work item is set to 'ERROR'.
    Procedure
    Identify the message statement in the application method and replace it with the command "Message....Raising". If the method is part of the standard shipment, create an OSS message for the relevant application component.
    Procedure for System Administration
    Once you have corrected the method, restart the workflow instance concerned by using Workflow administration.
    I started the WF from SWPR still the error persists. I dont know whether the error is in the method or in trfc.
    Kindly suggest what to do.
    Thanks in advance.

    Hello !
         Check automatic workflow customizing at SWU3 and authorizations at SU53 transactions.
    Regards,
    S.Suresh.

  • Calling results of a method from another class

    Very very new to Java, so apologies for the lack of basic knowledge. I am making a programme with 3 classes. One class gathers details about a module. Another about the results of this module (which requires some of the information inputted for the first class). For some reason I cannot find how to use results created in the first class in this second class. How do you call the results of a method from one class in another class?
    Thanks.

    Thank you.
    I am given the following information:
    '_ModuleRecord_
    This class is used to record information about a module taken by a single student. It has a constructor that takes three parameters:
    a Module,
    an int representing the examination mark achieved by a student, and
    an int representing the coursework mark achieved by a student.
    The class has another constructor that takes a single Module parameter.'
    and the code looks like this:
    public class ModuleRecord
      public ModuleRecord(Module m, int eMark, int cMark)
      public ModuleRecord(Module m)
      } I am a bit confused by the whole thing to be honest. I assume that the Module is referring to the other class, but how do I forge the link between them here?

  • Problem: "???" in place of string result

    Hi!
    I would like to use Oracle STRUCTS but after .getObject the .getAttributes method gives me only three question marks: "???" in place of the real varchar/String.
    BEA WebLogic's package examples.jdbc.oracle.extensions contains a simple example to demonstrate how to use Oracle STRUCTS. Everithing works well in this example but in place of string results there are triple question marks: "???".
    Here is the OUTPUT of the STRUCTs client sample execution:
    G:\bea\weblogic81\samples\server\examples\src\extensions> ant run.structs
    Buildfile: build.xml
    run.structs:
    [java] Getting employees from database...
    [java] Employee#: 100
    [java] Name: Alfred Chuang
    [java] Address: ???
    [java] ???, ???
    [java] Employee#: 101
    [java] Name: Joe Walker
    [java] Address: ???
    [java] ???, ???
    [java] Employee#: 102
    [java] Name: Tina Potter
    [java] Address: ???
    [java] ???, ???
    [java] Employee#: 103
    [java] Name: Fred Couples
    [java] Address: ???
    [java] ???, ???
    [java] Inserting employee to database...
    [java] Getting employees from database...
    [java] Employee#: 100
    [java] Name: Alfred Chuang
    [java] Address: ???
    [java] ???, ???
    [java] Employee#: 101
    [java] Name: Joe Walker
    [java] Address: ???
    [java] ???, ???
    [java] Employee#: 102
    [java] Name: Tina Potter
    [java] Address: ???
    [java] ???, ???
    [java] Employee#: 103
    [java] Name: Fred Couples
    [java] Address: ???
    [java] ???, ???
    [java] Employee#: 105
    [java] Name: David David
    [java] Address: ???
    [java] ???, ???
    BUILD SUCCESSFUL
    Can anybody help me?
    Thank you very much.

    Sorry i made a mistake in my query
    SELECT SUPPLIER_ID || '-'<br>
    FROM SUPPLIER<br>
    WHERE SUPPLIER_CODE IN (SELECT SUPPLIER_CODE<br>
    FROM SUPPLIER_ACCOUNT<br>
    WHERE SUPPLIER_CODE IN ('5771','5790','6436','8389','416')<br>
    AND COUNTRY_ID = 205 <br>
    AND ACCOUNT_NUMBER='891274')<br>
    AND COUNTRY_ID = 205; <br>
    Usually I get the results as <br>
    5678-<br>
    5789-<br>
    till dec 2006 But suddenly from Jan 2007 the order of the result is changed to <br>
    5789-<br>
    5678-.<br>
    There is also no change in data.<br>
    Can plz help me why the order changes? <br>
    Thanks for advace help

  • HT201272 My pay method has stopped working, so that now I can't purchase anything from my iPad anymore,even when there's money in my account. How do I resume using my pay method to purchase.

    My pay method has stopped working so that I can no longer purchase and/or download any apps or products onto my iPad. It is saying "there was a problem with a previous purchase. Use another pay method. What does this mean, and what do I do?
    Further, in my attempts to correct the situation, I reset my iPad, resulting in my losing all the apps that I downloaded, and all the products I had bought and downloaded. How do I recover all of them (magazines,  books, apps, etc).
    Please, help.
    Victor Kalala

    Look, I understand I still need a card attached to the account. The problem is, it won't accept my card because I only have 87 cents in my bank account right now.
    If I had known there would be so much trouble with the iTunes card, I would have just put the cash in my bank account in the morning instead of buying an iTunes card (I didn't expect the banks to be open on Thanksgiving of course).
    Apple will only accept cards that have a balance. The balance is so small in my account that it won't accept it as a valid card.
    I'm going to have to contact Apple anyway to reset the security questions. That's obvious. Your answers were not exactly helpful. You didn't tell me anything I don't already know, but thanks for trying to be helpful.

  • Why main() method has to be void in Java?

    According to the C++ creator Bjarne Stroustrup,
    The definition
            void main() { /* ... */ }
    is not and never has been C++, nor has it even been C.
    See the ISO C++ standard 3.6.1[2]
    Then if Java is developed from C, why the main() method has
    to be void like this:
    Public class JavaClass{
        Public static void main(String[] args){
    }

    First search the forums, you will find a huge thread on this.
    second, to be brief, in C and C++, you have primary thread and when main exits, the application terminates returning a value. e.g. when you do exit(0);
    In java, you could have secondary user-threads (not daemon threads) which you have started in your main and these continue to run even after the main method has exited. So returning a value would not make sense because your application has not terminated as there are still threads running.

  • I'm trying to purchase an app which only costs 0.69p, and it's saying my payment method has been declined. How can I resolve this?

    I have money in my bank, and I'm trying to purchase WhatsApp which is only 0.69p, it then said I need to verify my payment method by entering my bank details... So I did (correctly). It then said my payment method has been declined and to use a different payment method. I don't have another payment method and really need this app. How can I resolve this?

    It's now not letting me download free apps now

  • I am trying to purchase an app and update my apps all are free but it won't accept my security code, all itkeeps saying is that my payment method has been declined, I only have one card so can't try another

    I am trying to purchase an app and update my apps all are free but it won't accept my card, all it keeps saying is that my payment method has been declined, I only have one card so can't try another. Now I can't use some of my apps because they are waiting to be updated. Somebody please help!!

    Hello Sriggers,
    Welcome to the Apple Support Communities!
    I understand that you are attempting to update some applications on your iPhone but the payment method was declined. In this situation, I would recommend reading over the information in the attached article to help resolve the situation. 
    Pay an unpaid balance in the iTunes Store - Apple Support
    Best,
    Joe

  • How to tell how many times a method has executed?

    Hi, all
    I've got a main class (Model.java) that repeatedly calls a step() method in a sub class (Ocean.java). I want Ocean.java to execute its step() method following one set of rules for the first time it is called by Model.java, and a different set of rules for all executions 2++. I was just going to use an if/else in Ocean.java's step() method to make it switch based on a boolean haveIExecutedThisStepOnce, or something like that. Is there some way to tell Ocean.java how many times it has executed the step() method? I'm using the RePast code libraries; Model.java uses a method called getTickCount(). It returns a double value of number of times Model.java's step() method has been executed, in which Model.java tells Ocean.java to execute its step() method. Should I pry that getTickCount() value out of Model.java and get it over to Ocean.java's step() method--and if so, how? Or, is there a better way to do this that I'm not aware of?

    Why do you think that this field has to be public?
    Arguably if there's some functionality that is tightly associated with this counted method, then it should be part of the same class.
    Alternatively, think about the counting variable. It should be with the thing that uses it.
    So if class A wants to invoke class B method c once, do something else, and then invoke c some more, then that counting is really more an aspect of A than of B, and in that case the state should be in A. In that case the field really counts the number of times that A has invoked B.c, not the number of times that B.c has been invoked overall. Maybe that's what you want.
    On the other hand if you really want to count the number of times that B.c has been invoked overall, then it's an aspect of B (or more likely an instance of B). In that case, rather than expose the counting state and the counted method, it would probably be better to create a new method d(). d() would invoke c(), doing something extra depending on the counting state. Make c() private. Like this:
    class B {
      private boolean c_has_been_called = false;
      public void d() {
        c();
        if (!c_has_been_called) {
          doWhateverYouNeedInThisCase();
          c_has_been_called = true;
      private void c() {
        // and c() does whatever it normally does
    }

  • "Your payment method has expired" error message on a new card.

    Hey all, my debit card recently expired and so I wanted to update the details to my new one. Initially just changing the numbers and expiry date over just gave me the same "Your payment method has expired. Please enter valid payment method information." message. I erased all the card information so no card was tied to the account then tried to add my new debit card - However I am still getting this same message even though it clearly hasn't expired since the card is valid until 2015.
    Does anybody have any idea why this is happening?
    Thanks,
    R

    anastasia
    Contact the Store Group - Contact Us - Apple Support - this is an "iTunes"-ish URL but is all Stores & by definition all things 'Money"
    hope this helps
    CCC

  • I need to get photos off a water damaged iPhone 3GS. Can I take out the component that has the photos (is this the main board?) and put it into another of the same phone to retrieve the photos? Please help

    I need to get photos off a water damaged iPhone 3GS. It spent time underwater, saltwater. I let it dry for a week, turned it on, the apple symbol came on, then it died. I need to retrieve my photos off it. Can I take out the component that has the photos (is this the main board?) and put it into another of the same phone to retrieve the photos? Please help

    You're talking about the logic board. The two most likely things to get toasted, with water damage, are the battery(it shorts out), & the logic board. The worst water damage would be salt water. I'm afraid your logic board is toast.

  • Issue with "firstRecord" Business Component method of JAVA Data bean API.

    Hi,
    Following is my use-case scenario:
    I have to add or associate child MVG business component (CUT_Address)
    with the parent business component (Account) using JAVA Data bean API.
    My requirement is: first to check whether child business component(i.e. CUT_address) exists. If it exists then associate it with parent business component (Account)
    otherwise create new CUT_address and associate it with account.
    Code (using JAVA Data bean APIs) Goes as follows:
    SiebelBusObject sBusObj = connBean.getBusObject("Account");
    parentBusComp = sBusObj.getBusComp("Account");
    SiebelBusComp parentBusComp;
    SiebelBusComp childBusComp;
    // retrieve required account.. Please assume Account1 exists
    parentBusComp.activateField("Name");
    parentBusComp.clearToQuery();
    parentBusComp.setSearchSpec("Name", "Account1");
    sBusComp.executeQuery2(true, true);
    sBusComp.firstRecord();
    Counter = 0;
    while (counter < Number_Of_Child_Records_To_Insert)
    childBusComp = parentBusComp.getMVGBusComp("City");
    associatedChildBusComp = childBusComp.getAssocBusComp();
    childBusComp.activateField("City");
    childBusComp.clearToQuery();
    childBusComp.setSearchSpec("City", Vector_of_city[counter]);
    sBusComp.executeQuery2(true, true);
    if( sBusComp.firstRecord() )
    // Child already exist and do processing accordingly
    else
    // Child does not exist and do processing accordingly
    childBusComp.release();
    childBusComp = null;
    associatedChildBusComp.release();
    associatedChildBusComp=null;
    Now the issue with this code is: For the first iteration, SbusComp.firstRecord returns 0 if records does not exist. However from the second iteration, SbusComp.firstRecord returns 1 even if there is no record matching the search specification.
    Any input towards the issue is highly appreciable.
    Thanks,
    Rohit.

    Setting the view mode to "AllView" helped.
    Thanks for the lead!
    In the end, I also had to invoke the business component method SetAdminMode with "true" as the argument so that I could also modify the records from my script.

  • Create an Image Component that has a scale9Grid border

    Hello, I want to start the process of creating a custom Image
    Component that has a property of Scale9GridBorder, which upon
    setting, will use Scale9Grid to create a frame around an image. I
    was wondering if someone has any tips?
    I'm familiar with custom components, all written in
    Actionscript 3.0, and with the common createCHildren,
    commitPorperties, measure, updateDisplayLIst mehtods that Ill have
    to implement. I'm just not sure if classes like RectangleBorder,
    etc. will be of help for me.
    Maybe someone has already created a similar component?
    Thanks,
    Todd

    I guess, where I'm getting stuck is trying to use scale9Grid
    dynamically at runtime. Is this possible, or does scale9Grid only
    work with embeded images? (I can't find any samples of runtime
    setting a background image and then setting the innerRectangle of
    scale9Grid.
    THanks

Maybe you are looking for