Using a Javabean value in a directelementaction

X-Application Version: 4.1.1
Tamino Version : 4.1.1
Platform : Win2k
WebContainer : Tomcat 4.1.1
JDK Version : 1.4.1, 1.3.1

I’m trying to use a value from a javabean as the arg in directelementaction, but it’s not translating the value – it’s setting the element to the literal string. Any ideas how to do this?

<%
util.UniqueId uid = bean_UniqueId.getInstance();
String id = uid.getIdentifierString();
out.print(“UID = " + id);
%>
<xapp:directelementaction type=“setValue” select=”/CapabilityType/@id" arg=“<%out.print(id);%>”>
</xapp:directelementaction>

Sets the value to: “<%out.print(id);%>”

JSP does not evaluate <% … …%> stuff within attribute values.

What you could do is: directly modify the document in your scriptlet. The following
code should do so:

Add

<%@ page import=“com.softwareag.xtools.xapplication.jsp." %>
<%@ page import="com.softwareag.xtools.xapplication.businessdocument.
” %>

at the top of your page.
And modify your scriptlet as follows:

<%
<compute ‘id’ like before>;

SessionContext sc = ServletSessionContext.getSessionContext(pageContext);
BusinessDocument doc = sc.getDocument(“yourDocName”);
doc.selectAttribute(“/CapabilityType/@id”).setValue(id);
%>

Make sure to adjust “yourDocName” to the document name you used in your jsp page.

Michael

Software AG Germany, Darmstadt