ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tuvok <test.subject...@gmail.com>
Subject accessing context from service
Date Thu, 10 Nov 2011 12:23:49 GMT
Hi, 

I have a screen in wich I set some variables:

<screen name="myScreen">
	<section>
		<actions>
			*<set field="myVariable" value="test_value" to-scope="user"
global="true"/>*
		</actions>
		<section>
			<widgets>
				<include-form location="component://myExample/widget/Forms.xml"
name="myForm"/>
			</widgets>
		</section>
	</section>
</screen>

and if I understand the field *myVariable* is accessible in context, but
when I want to retrieve *myVariable* from service *myJavaService* using*
context.get("myVariable")* I got null. Is it possible to access such a
variable from my service and how?

Form *myForm*:

<form name="myForm" type="single" target="submitMyForm">
	<field name="param_1"><text/></field>
	<field name="param_2"><text/></field>
	<field name="Do something"><submit/></field>		
</form>

*controller.xml*:

<request-map uri="submitMyForm">
	<security https="true" auth="true"/>
	<event type="service" path="org.ofbiz.myApplication"
invoke="myJavaService"/>
	<response name="success" type="view" value="myScreen"/>
</request-map>

*Service definition*:

 public static Map<String, Object> myJavaService(DispatchContext ctx,
Map<String, Object> context) {
	Map<String, Object> result = FastMap.newInstance();
	Delegator delegator = ctx.getDelegator();
	*Map<String, Object> myVariable= (Map<String, Object>)
context.get("myVariable");*
	return result;
}


--
View this message in context: http://ofbiz.135035.n4.nabble.com/accessing-context-from-service-tp4023436p4023436.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Mime
View raw message