Announcement Announcement Module
Collapse
No announcement yet.
Plz provide solution for setting the object through IOC..No replies are cming Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Plz provide solution for setting the object through IOC..No replies are cming

    Unable to set the property from context.xml not creating the object in setters method
    Container is not reading the properties from the context.xml which I placed paralled to webinf and imported from applicationContext.xml.Seetters and getters are not cming.control in not cming to setters method of my class while deploying.even if I type the wrong class in xml container is not throwing any exceptions plz help.

    my context.xml

    <bean id="login" scope="prototype" class="com.fr.carrefour.portail.carburant.LoginAct ion">
    <property name="empService" ref="empLocal"></property>
    </bean>

    I imported it from applicationcontext.xml

    <import resource="actions-context.xml"/>

    the setters and getters in my class are

    private IEmployeeService empService;

    public IEmployeeService getEmpService() {
    return empService;
    }

    public void setEmpService(IEmployeeService empService) {
    this.empService = empService;
    }

  • #2
    For starters use [ code][/code ] tags when posting code.

    Next simply creating xml files, dropping them in the WEB-INF directory isn't going to get them loaded. Also next to that make sure you are using the beans defined in your context that you are not creating new instances. It appears as you are using struts, I suggest a read of the struts integration chapter of the reference guide.

    Comment


    • #3
      Dear martin when I used plugin
      I am getting plugin must be declared exception


      <action name="login" method="authenticate"
      class="com.fr.carrefour.portail.carburant.LoginAct ion">
      <result name="success">/CarburantPortailHome.jsp</result>
      <result name="error">/login.jsp</result>
      <result name="input">/login.jsp</result>

      </action>



      <plug-in className="org.springframework.web.struts.ContextL oaderPlugIn">
      <set-property property="contextConfigLocation"
      value="/WEB-INF/applicationContext.xml"/>
      </plug-in>

      org.xml.sax.SAXParseException: Element type "plug-in" must be declared.

      Comment


      • #4
        Please [ code][/code ] tags exist for a reason ...

        Which struts version are you using (and please read the struts configuration guide).

        Comment


        • #5
          I am using struts2.0

          Comment


          • #6
            Struts 2.0 has its own integration (the spring stuff is for 1.x)... So I suggest reading the struts documentation on how to use spring with struts 2.

            Comment


            • #7
              Hi martyn thanx for ur reply.I solved the issue .

              Comment

              Working...
              X