facebook

Problems with my own webflow diagram

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #319213 Reply

    Greg Soulsby
    Member

    My first proprietary webflow diagram is having problems.

    Firstly, my on-render
    <on-render>
    <evaluate expression=”zzz_page.getPage(requestParameters.p, requestParameters.b)” result=”viewScope.zzz_page” result-type=””/>
    </on-render>

    is only working if I declare the var
    <var class=”c027.service.zzz_page” name=”zzz_page”/>

    If I dont, I get a no such method error.

    java.lang.NoSuchMethodException: getPage(null, null)

    Secondly, perhaps related, the requestParameters, both of them, are returning nulls.

    The scafolded webflows are working great, non of them having either problem.

    I must be missing something simple, which means I have no hope of finding it.

    Here is the full flow.xml

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <flow xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns=”http://www.springframework.org/schema/webflow&#8221; xsi:schemaLocation=”http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd”&gt;
    <var class=”c027.service.zzz_page” name=”zzz_page”/>
    <view-state id=”home”>
    <on-render>
    <evaluate expression=”zzz_page.getPage(requestParameters.p, requestParameters.b)” result=”viewScope.zzz_page” result-type=””/>
    </on-render>
    <transition on=”toUsers” to=”users”/>
    </view-state>
    <view-state id=”users” redirect=”false”>
    <transition on=”toHome” to=”home”/>
    </view-state>
    </flow>

    #319275 Reply

    jayperkins
    Member

    Hi,

    When your expression is something like
    zzz_page.getPage()

    Webflow is expecting to find something named zzz_page on which it can call the method. That can be a variable you define in the webflow, or a bean defined in your config files or by a spring annotation, etc. I wouldn’t expect a NoSuchMethodException if webflow could not find something with that name so I am not sure why you get the NoSuchMethodException if you don’t define the variable. In any event, it might be helpful to understand what you are trying to accomplish so that I may provide further guidance.

    In on-render you cannot get access to the request parameters due to the post-redirect-get (the rendering is a different request). So either get them in a transition and store them in view/flow scope or use the on-entry tag to do that.

    Jay

    #319489 Reply

    Greg Soulsby
    Member

    Ok, thanks, using on-entry fixed my variables being null.

    The issue with the “no such method” seems to stem from the fact that if its class is a variable of the flow then it is instantiated at the start of the flow because I see the constructor run. Otherwise it is not initialised and there is no such method.

    The class is annotated with @Service and @Transactional. It is in the same directory as the scaffolded service classes.

    So why do scaffolded class not need to be variables and my class does?

    #319509 Reply

    jayperkins
    Member

    That should work, as long as your class is annotated as follows:


    @Service
    (“zzz_page”)

    The problem may be that in your <evaluate> tag, you are assigning the result of your call to getPage() to the zzz_page variable. What is the result of this call? You could be effectively hiding your service named zzz_page.

    #319523 Reply

    Greg Soulsby
    Member

    Definitely have @Service(“zzz_page”) . Also @Transactional

    Tried changing the name of the variable, so the variable name and the class name are different, but still got the no such method when I take out the var declaration.

    <var class=”c027.service.zzz_page” name=”zzz_page”/>
    <view-state id=”home”>
    <on-entry>
    <evaluate expression=”zzz_page.getPage(requestParameters.p, requestParameters.b)” result=”viewScope.zzz_page_result” result-type=””/>
    </on-entry>
    <transition on=”toUsers” to=”users”/>
    </view-state>

    Not sure if this is related but it reminds me of another issue I have, in that when I try @autowire one of my own classes I only ever get a null but when I @autowire a scafolded class it set it up correctly. Could I be missing something in the set up of my proprietary classes?

    #319527 Reply

    jayperkins
    Member

    Would it be possible for you to send me your project?

    If so, please send it to:
    jperkins@skywaysoftware.com

    #319552 Reply

    jayperkins
    Member

    The zzz_page service is being created as a jdk proxy due to this configuration setting:

    <context:component-scan base-package=”c027.service” scoped-proxy=”interfaces” />

    Because the zzz_page service does not implement an interface that defines a getPage method, the webflow cannot find that method because it is looking for the method on the proxy and not the actual instance.

    Create an interface that defines the methods that you want to call and have the zzz_page class implement that interface.

    #319598 Reply

    Greg Soulsby
    Member

    Ok, working now, many thanks – the chances of me finding that are number asymptoting to zero.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Problems with my own webflow diagram

You must be logged in to post in the forum log in