Performing Addition using X-application

Hey all…

I would like to find out how I can perform Addition using X-application with Checkboxes.
In my project, I have a car database each of which have a set of fixed accessories. What I need to do is to have all the accessories assigned with a checkbox and when the user checks it, the cost of the accessory gets stored. When the user checks another one, the current cost will be added to the previously marked one and so on…And finally when the user clicks on Calculate total cost, it generates the entire cost for the car along with the accessories.
Is there any way this can be acheived using X-application or is coding in Java Server Pages required? If not, then can someone tell me what to do?

X-Application Version: 3.1.2, 3.1.1
Tamino Version : 3.1.1
Platform : NT, Win2k, Solaris, …
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

sounds like client side solution use javascript/vbscript to do this.


Hello Parth,

currently, we have not planned the support for checkboxes within the Tag Library of X-Application. Perhaps, it will be a solution when we support data types. Then, for Boolean types the edit tag could create a checkbox by default.

However, for your use case, this solution would not be sufficient. What you need is the evaluation of the checkbox values combined with a application-specific modification on your document(s). For the current version 3.1.2 of X-Application, the only solution I can propose is to use Scriptlets: embedded Java Code within the page which is invoked when the user sends the form with the check boxes.

Within the Scriptlets

  • access the standard request object of JSP pages to extract the checkbox parameter,
  • access the sessionContext object (see changelog.txt of your X-Application directory for an example)
  • access your document:
    BusinessDocument doc = sessionContext.getWorkspace().lookup(?the name of the document?);
  • set the values depending on checkbox parameters

    doc.getDescendant(?path to an acessory?).setValue(?accessory price?);

Use also Scriptlet code

  • to calculate the sum.
  • when you have to fill the checkbox

For the next version 3.1.3 of X-Application, we support a plugin mechanisms. Then, the calculation of the sum can be invoked by an element action and the code is part of a java classes you implement for your business logic.

For the checkbox evaluation, I don?t know if it?s possible to deliver a plugin which could support you. It would be interesting for us, when you could sent us your schema and the JSP page containing the checkboxes. Then, we could try out the implementation of checkbox evaluation via plugin and give some hints about this topic.

Many thanks,

Dear Christian,

many thanks for the suggestion. However I still have a few doubts. When I generate the Jsp page which has all my checkboxes, there is no way that I can assign to them a variable is there? like in servlets… where I give each checkbox name= " " and value = " " . Can I do this here?
Also once thats done I will simply write a servlet that will accept the parameters , but how will it know which accessory i am choosing… since all this has to be dynamic.
Please can u give me an algorithmic solution?
Many thanks,

Hello Parth,

I have attached two pages you can copy into the directory of your X-Application simple examples


After starting Tomcat, you can invoke the first page with


The example lists fifteen Properties. From this set you can select properties (! checkbox). The price of the selected properties is added on the following page (! Scriptlet Code).

I hope, this example gives a hint how you could implement your application logic.

For more support, I need your schema and your JSPs.

Christian. (2.44 KB)

There is another method.
1-) if your are difficulties creating dynamic context checkbox you can build a javascript function on servelet side(javascript source generation). So you can use function where you want on JSP side. It is better way than to create spaghetti.

2-) If you are using xapplication;

on servelet side
extend edit tag and use bodycontent.

BodyContent body = getBodyContent();
String bodyContentStr=body.getString();
then parse the string and use your setter methods.

on JSP side

use your new edit tag with body . of coure you will use javascript function on body.

Be careful about setter methods of your new edit tag.


Hello Christian,
here are the jsps & schemas of the project. We havent yet made the checkboxes page yet, but we will implement the idea that you gave us. (9.64 KB)