title: How to autowired spring service into a jsp?
body: <p>As mentioned in the title, i need to autowire a service in my page.jsp..
  "<em>i know that's not recommended to do it</em> "</p>
  
  <pre><code>    &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
  
  
  &lt;%@ page import="org.springframework.context.ApplicationContext"%&gt;
  &lt;%@ page
      import="org.springframework.web.servlet.support.RequestContextUtils"%&gt;
  
  &lt;%@ page import="com.fussa.fyby.service.Test"%&gt;
  &lt;%@ page import="com.fussa.fyby.model.PIL_P_APPLCTN"%&gt;
  
  
  &lt;%
      ApplicationContext ac = RequestContextUtils.getWebApplicationContext(request);
      Test s = (Test) ac.getBean("fussafyby");
      PIL_P_APPLCTN app = s.getByKey(13);
  %&gt;
  
  
  &lt;c:out value="azeerty"&gt;&lt;/c:out&gt;
  
  &lt;c:out value="${ app.APPLCTN_CD }"&gt;&lt;/c:out&gt;
  
  &lt;select name="listeGroupes" id="listeGroupes"&gt;
  
      &lt;option value="123"&gt;123&lt;/option&gt;
  
      &lt;option value="${ app.APPLCTN_CD }"&gt;${ app.APPLCTN_CD }&lt;/option&gt;
      &lt;option value="123"&gt;${ s.afficher() }&lt;/option&gt;
  
  &lt;/select&gt;
  </code></pre>
  
  <p>My service:</p>
  
  <pre><code>@Component("fussafyby")
  @Transactional
  public class Test {
  
      @Autowired
      private SessionFactory sessionFactory;
  
      protected Session getSession() {
          return sessionFactory.getCurrentSession();
      }
  
      public PIL_P_APPLCTN getByKey(int key) {
          return (PIL_P_APPLCTN) getSession().get(PIL_P_APPLCTN.class, key);
      }
  
  
  
      public String affiche() {
          return "FuSsA";
      }
  }
  </code></pre>
  
  <p>Only <em>azeerty</em> message and <em>123</em> option in the select are shown..</p>
  
  <p>Thanks for any advices..</p>