Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can add all your beans from beans.xml to spring-servlet.xml by using import as below.</p> <pre><code>&lt;import resource="Beans.xml"/&gt; </code></pre> <p>also I recommend you to rename this file to some meaningful name - db-context.xml(or something similar).</p> <p>Also never use below code when you are using annotation configuration/ rather when your context is already built by spring mvc.</p> <pre><code>ApplicationContext context=new ClassPathXmlApplicationContext("Beans.xml"); </code></pre> <p>Instead use <code>@Autowired</code> annotation. You can also use <code>@Qualifier</code> annotation additionally to pick up correct bean. As below.</p> <pre><code>private DomainJDBCTemplate domainJDBCTemplate; @Autowired @Qualifier("studentJDBCTempate") public void setDomainJDBCTemplate(DomainJDBCTemplate domainJDBCTemplate) { this.domainJDBCTemplate = domainJDBCTemplate; } </code></pre> <p>And your request processing method should use this template directly without building context again(Its useless to build context every time you hit the url!!!!) as below.</p> <pre><code>@RequestMapping(value="/DomainEkle",method=RequestMethod.POST) public ModelAndView domain_eklendi_fonksiyon(@ModelAttribute("Domain")Domain domain, ModelMap model) { this.domainJDBCTemplate.listDomains(); model.addAttribute("domain", domain.getDomain_adi()); model.addAttribute("sunucu", domain.getSunucu_no()); model.addAttribute("tarih", domain.getTarih()); System.out.println(domain.getTarih()+"-"+domain.getDomain_adi()); String message="Domain Kaydi Yapilmistir!"; ModelAndView dm_eklendi=new ModelAndView("DomainEkle","message",message); return dm_eklendi; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload