Announcement Announcement Module
Collapse
No announcement yet.
requestContext add as property in a bean class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 02:33 AM.

  • #2
    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.

    Comment


    • #3
      This is what I'am looking for... thanks Sir.

      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

      Comment


      • #4
        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.


        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.

        Comment


        • #5
          I would like to get the

          org.springframework.webflow.execution.RequestConte xt

          within my controller.

          any hints please..
          thanks

          eros

          Comment


          • #6
            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

            Comment


            • #7
              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..

              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

              Comment


              • #8
                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!

                Comment


                • #9
                  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, 07:32 PM.

                  Comment

                  Working...
                  X