Here are some more additinal examples regarding Beans / instantiating your own class. If you don't know what I am talking about you may want to read this article by SUN.
The file LogicSampleClass.php can be found (after import) in the folder .../components/com_moslate/includes/logic/ (there files with the same name as the class will be loaded dynamically)
(To use those, you need to import logic_export)
jsp:useBean
name(default:bean), class
|
name |
Sample Class | info |
i was running out of ideas |
|
{jsp:useBean id="bean" class="LogicSampleClass"/}
<table border="1">
<tr><th colspan="2">{c:out value="${bean}"/}</th></tr>
<tr><th colspan="2">{c:out value="${bean.name}"/}</th></tr>
{c:forEach items="${bean}" var="item" key="key"}
<tr><td>{c:out value="${key}"/}</td>
<td>{c:out value="${item}"/}</td></tr>
{/c:forEach}
</table>
|
jsp:setProperty
name, property, value(EL)
|
name |
Sample Class Now! | info |
i was running out of ideas | still |
no idea |
|
{jsp:setProperty name="bean" property="name" value="${bean.name} Now!"/}
{jsp:setProperty name="bean" property="still" value="no idea"/}
<table border="1">
<tr><th colspan="2">{c:out value="${bean}"/}</th></tr>
<tr><th colspan="2">{c:out value="${bean.name}"/}</th></tr>
{c:forEach items="${bean}" var="item" key="key"}
<tr><td>{c:out value="${key}"/}</td>
<td>{c:out value="${item}"/}</td></tr>
{/c:forEach}
</table>
|
jsp:getProperty
name, property
c:out
value(EL)
|
Sample Class Now! = Sample Class Now!
|
{jsp:getProperty name="bean" property="name"/} = {c:out value="${bean.name}"/}
|
function call
|
bean.pow(3,2)=9
|
{c:set var="base" value="3"/}
{c:set var="exp" value="2"/}
{c:out value="bean.pow(${base},${exp})=${bean.pow(base,exp)}"/}
|
|