Search code examples
javaservletsjxlofbiz

how to properly call a java function from a ftl file in ofbiz?


I think I have already done the necessary splicing for me to allow the gui to invoke a java method.

This is my ftl file where the process should start, this is on a widget screens xml file and it is properly displaying the contents but i'm just not sure of the parameters that I used here to do a proper call to the java class

<form action="<@ofbizUrl>methodToInvoke</@ofbizUrl>" method="POST">
    <input type="submit" value="id"></input>
    <input type="text" name="input"></input>
</form>

and this is the code on my controller

<request-map uri="methodToInvoke">
    <security https="true" auth="true"/>
    <event type="java" path="com.report.SomeClass" invoke="methodToInvoke"/>
    <response name="success" type="view" value="reports" />
    <response name="error" type="view" value="reports" />
</request-map>

When I run the application and I hit the button, the address on my browser looks to be trying to call the method but nothing seems to happen. it should download a file to the user and I have already done the setup on the java method such as the reponse headers and the file that needs to be written on it.

When I click on it it does not really do anything and it just goes back to the same page.


Solution

  • I was not able to build the buildfile of the applcation SPECIFICALLY because I was just using the build.xml for the whole ofbiz and that does not seem to update the modifications on the application that I am using.

    After doing that, the changes that I made on the java class worked