aspose file tools*
The moose likes JSP and the fly likes jsp:useBean and jsp:setProperty action tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:useBean and jsp:setProperty action tag" Watch "jsp:useBean and jsp:setProperty action tag" New topic
Author

jsp:useBean and jsp:setProperty action tag

Madhawi Maurya
Ranch Hand

Joined: Aug 22, 2007
Posts: 42
how can we use the following scriptlet statements as jsp action tag,
jsp:useBean and jsp:setProperty.

<%
List<TransactionReportValue> transactionList = (List<TransactionReportValue>)request.getAttribute("reportListInfo");
TransactionReportValue transactionRepVal = transactionList.get(0);
%>


SCJP1.5 with 90%
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The jsp:setProperty and jsp:getProperty tags (which are somewhat obsolete these days) were not meant to do things like that.

If you're building your pages with scriptlets, (also obsolete and considered a poor practice), there is no need for those tags, you can use Java syntax to set and get bean properties.

Those tags, like their their successors (EL and JSTL), are meant for working with scriptless JSPs. Scriptless JSPs are those which do nothing but mark up the results of requests that were processed by servlets, and Java objects in an Model, View, Controller architecture (MVC). Mixing scriptlets and any of the technologies mentioned above does nothing to improve the quality of your JSPs and is worse than using pure scriptlets.

Pick a boat and keep both feet in it.
[ January 17, 2008: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jsp:useBean and jsp:setProperty action tag