Announcement Announcement Module
Collapse
No announcement yet.
Several newbie questions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Several newbie questions

    Hello,

    I have several questions. Maybe someone can help.

    1. I have moved a form validator from the servlet.xml to the applicationContext.xml. Since, as I understood the documentation, the applicationContext.xml is used for configuration, if it exists, the validator should be available to the servlet context. However the validator bean is not available to the controller. Is there anything I am missing?

    2. How do I bind the command properties after onSubmit() in SimpleFormController?

    I want to show the data to user again, after it was entered.

    I coded this im my extension of SimpleFormController:

    public final ModelAndView onSubmit(Object command) throws ServletException
    {
    return new ModelAndView(new RedirectView(getSuccessView()),"node", command);
    }

    Strangely enough, what happens is that the classpath is bein set as an URL-parameter:
    view.form?node=de.galt.sltreeng.NodeBean%401ec58a

    3. Is facade just another expression for delegate?

    Any help and answer is very much appreciated.

    Greetings

    Michael Kastner

  • #2
    I have moved a form validator from the servlet.xml to the applicationContext.xml...the validator bean is not available to the controller
    Make sure you're not using local references (<ref local="myValidator"/>)

    I want to show the data to user again, after it was entered.
    Use showForm

    Comment


    • #3
      Originally posted by katentim
      Splendid, it works!

      Now, with the validator I am still stuck. Here's the entry I in the applicationContext.xml:

      <beans>
      <bean id="nodeFormValidator"
      class="de.galt.sltreeng.validators.NodeFormValidat or"/>
      </beans>

      and here's how I inject it to the form bean:

      <property name="validator">
      <ref bean="nodeFormValidator"/>
      </property>

      I am using the bean attribute in the validator reference. So, it should get the validator from the context. But I get the following error message:

      Context initialization failed
      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'formController' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Can't resolve reference to bean 'nodeFormValidator' while setting property 'validator'; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'nodeFormValidator' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [urlMapping,formController,messageSource,velocityCo nfig,viewResolver]; root of BeanFactory hierarchy
      org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'nodeFormValidator' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [urlMapping,formController,messageSource,velocityCo nfig,viewResolver]; root of BeanFactory hierarchy

      Comment


      • #4
        Make sure that the application knows to load your applicationContext.xml.
        You have to use ContextLoaderListener or org.springframework.web.context.ContextLoaderServl et Servlet for that depending on your server.

        Comment

        Working...
        X