|
![]() |
<%=rs.getString(1)%> | <%=rs.getString(2)%> | <% } %>
Subir Mukherjee wrote:Hi:
I have created the following database access bean:
/* Start of Database access Java Bean */
/* End of Database access Java Bean */
I have been able to compile the above java bean without problem. And now I would like to reference this bean inside of a JSP page so that I do not have to write the JDBC connection code into every JSP page that I create (my aim is to have a clean JSP page devoid of much java scripting logic.)
I tried to create the following JSP page to refernce the above bean but am not able to retrieve an data - get a 500 internal server error.
/* Start of JSP page that calls above Java Bean */
/* End of JSP page that calls above Java Bean */
Appreciate any help to resolve this issue please.
Thank you
Subir
~ Happy coding ~
vikhyath reddy wrote:You cannot directly access rs.next() without calling a call to the method in bean . Instead try calling any method in the bean . Just by involving the useBean tag doesn't give you the beans methods (its not some kind of an import ) . call some method in the bean --- <% beanId_Name.method(); %> will give you the access to the method ....
~ Happy coding ~
vikhyath reddy wrote:So instead try including the jdbc code within the jsp page ...
~ Happy coding ~
Yeah, I thought it came out too harsh and that was not my intention. Yes, these forums are for everyone, but it's important to make sure that the advice given represents best practices. If advice is given that will cause someone to head down the road of poor practices you can expect for it to be corrected.vikhyath reddy wrote:looks like you have changed your post ...
Led Estonilo wrote:ok so the best way now is to use JSTL / EL ?
Are you okay? You look a little big. Maybe this tiny ad will help:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|