I am trying to access a database in servlet (known as BeerSelect" and sending it to a bean (known as "Counter") to set its property. Then I tried to display this propert in the jsp but nothing is coming up, its blank. Am i doing something wrong or its not possible this way.
hi shariff khan(saf kan) first problem is you need to set ResultSet cursor to next position to access ResultSet.. rs.next(); // added c.setName(rs.getString("place")); request.setAttribute("person",c);
problem2 Counter c = new Counter();// you have created new instance of Counter here then request.setAttribute("person",c); // you saved this instance in request scope.
but never retrieved it in your jsp like <% request.getAttribute("person"); %>
btw <jsp:useBean id="person" class="com.example.Counter" scope="request" /> person is <jsp:getProperty name="person" property="name" />
server creates new instance of Counter from the above codes.