[Opensource] Embed Java codes in jsp pages rather than using output?

a1 a1 innovest_11 at yahoo.com
Wed Aug 7 02:08:41 PDT 2002


hi all,

Would like to seek an opinion on using of Java codes
in jsp pages. Understand that many people think it is
bad design to put logic in jsp, but what happen if i
put presentation logic and not business logic in jsp?

Recently, started using Expresso and come across
output, inputs objects. Take a simple example:

In the Controller, I retrieved a record using Customer
DBOject:

Customer cust = new Customer();
cust.retrieve();

So after I retrieve, instead of putting the object
into various blocks and outputs, I put the cust in
request:

HttpServletRequest req =
(HttpServletRequest)((ServletControllerRequest)request).getServletRequest();
req.setAttribute("cust", cust);

then in the jsp, I take out "cust" from the request
object(have not tried and don't know how to take out
request object in JSP)

or rather I set the cust object in session object and
take it out in the JSP. Then in the JSP, I just:

<% Session session = getSession("true");
Customer cust = session.getAttribute("cust");
String custID = cust.getField("custID");
String custDesc = cust.getField("custDesc"); %>

I have tried using output and tag library to put cust
object into output object and block object, then in
JSP, I have nightmare when trying to take them out for
display in my JSP.

Any comments welcome.

innovest



__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



More information about the Opensource mailing list