I have an app build with joy-5.0.13 where I cannot send some variable value to the template to be rendered on screen. I'm sure its something simple that I'm missing right now.
This is my action:
@MadvocAction
public class IndexAction {
@PetiteInject
private TemperatureService temperatureService;
@Out
List<TemperatureLog> temps;
@Action
public void view() {
temps = temperatureService.getLastHoutTemperatures();
System.out.println(temps);
}
and this is the file called index.jsp
<%@ taglib prefix="j" uri="/jodd" %>
<html>
<head>
<title>SmartHome</title>
</head>
<body>
<j:iter items="${temps}" var="tl">
${tl.temperature}<br/>
</j:iter>
</body>
</html>
and here it is the log from the console:
80281 [DEBUG] j.m.c.MadvocController.invoke:102 - Action path: GET /index
80281 [DEBUG] j.m.c.MadvocController.invoke:125 - Invoke action for '/index' using ro.videanuadrian.sh.action.IndexAction#view
80291 [DEBUG] j.j.i.LocalizationUtil.setRequestBundleName:78 - Bundle name for this request: ro.videanuadrian.sh.action.IndexAction
80297 [DEBUG] j.j.JtxTransactionManager.requestTransaction:272 - Requesting TX jtx{Required,readonly,Read Committed,-1}
80299 [DEBUG] j.j.JtxTransaction.<init>:102 - New JTX {status:Active, mode:jtx{Required,readonly,Read Committed,-1}}
80321 [DEBUG] j.d.j.DbJtxSessionProvider.getDbSession:57 - Requesting db TX manager session
80322 [DEBUG] j.d.DbSession.<init>:60 - Creating new db session
80323 [DEBUG] j.d.j.DbJtxResourceManager.beginTransaction:71 - begin jtx
80325 [DEBUG] j.d.DbSession.beginTransaction:242 - Beginning transaction
80325 [DEBUG] j.d.p.CoreConnectionPool.getConnection:256 - Returning valid pooled connection
80443 [DEBUG] j.d.DbQueryBase.execute:686 - Executing statement: SELECT tt.id, tt.sensor_id, tt.temperature, tt.timestamp FROM sh_temperature_log tt WHERE tt.timestamp>1577460508000 ORDER BY tt.id ASC
80503 [DEBUG] j.d.DbQueryBase.execute:704 - execution time: 70ms
80526 [DEBUG] j.j.w.LeanJtxWorker.maybeCommitTransaction:93 - commit tx
80526 [DEBUG] j.j.JtxTransaction.commitOrRollback:255 - Commit JTX
80526 [DEBUG] j.d.j.DbJtxResourceManager.commitTransaction:83 - commit jtx
80526 [DEBUG] j.d.DbSession.commitTransaction:254 - Committing transaction
80614 [DEBUG] j.d.DbSession.closeSession:84 - Closing db session
[TemperatureLog [sensorId=1, timestamp=1577535822000, temperature=23.0], TemperatureLog [sensorId=1, timestamp=1577535826000, temperature=24.0], TemperatureLog [sensorId=1, timestamp=1577535829000, temperature=25.0], TemperatureLog [sensorId=1, timestamp=1577535844000, temperature=26.5]]
80623 [DEBUG] j.m.c.MadvocController.render:202 - Result type: ServletDispatcherActionResult
80623 [DEBUG] j.m.r.AbstractTemplateViewActionResult.render:91 - new target: /index:
80623 [DEBUG] j.m.r.ServletDispatcherActionResult.targetExists:105 - target check: /index.jspf
80624 [DEBUG] j.m.r.ServletDispatcherActionResult.targetExists:105 - target check: /index.jsp
80625 [DEBUG] j.m.r.AbstractTemplateViewActionResult.render:102 - target found: /index.jsp
but in the view I only get: ${tl.temperature}
it's like the result it's not reaching the view engine. I've made some debug and it seems that the actionResult is null.
Any idea what I`m doing wrong?
Thanks
P.S. I have tried the toturial and I have the same issue:
Messages
${msg.messageId} ${msg.text}
${resp.responseId} ${resp.text}
new message...
REST APi: message 1
that is the output that I have