A
A
Anatoly2016-08-18 15:47:13
Java
Anatoly, 2016-08-18 15:47:13

Difference in java ee between inject in a class and using jsp:useBean?

Hello everyone, can you tell me what is the difference in use? The result is still the same, only if you pass it from the servlet via session.setAttribute () or pass the class directly to jsp

@Inject
    @Default
    private Cities cities;// просто хранит массив


<c:forEach var="step" items="${sessionScope.cities}">
    <p>  ${step} </p>
</c:forEach>


<jsp:useBean id="cities" class="service.Cities">
    <c:forEach var="city" items="#{cities.cities}">
        ${city}
    </c:forEach>
</jsp:useBean>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question