How can I get the ino:id value of the current document in JS

X-Application Version: 3.1.3
Tamino Version : 3.1.1
Platform : NT
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

Hi,

I used X-Application to generate JSP pages for a collection in a Tamino database. Now I want to get the ino:id attribute value of the “current” document through JSP pages.

For example, when a user tries to access a document in the JSP pages, my system needs to get the ino:id value of the document and it will be for checking whether the document is accessible for the user.

I think I need to do so for all JSP pages including Create.jsp, View.jsp, Modify.jsp and Delete.jsp.

Can anyone help me? Please give me some sample codes. Thanks a lot.

Andy

Hello Andy,

did you recognize the $ID value for the select attribute? See documentation (tag reference display-tag):



Regards, Harald

Hi,

I know that I can use the display tag to get the ino:id value… However, as I mentioned that I need to get the value for checking the access right of users on particular documents.

So, I think I need to store the ino:id value into a variable in scriptlet and then I can use it to check right access…

How do I store the $ID value into a variable in scriptlet?

Please help me. Thanks a lot

Andy

Hello,

you can access to the ID within a scriptlet code of a JSP with the following code:

<%@ page import="com.softwareag.xtools.xapplication.jsp.*" %>
<%@ page import="com.softwareag.xtools.xapplication.businessdocument.*" %>
...
<%
  String docName = "name of your document";
  SessionContext sessionContext = ServletSessionContext.getSessionContext(pageContext);
  BusinessDocument document = sessionContext.getDocument(docName);
  String docId = document.getId();
%>
...



Instead of scriptlet code, I would use a plugin which checks the ID. Create your own action, e.g. “checkDocId” and invoke this action by a directcommand at the beginning of the page.

<xapp:directcommand type=“checkDocId” … />

You can invoke this action within different pages and don’t have to copy the same code for each page where you want to apply the check. This makes your application easier to maintain.

Bye,
Christian.