J
js
Right now, I have Struts action classes doing the heavy lifting of
retrieving and saving objects into the database using hibernate.
These hibernate beans, plus the form object that is mapped to the action
class, are then available in the JSP page.
Question is, is it good practice to have hibernate beans on JSP pages ??
For example, in hibernate, a call such as:
<%= order.getClient().getName() %>
.... assuming using lazy loading, will cause a select on the client database
table to get the client's name for that order.
Is it bad practice to have that code in the JSP page ( because in the end,
it actually results in a database access in the JSP page ) ?
Is it better to actually to have that code in the struts action, and save
the name in an HttpRequest attribute ?, like so:
String clientName = order.getClient().getName();
httpRequest.setAttribute( "clientName", clientName );
<%= request.getAttribute( "clientName" ) %>
J
retrieving and saving objects into the database using hibernate.
These hibernate beans, plus the form object that is mapped to the action
class, are then available in the JSP page.
Question is, is it good practice to have hibernate beans on JSP pages ??
For example, in hibernate, a call such as:
<%= order.getClient().getName() %>
.... assuming using lazy loading, will cause a select on the client database
table to get the client's name for that order.
Is it bad practice to have that code in the JSP page ( because in the end,
it actually results in a database access in the JSP page ) ?
Is it better to actually to have that code in the struts action, and save
the name in an HttpRequest attribute ?, like so:
String clientName = order.getClient().getName();
httpRequest.setAttribute( "clientName", clientName );
<%= request.getAttribute( "clientName" ) %>
J