XSLT - How to pass a Java object to the xslt file ?
Hi ,
I need help in , How to pass a java object to xslt file.
I am using javax.xml.transform.Tranformer class to for the xsl tranformation. I need to pass a java object eg
Class Employee {
private String name;
private int empId;
public String getName() {
return this.name;
public String getEmpId() {
return this.empId;
public String setName(String name) {
this.name = name;
public String setEmpId(int empId){
this.empId = empId;
How can i access this complete object in the xsl file ? is there any way i can pass custom objects to xsl using Transformer class ?
This is elementary. Did you ask google ? http://www.google.com/search?q=calling+java+from+xsl
ram.
Similar Messages
-
How can I write new objects to the existing file with already written objec
Hi,
I've got a problem in my app.
Namely, my app stores data as objects written to the files. Everything is OK, when I write some data (objects of a class defined by me) to the file (by using writeObject method from ObjectOutputStream) and then I'm reading it sequencially by the corresponding readObject method (from ObjectInputStream).
Problems start when I add new objects to the already existing file (to the end of this file). Then, when I'm trying to read newly written data, I get an exception:
java.io.StreamCorruptedException
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
Is there any method to avoid corrupting the stream? Maybe it is a silly problem, but I really can't cope with it! How can I write new objects to the existing file with already written objects?
If anyone of you know something about this issue, please help!
JaiHere is a piece of sample codes. You can save the bytes read from the object by invoking save(byte[] b), and load the last inserted object by invoking load.
* Created on 2004-12-23
package com.cpic.msgbus.monitor.util.cachequeue;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
* @author elgs This is a very high performance implemention of Cache.
public class StackCache implements Cache
protected long seed = 0;
protected RandomAccessFile raf;
protected int count;
protected String cacheDeviceName;
protected Adapter adapter;
protected long pointer = 0;
protected File f;
public StackCache(String name) throws IOException
cacheDeviceName = name;
f = new File(Const.cacheHome + name);
raf = new RandomAccessFile(f, "rw");
if (raf.length() == 0)
raf.writeLong(0L);
* Whne the cache file is getting large in size and may there be fragments,
* we should do a shrink.
public synchronized void shrink() throws IOException
int BUF = 8192;
long pointer = getPointer();
long size = pointer + 4;
File temp = new File(Const.cacheHome + getCacheDeviceName() + ".shrink");
FileInputStream in = new FileInputStream(f);
FileOutputStream out = new FileOutputStream(temp);
byte[] buf = new byte[BUF];
long runs = size / BUF;
int mode = (int) size % BUF;
for (long l = 0; l < runs; ++l)
in.read(buf);
out.write(buf);
in.read(buf, 0, mode);
out.write(buf, 0, mode);
out.flush();
out.close();
in.close();
raf.close();
f.delete();
temp.renameTo(f);
raf = new RandomAccessFile(f, "rw");
private synchronized long getPointer() throws IOException
long l = raf.getFilePointer();
raf.seek(0);
long pointer = raf.readLong();
raf.seek(l);
return pointer < 8 ? 4 : pointer;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#load()
public synchronized byte[] load() throws IOException
pointer = getPointer();
if (pointer < 8)
return null;
raf.seek(pointer);
int length = raf.readInt();
pointer = pointer - length - 4;
raf.seek(0);
raf.writeLong(pointer);
byte[] b = new byte[length];
raf.seek(pointer + 4);
raf.read(b);
--count;
return b;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#save(byte[])
public synchronized void save(byte[] b) throws IOException
pointer = getPointer();
int length = b.length;
pointer += 4;
raf.seek(pointer);
raf.write(b);
raf.writeInt(length);
pointer = raf.getFilePointer() - 4;
raf.seek(0);
raf.writeLong(pointer);
++count;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCachedObjectsCount()
public synchronized int getCachedObjectsCount()
return count;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCacheDeviceName()
public String getCacheDeviceName()
return cacheDeviceName;
} -
OIM Reporting: How to pass a dynamic parameter in the xml file
Hi,
I am generating a custom report in OIM. My stored procedure is ready and I am getting the required data when I query the database. However,while displaying it through the xml file, I need to filter the fetched data by group name. The glitch present here is that the group name is dependent on the resource selected and so the group parameter is dynamic. How can I pass this dynamic group parameter in the xml file to filter the data. Which attributes are to be used. Can anyone please help me out regarding this?
Thanks in Advance,
SKThe OOTB OIM reporting mechanism does not support dependant LOVs, which is
what you are asking for. -
How to instantiate a java object (using JNI)?(n'more)
hey bschauwe, thanks for your last post, you were guessing but your 4th guess was right on the money of how id like to do it.
"4. An alternative way to return data to java from C is to instantiate a java object (using JNI), then use JNI to call that object's setters, then return the object at the end of the C routine."
I know now how to get the object's setters, I am just unsure how to instantiate a java object from the native C code using JNI. Also you said to returnt he object at the end of the c routine, that is just a good ol' return statement right? no other functions to release memory or anything are needed? So basically it would be something like:
JNIEXPORT jobject retObj JNICALL Java_AbfaRegion_getJSourceData
(JNIEnv *env, jobject thisObj)
//instantiate the java object on retObj????
//call setters with values from the c structures...
//return retObj??? no other memory releasing needed?
}Thanks again for all your help,
ShaneK sounds straight forward enough, the index in my book had nothing on <init> and I wasnt aware of the NewObject call. So my final (well for demonstration purposes) code should look something like:
JNIEXPORT jobject retObj JNICALL Java_AbfaRegion_getJSourceData
(JNIEnv *env, jobject thisObj)
jclass clazz;
jclass clazzTemp;
jmethodID mid;
jint val;
jobject tempObj;
//first instanciate the object
clazz = (*env)->GetObjectClass(env, retObj);
mid = (*env)->GetMethodID(env, clazz, "<init>", "()V");
//Get Object
tempObj = (*env)->NewObject(env, clazz, mid);
//get Class reference to instantiated class
clazzTemp = (*env)->GetObjectClass(env, tempObj);
//Start calling setters to set the object up.
mid = (*env)->GetMethodID(env, clazzTemp, "SetHeight", "(I)V");
(*env)->CallVoidMethod(env,tempObj, mid, struct->myHeight);
//set more members ...
//return the object back to java with its members filled out.
//before returning do I need to call (*env)->DeleteLocalRef(tempObj); ??
return tempObj;
}So is this how i do it for a function that is nativly defined as:
public native JSources getJSourceData();?
if this is right, then im cooking, and cannot thank you enough!
-Shane -
The Proper way to go - Passing Serialized Java Objects vs. Web Services?
The team which I am apart of in our little "community" is trying to convince some "others" (management) that we should not use web services to communicate (move large data) within the same application (allbeit a huge application spanning across many servers).
Furthermore these "others" are trying to tell us that in this same application when two small apps. inside of this large app. are both java we should not communicate via serialized java objects but instead we should use Web Services and XML. We are trying to convince them that the simplest way is best.
They have asked us to provide them with proof that passing serialized java objects back and forth between two smaller java applications inside of a larger one is an Industry Standard. Can anyone help either straighten my fellow workers and I out or help us convince the "others" of the proper way to go?When I was a consultant we always gave the client what they wanted. Even if it was the wrong choice. Suck it up.
I'm glad I wasn't one of those customers. Although I agree that a customer is the one who decides what to do, when I pay someone for consultancy, I expect them to consult me. If they know I'm trying to do something that I shouldn't be doing, I expect a good consultant to be able to show me that there's a better way (not just tell me I'm not doing it right, mind you).
We pass a lot of data using XML and we don't have any transmission or processing speed issues.
Then you either have a much better network than our customer did, or we're not talking about the same amounts of data here.
I used the JAX-RPC RI ...
That's cool... our customer was, unfortunately, infected with Borland products, so we had to use BES. The web services on BES were run by Axis.
How large were these messages?
Huge... each element had about 15 attributes, so 1,200 elements would require 19,200 XML nodes (envelope not included). By comparison, the serialized messages weren't even a quarter that size. It's not just about what you send across the network; it's also the effort of parsing XML compared to desrializing Java objects. Our web service wasn't exactly the only process running at the server.
Anyone who understand the fundamental difference between ASCII (XML) and binary (serialized) formats realizes that no web service can possibly achieve the performance of binary Java services. Why do you think that work is being put into binary web services? I'm not saying XML is never a good thing; just that it's not The Holy Grail that a lot of people are making it look like.
http://issues.apache.org/jira/browse/AXIS-688
Ouch. -
How to create a Java Object dynamically
I want to convert a "DataObject (SDO) " into "Pure java object".
For this i want to create a java object with the fields in Dataobject, and this should be in generic way.I want to convert a "DataObject (SDO) "What is a "DataObject (SDO)"?
into "Pure
java object".What is a "Pure java object"?
For this i want to create a java object with the
fields in Dataobject, What is stopping you? Do you not know how do define a class? Do you think you can add fields to the Object class? If that's what you mean, you're out of luck.
and this should be in generic
way.What do you mean "in generic way"? "Generic" is a very generic term. There are lots of contexts in which it could apply and lots of different possible meanings for "generic way."
You'll have to explain your queston more clearly. -
How to exchange a java object between two applications using web service?
Hi,
I am working with Eclipse 3.2 and the application server is weblogic 10.
I have two applications, each one works in an instance of the server.
The first application contains a method called "send " which return a java object.
The second one contains a method called "receive" which must receive this object.
The two applications must exchange the object using web service,
Can you help me please?
Thanks.Have you defined your service class/methods accepting, or returning, the appropriate objects? If so, does the generated WSDL appear to be correct? I have just completed a web service project and found that passing specific objects to be simple, however, I was passing objects which were simply container objects with bean characteristics. Also, might I suggest that you have a play with netbeans. I found that IDE to be great for creating and consuming web services!
-
How to center a JFrame object on the screen?
Does somebody know how to center a JFrame object on the screen. Please write an example because I'm new with java.
Thank you.//this will set the size of the frame
frame.setSize(frameWidth,frameHeigth);
//get screen size
Toolkit kit=Toolkit.getDefaultToolkit();
//calculate location for frame
int x=(kit.getScreenSize().width/2)-(frameWidth/2);
int y=(kit.getScreenSize().height/2)-(frameHeigth/2);
//set location of frame at center of screen
frame.setLocation(x,y); -
How to call GOS(Generic Object service) attachment ( BMP file ) into SAP
How to call GOS(Generic Object service) attachment ( BMP file ) into SAP script
Example: MM02 Service object there attaching the bmp file the same file i need to call script based on the material number
Please provide the procedure and coding.
Thanks in advance
RajuHi,
The following link may be useful to u.
help.sap.com/printdocu/.../BCSRVOBS.pdf -
How to pass username and password with the portal url
i want to access portal from my web site. i have created username and password fields in my web page. when submited , my portal page should open. so how to pass username and password with the portal url.
This is not straightforward; but it is doable.
First tell us about your portal version; portal 10.1.4 has a slightly different method of doing it and the pre-10g portals were completely different animals.
And if you are in AS Rel 2, then the most important document for you would probably be the following:
[Creating Deployment Specific Pages| http://download-west.oracle.com/docs/cd/B14099_19/idmanage.1012/b14078/custom.htm#i1015535]
You might want to use it in conjunction with some metalink notes about your portal version and such a login page.
hope that helps!
AMN -
How to place am mime object on the smartform ?
Hi All,
How to place am mime object on the smartform ?
Is there any function module to read a mime object from mime repository?
Any help would be appreciated.
Regards,
Raja Ram.Hi Vishwa,
Thanks for your prompt response.
How to get the obj ID of a MIME object?
I checked in So2_MIME_REPOSITORY bur couldn't find?
Is there any mapping table between MIME object and object ID ?
I am very new to MIME objects.
Please tell me.
Regards,
Raja Ram. -
How do I remove an object from the foreground of a photo eg a fence?
How do I remove an object from the foreground of a photo eg a fence?
What version of Photoshop?
If CC then try here
Learn Photoshop CC | Adobe TV -
How to pass arguments from PAPI to the process
Can any one tell me How to pass arguments from PAPI to the process.
The link Creating a new work item instance in a process using PAPI shows how to create instances on PAPI and pass in the variable information as they are being created.
Provide some additional detail if you're interested in seeing how to pass in variable information using PAPI for scenarios other than instance creation.
Dan -
With PS 7
create new
Place two objects on the new file
then you may cut copy and paste
Cs2
create new
place two object on the new file
Cut is not available how does one cut and paste in new fileIf your using File>Place then photoshop cs2 creates what's known as Smart Objects, which photoshop 7 didn't have.
In photoshop cs2 you can rasterize the smart objects and that should make the Cut function available.
Select both placed layers, right click on the area to the right of the tumbnail and select Rasterize Layers.
If in photoshop cs2 you to Help>Photoshop Help and look under Layers>Smart Objects, that should give you a good overview of what smart objects are. -
Can I package and call a java object in the swf? (on the client)
Hello,
Can I package and call/execute a java object within the
swf/adobe flash player?
I want to embed a java object in my swf, and then whne the
swf executes have it call the java object......
E...... there are few instances where it would be nice to
develope a single java object that can be used on the server and
the client..... let's say for the case of server side validation,
that could also be used by the client application for validation,
instead of having to maintain 2 sets of validation logic in two
different languages (java and AS).....
Maybe you are looking for
-
Report for Planned vs Purchase Order(Qty and rate)
Hi I have the following issue. My client is raising Purchasing requisition and Purchase Orders in Me51N and ME21n respectively. The Project Structure is used only to plan the quantities and rates whereas no PR is released from it. But the components
-
Firefox software update appeared. I allowed it to be installed. It screwed up the search bar/box. I use to be able to click on the magnifying glass icon and ALL the search engine options would appear and I could easily chose one. It was easy. Now not
-
HI i restored a sharepoint web 80 application in our test domain and after when i browse the new web application it says Cannot make a cache safe URL for "1025/styles/Themable/corev4.css", file not found. Please verify that the file exists under th
-
Make oracle database case insensitive
Hi All, I am using oracle 10g EE as my back end database and front end is in C# .NET. I want to make my oracle database to perform any comparison case insensitively. I searched on the net and found several ways to achieve that 1. using upper function
-
Hello can i configure the 303 for home use? with only a isp cablemodem? thanks Eva