Domanda

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.

È stato utile?

Soluzione 2

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

Altri suggerimenti

With ofbiz controllers, you can send back response in two ways:

  1. Preffered more common way: in your java event you call some services, or do some processing, then you the result of the processing a request attribute, and then render these attributes in the view. As you can see, your controller points to a view.
  2. This is less common case, when you need to send to the user some data, which cannot be rendered in the view, in that case, you manually write the data in the response object, and the close the reponse stream. I assume you are doing exactly that. In that case you should not return a view in your controller, because you already have written the data and hopefully closed the response stream. So just change your controller to this:
<response name="success" type="none" />
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top