Results 1 to 9 of 9

Thread: requestContext add as property in a bean class

  1. #1
    Join Date
    Oct 2008
    Posts
    286

    Default requestContext add as property in a bean class

    Please give me hints if it is possible?

    org.springframework.webflow.execution.RequestConte xt add as <property> in Ajax Controller bean to access the flowScope?

    e.g. SearchController class inherits the org.springframework.web.servlet.mvc.SimpleFormCont roller
    Code:
        <bean name="searchAjaxController" class="com.company.controller.SearchController">
    		<property name="propertyEditorRegistrars">
                <list>
                    <ref bean="customEditorRegistrar"/>
                </list>
            </property>
            <property name="searchService" ref="searchService" />
            <property name="requestContext">
            	<bean class="org.springframework.webflow.execution.RequestContext"/>
            </property>
        </bean>
    the above statement, gives me an error because the RequestContext is an Interface.

    please guide me on how to access the flowScope inside the Ajax Controller.
    Last edited by eros; Dec 2nd, 2009 at 01:33 AM.

  2. #2
    Join Date
    Nov 2008
    Posts
    742

    Default

    I don't think you'll need a property for this. You can get it in your code through a static method in the RequestContextHolder:

    Code:
    RequestContext context = RequestContextHolder.getRequestContext();
    I wouldn't recommend saving it as an instance variable. When you need the context, grab it from the holder.

  3. #3
    Join Date
    Oct 2008
    Posts
    286

    Default

    This is what I'am looking for... thanks Sir.

    Quote Originally Posted by InverseFalcon View Post
    I don't think you'll need a property for this. You can get it in your code through a static method in the RequestContextHolder:

    Code:
    RequestContext context = RequestContextHolder.getRequestContext();
    I wouldn't recommend saving it as an instance variable. When you need the context, grab it from the holder.
    It's to difficult to find out that static method to retrieve the requestContext by myself...

    thread solved

  4. #4
    Join Date
    Oct 2008
    Posts
    286

    Default

    oh sorry. I was wrong. I assumed that getRequestContext method is existing but it is not.

    import org.springframework.web.context.request.RequestCon textHolder

    RequestContextHolder.getRequestContext() <- is not exist.


    Quote Originally Posted by InverseFalcon View Post
    I don't think you'll need a property for this. You can get it in your code through a static method in the RequestContextHolder:

    Code:
    RequestContext context = RequestContextHolder.getRequestContext();
    I wouldn't recommend saving it as an instance variable. When you need the context, grab it from the holder.
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  5. #5
    Join Date
    Oct 2008
    Posts
    286

    Default

    I would like to get the

    org.springframework.webflow.execution.RequestConte xt

    within my controller.

    any hints please..
    thanks

    eros
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  6. #6
    Join Date
    Nov 2008
    Posts
    742

    Default

    Looks like you imported the wrong RequestContextHolder. It's kind of confusing, since a class of the same name shows up in both the Spring classes and the SWF classes.

    Here's the fully qualified name of the class you should import:
    org.springframework.webflow.execution.RequestConte xtHolder

  7. #7
    Join Date
    Oct 2008
    Posts
    286

    Default

    I forgot to include my environment.

    I am using the following:
    JSP 2.0
    Spring MVC 2.5.2
    SWF 1.0.5
    Tiles 2

    It seems that the below package doesn't exist..

    Quote Originally Posted by InverseFalcon View Post
    Looks like you imported the wrong RequestContextHolder. It's kind of confusing, since a class of the same name shows up in both the Spring classes and the SWF classes.

    Here's the fully qualified name of the class you should import:
    org.springframework.webflow.execution.RequestConte xtHolder
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  8. #8
    Join Date
    Nov 2008
    Posts
    742

    Default

    Okay, that explains it. Didn't realize you were using SWF 1.0.x. I only have experience with SWF 2.0.x, so I won't be able to be of much help. Sorry!

  9. #9
    Join Date
    Oct 2008
    Posts
    286

    Default

    Thanks a lot Sir. Actually, I tried to upgrade to SWF2.0.x but after 7 days, unsuccessful to upgrade, maybe due to lack of fundamental experience because just started to use the SWF1.0.x this past few weeks.

    Will take this opportunity to beg on your precious time to assist me to upgrade my sample search jsp page to 2.0.x...
    My goal is to do the search and display the result in a grid without refreshing the page..
    I'm able to do that with Ajax but the result is not included to my FormObject.
    That's why I do the search again and again to print out the same result to PDF file.
    But the goal is to use the previous searched result.

    My apology for the hassles.
    Last edited by eros; Dec 2nd, 2009 at 06:32 PM.
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •