DOMSample.java.
I'm learning xml. I downloaded the oracle xml parser file which
includes a sample called DOMSample.java. Whan I run the file I
get a list of errors stating that the getTagName() and
getAttributes()... are not found in the various classes. Why?
Help?
null
It looks like you did not set your CLASSPATH correctly to
include xmlparser.jar. Please take a look at the readme again.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
Kimberly M. (guest) wrote:
: I'm learning xml. I downloaded the oracle xml parser file
which
: includes a sample called DOMSample.java. Whan I run the file
I
: get a list of errors stating that the getTagName() and
: getAttributes()... are not found in the various classes. Why?
: Help?
null
Similar Messages
-
Java Parser 2 DOMSample not working properly
Hi
I downloaded the parser (v2) and am running the DOMSample.java
with the sample file empl.xml as the input. The program
successfully finds the tree and writes out the nodes correctly,
but it never finds the node values (I made sure that there is a
call to getNodeValue()). For example, The following
XML file:
<?xml version = "1.0"?>
<!DOCTYPE parent [
<!ELEMENT parent (child)>
<!ELEMENT child (#PCDATA)>
]>
<parent>
<child>Murthy</child>
</parent>
The getNodeValue() always returns null, even though the <child>
tag has a value.
What am I missing?
Thanks in advance
Murthy.
nullYou have to get the TEXT children of an element and then use the
getNodeValue() method on the text nodes.
Oracle XML Team
James Lee (guest) wrote:
: How do u do that? when i tried to pass it into a text node, the
: runtime error says that there is a classcastexception.
: James
: Oracle XML Team wrote:
: : As per the W3C DOM spec, getNodeValue() of an element is
: always
: : null. You need to pass it the text node to get the actual
text.
: : Oracle XML Team
: : http://technet.oracle.com
: : Oracle Technology Network
: : Murthy Jarugumilli (guest) wrote:
: : : Hi
: : : I downloaded the parser (v2) and am running the
: DOMSample.java
: : : with the sample file empl.xml as the input. The program
: : : successfully finds the tree and writes out the nodes
: : correctly,
: : : but it never finds the node values (I made sure that there
: is
: : a
: : : call to getNodeValue()). For example, The following
: : : XML file:
: : : <?xml version = "1.0"?>
: : : <!DOCTYPE parent [
: : : <!ELEMENT parent (child)>
: : : <!ELEMENT child (#PCDATA)>
: : : ]>
: : : <parent>
: : : <child>Murthy</child>
: : : </parent>
: : : The getNodeValue() always returns null, even though the
: : <child>
: : : tag has a value.
: : : What am I missing?
: : : Thanks in advance
: : : Murthy.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
Request for sample code, Validating XML Schema
Does anyone have some sample code to validate
an XML Schema with the Oracle parser?
Also, the classgen code seems to have more XML Schema classes in it. There is an xschema.jar full of XML Schema related code. Would it be possible to use this code?
I've tried DOMSample.java with the v2 parser. It seems to happily echo Schema based XML files that are obviously wrong. (I use Tibco's XML Authority to verify the XML file and XML Schema).I do not have sample code but it is not a difficult API to call. I have worked on it before, so if you have a specific question on it, happy to help out if I can.
-
Easy question: Extracting text from DOM
I'm new to XML, so bear with me for a sec. I'm using the v2
parser with JDK 1.2.2 to generate dynamic web pages from XML
files. A button on the web page needs to kick off a routine that
sends financial data from the DOM from which the page was
generated into a graphing program. I've perused the parser API
docs for methods that will extract the actual displayed text
from
DOM nodes (the content between the starting & ending <text>
tags), but have only been able to extract element names,
attributes, values, etc. For example, here's a snippet from the
XML document:
<text x="253" cellwidth="111" align="center" fontface="Arial,
Helvetica" fontsize="3" pointsize="12" bold="true"
italic="false">$93.63</text>
It's the $93.63 that's important to me. Getting the attributes
and values from within the tags is no problem. But I need to be
able to suck out the actual text that gets spit out onto the
browser. Any ideas?
Thanks!
Gus
nullSK (guest) wrote:
: Oracle XML Team wrote:
: : SK (guest) wrote:
: : : Robert Truitt (guest) wrote:
: : : : Oracle XML Team wrote:
: : : : : Gus (guest) wrote:
: : : : : : I'm new to XML, so bear with me for a sec. I'm using
: the
: : : v2
: : : : : : parser with JDK 1.2.2 to generate dynamic web pages
: from
: : : XML
: : : : : : files. A button on the web page needs to kick off a
: : : routine
: : : : : that
: : : : : : sends financial data from the DOM from which the
page
: : was
: : : : : : generated into a graphing program. I've perused the
: : parser
: : : : API
: : : : : : docs for methods that will extract the actual
: displayed
: : : text
: : : : : : from
: : : : : : DOM nodes (the content between the starting & ending
: : : <text>
: : : : : : tags), but have only been able to extract element
: names,
: : : : : : attributes, values, etc. For example, here's a
snippet
: : : from
: : : : : the
: : : : : : XML document:
: : : : : : <text x="253" cellwidth="111" align="center"
: : : : fontface="Arial,
: : : : : : Helvetica" fontsize="3" pointsize="12" bold="true"
: : : : : : italic="false">$93.63</text>
: : : : : : It's the $93.63 that's important to me. Getting the
: : : : attributes
: : : : : : and values from within the tags is no problem. But I
: : need
: : : to
: : : : : be
: : : : : : able to suck out the actual text that gets spit out
: onto
: : : the
: : : : : : browser. Any ideas?
: : : : : : Thanks!
: : : : : : Gus
: : : : : To get the "$93.63" from the text element you need to
: : first
: : : : get
: : : : : its text node then get the value of that text node.
: : : : : Oracle XML Team
: : : : : http://technet.oracle.com
: : : : : Oracle Technology Network
: : : : add the following code in DOMSample.java:
: : : : if ( n instanceof Element )
: : : : { Element e = (Element) n;
: : : : NodeList nl2 = e.getChildNodes();
: : : : //NodeList nl2 = e.getElementsByTagName
: : : : ("#text"); // this doesn't work.
: : : : System.out.print ("\t" );
: : : : for ( int j = 0; j < nl2.getLength(); j++ )
: : : : { Node n2 = nl2.item(j);
: : : : //System.out.print ( n2.getNodeName() );
: : : : //if ( n2 instanceof Text ) //
either
: of
: : : : these works...
: : : : if ( n2.getNodeType() == Node.TEXT_NODE )
: : : : System.out.print ( " = " +
: : n2.getNodeValue
: : : : System.out.println( );
: : : : after line:
: : : : System.out.print(n.getNodeName());
: : : : in function 'printElements(Document doc)'
: : : XML Team,
: : : What will be equivalent code for PLSQL. I am trying to use
: : : xmlparser for PLSQL and successfully compiled
DOMSAMPLE.sql
: : with
: : : following commands
: : : ---- from Oracle supplied DOMSAMPLE.sql ------------
: : : -- get all elements
: : : nl := xmlparser.getElementsByTagName(doc, '*');
: : : len := xmlparser.getLength(nl);
: : : dbms_output.put_line('>>>>>Printing elements ......');
: : : -- loop through elements
: : : for i in 0..len-1 loop
: : : n := xmlparser.item(nl, i);
: : : dbms_output.put(to_char(i) -
Loading XML document for DOM parsing
Can anyone suggest other API's to load a XML document into memory so they can be parsed using the DOM with Java?(e.g. The "load(url)" interface method specific to IE5)
ThanksCheck out the DOMSample.java code came with the XML Parser for Java v2 download.
Oracle XML Team -
I donwloaded the XML Parser for Java V2. I am trying to run the sample program DOMSample.java. It gives me the element names from the xml but it does not give me the values.
Can someone help. What could be wrong. The sample program seems to be correct.Hi,
You have to get the TEXT children of an element and then use the getNodeValue() method on the text nodes.
We are planning on providing more meaningful sample examples.
Thanks,
Oracle XML Team -
I have parsed the following xml document with the oraxml batch
and with the sample '..\xdk\demo\java\parser\dom\DOMSample' and
observed a diffent behavior in Oracle9i:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<Document xmlns:n1='urn:example:some-names'
xmlns:n2='urn:example:some-names'>
<BadAttrs_XML_1.0 att='1' att='2' />
<BadAttrs_Namespaces n1:att='1' n2:att='2' />
<OKAttrs_XML_1.0 att='1' n2:att='2' />
</Document>
----------------------------1.) oraxml
C:\oracle\ora9011\xdk\demo\java\parser\dom>oraxml -version
-warning Namespaces2.xml
Parser version: Oracle XDK Java 9.0.1.0.0 Production
The input XML file is parsed without errors using partial
validation mode
Oraxml does not recognize the two attributes with the same name
in element 'BadAttrs_XML_1.0' as an error.
2.) oracle.xml.parser.v2.DOMParser
C:\oracle\ora9011\xdk\demo\java\parser\dom>java DOMSample
Namespaces2.xml
file:Namespaces2.xml<Line 8, Column 38>: XML-0124: (Fata
l Error) An attribute cannot appear more than once in the same
start tag.
oracle.xml.parser.v2.XMLParseException: An attribute cannot
appear more than once in the same start tag.
I have modified the DomSample.java. The DomParser just checks for
well-formed documents and doesn't validate the document anymore.
(only a comment before
parser.setValidationMode(DOMParser.DTD_VALIDATION);)
My question is:
Is there really a difference between oracle.xml.parser.v2.oraxml
and oracle.xml.parser.v2.DOMParser or which parameters do I have
to use to get the same results?
With Oracle8i, both report an xml error!!
(Oracle9i, Win2000, JDK1.3)
Thanx in advance!
MarkusIt would appear that there is a difference when a loadjava is given a jar vs. the individual class files. When I load the jar, I get the previously described error, but when I load the individual class files (the same class files that the jar contains) the error goes away.
Why? -
I can compile DOMSample.java without error but when I run it I get the following error. I'm running Windows NT.
Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/NodeEither your missing a CLASSPATH setting
or import setting in your DOMSample.
Be sure you're importing parser.v2
null -
Error java.lang.OutOfMemoryError using XML DOM parser
Hi everyone,
We are using Oracle 8.1.7 on Windows NT and trying to load XML into Oracle using the DOM API through PL/SQL. This is the method provided in the ORACLE_HOME\ora817\xdk\plsql\demo\domsample.sql which uses the XMLPARSER and XMLDOM PL/SQL packages.
Now this works fine with small files (not sure about the exact file size). But for big files, it gives an error,
ORA-29554: unhandled Java out of memory condition
ORA-29532: Java call terminated by uncaught Java exception: java.lang.OutOfMemoryError
We have increased the JAVA_POOL_SIZE from the default 20MB to 50MB. Not sure whether increasing this value will solve our problem and whether it is advisable to increase it to a higher value. Can anyone help, please ???
Thanks.Steve,
Thanks for the response. Now we are getting different error. In one of the questions earlier posted, someone (I think Jon) noted that following error (the one we are getting) can be resolved by using JDK 1.1.8, is there any specific JDK pre-req for XML Parser 0.9.8.6?
Is it possible, to enhance release notes for 0.9.8.6 to include
a) Tips mentioned in your mail (i.e. putting oracle xml parser 2.0.x before Apache/OJSP xmlparserv2.jar
b) Dependencies on specific version of JDK
Once again thanks for the responding to the mail and will appreciate a help to resolve this current error.
Thanks,
Shree
Actual error :
java.lang.IllegalArgumentException: sun.io.CharToB
yteUTF-8
at sun.io.CharToByteConverter.getConverterClass(Compiled Code)
at sun.io.CharToByteConverter.getConverter(Compiled Code)
at java.io.OutputStreamWriter.<init>(Compiled Code)
at org.apache.jserv.JServConnection.getWriter(Compiled Code)
at oracle.xml.xsql.XSQLServletPageRequest.setupWriter(Compiled Code)
at oracle.xml.xsql.XSQLServletPageRequest.setContentType(Compiled Code)
at oracle.xml.xsql.XSQLPageProcessor.process(Compiled Code)
at oracle.xml.xsql.XSQLServlet.doGet(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.jserv.JServConnection.processRequest(Compiled Code)
at org.apache.jserv.JServConnection.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)
null -
Error while running a Java Program
Can anyone help me,
I am getting the following error while running a Java program, Below is the exception thrown, please help.
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:425)
at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
at org.jetel.graph.Edge.writeRecord(Edge.java:288)
at com.tcs.re.component.RESummer1.run(RESummer1.java:505)
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:425)
at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
at org.jetel.graph.Edge.writeRecord(Edge.java:288)
at com.tcs.re.component.RECollectCont.run(RECollectCont.java:304)Ok, let's see. Write the following class:
public class Grunt {
public static void main(String[] args) {
System.out.println("Hello Mars");
}Save it as "C:\Grunt.java", compile by typing:
javac c:\Grunt.javaRun by typing:
java -classpath "C:\" GruntDoes it say "Hello Mars"? If yes, go back to your program and compare for differences (maybe you used the "package" statement?).
Regards -
Erro de SYSFAIL e Queda do Ambiente JAVA (PI)
Bom Dia
Estou num projeto de NFe e atualmente esta acontecendo o seguinte cenário de Erros:
Na SMQ2 , quando apresenta um aumento nas filas de Mensagens , aparece SYSFAIL em determinadas Filas , todas as outras travam , aumenta o numero de Filas.
Com essa mensagem de SYSFAIL nas filas , o serve0 (Parte JAVA do PI) cai e após isso estou tendo que efetuar manualmente um STOP/START em todos os canais de comunnicação para que os R/3 voltem a emitir NFe.
Isso esta ocorrendo com mais frequência após inserir uma nova empresa para emissão de NFe.
Alguem poderia me ajudar a entender por que ocorre o SYSFAIL as mensagens travam e derruba o ambiente JAVA ?
Sérgio.1º) Erro: Commit Fault: com.sap.aii.af.rfc.afcommunication.RfcAFWException:SenderA
2º) Foi alterado o numero de Filas O numero de Filas foi alterado , mas não consigo ver esse parametros na RZ10 , tem 3 entradas : X32_DVEBMGS32_NFISAP ; DEFAULT ; START_DVEBMGS32_NFISAP nessa transação ...onde eu vejo isso
3º) Esse parametro não tem nessa transação (/usr/sap//DVEBMGS00/j2ee/cluster/server0/log/). em qual desses diretórios abaixo eu encontro esse parametro ?
Existe esses:
DIR_ATRA /usr/sap/X32/DVEBMGS32/data
DIR_BINARY /usr/sap/X32/DVEBMGS32/exe
DIR_CCMS /usr/sap/ccms
DIR_CT_LOGGIN /usr/sap/X32/SYS/global
DIR_CT_RUN /usr/sap/X32/SYS/exe/run
DIR_DATA /usr/sap/X32/DVEBMGS32/data
DIR_DBMS /usr/sap/X32/SYS/SAPDB
DIR_EXECUTABLE /usr/sap/X32/DVEBMGS32/exe
DIR_EXE_ROOT /usr/sap/X32/SYS/exe
DIR_GEN /usr/sap/X32/SYS/gen/dbg
DIR_GEN_ROOT /usr/sap/X32/SYS/gen
DIR_GLOBAL /usr/sap/X32/SYS/global
DIR_GRAPH_EXE /usr/sap/X32/DVEBMGS32/exe
DIR_GRAPH_LIB /usr/sap/X32/DVEBMGS32/exe
DIR_HOME /usr/sap/X32/DVEBMGS32/work
DIR_INSTALL /usr/sap/X32/SYS
DIR_INSTANCE /usr/sap/X32/DVEBMGS32
DIR_LIBRARY /usr/sap/X32/DVEBMGS32/exe
DIR_LOGGING /usr/sap/X32/DVEBMGS32/log
DIR_MEMORY_INSPECTOR /usr/sap/X32/DVEBMGS32/data
DIR_ORAHOME /oracle/X32/102_64
DIR_PAGING /usr/sap/X32/DVEBMGS32/data
DIR_PUT /usr/sap/X32/put
DIR_PERF /usr/sap/tmp
DIR_PROFILE /usr/sap/X32/SYS/profile
DIR_PROTOKOLLS /usr/sap/X32/DVEBMGS32/log
DIR_REORG /usr/sap/X32/DVEBMGS32/data
DIR_ROLL /usr/sap/X32/DVEBMGS32/data
DIR_RSYN /usr/sap/X32/DVEBMGS32/exe
DIR_SAPHOSTAGENT /usr/sap/hostctrl
DIR_SAPUSERS ./
DIR_SETUPS /usr/sap/X32/SYS/profile
DIR_SORTTMP /usr/sap/X32/DVEBMGS32/data
DIR_SOURCE /usr/sap/X32/SYS/src
DIR_TEMP /tmp
DIR_TRANS /usr/sap/trans
DIR_TRFILES /usr/sap/trans
DIR_TRSUB /usr/sap/trans -
Starting deployment prerequisites: error in BI-Java installation sapinst
Hi all,
We are in process updating Bw 3.5 to BI 7.0 we hace sucessfully completed the Upgrade but while installing Bi java thru Sapinst in third step like java instance installtion i was stck with the below error.
We have downloaded the Cryptographic file and placed in jdk folder still the same problem is coming.
Please suggest...
Thanks,
Subhash.G
Starting deployment prerequisites:
Oct 13, 2007 2:42:18 AM Error: Creation of DataSource for database "BWQ" failed.
Original error message is:
com.sap.sql.log.OpenSQLException: Error while accessing secure store: Encryption or decryption is not possible because the full version of the SAP Java Crypto Toolkit was not found (iaik_jce.jar is required, iaik_jce_export.jar is not sufficient) or the JCE Jurisdiction Policy Files don't allow the use of the "PbeWithSHAAnd3_KeyTripleDES_CBC" algorithm..
Stack trace of original Exception or Error is:
com.sap.sql.log.OpenSQLException: Error while accessing secure store: Encryption or decryption is not possible because the full version of the SAP Java Crypto Toolkit was not found (iaik_jce.jar is required, iaik_jce_export.jar is not sufficient) or the JCE Jurisdiction Policy Files don't allow the use of the "PbeWithSHAAnd3_KeyTripleDES_CBC" algorithm..Problem solved followed the notes 1063396.
-
If Statement in java.awt paint
import java.applet.Applet; //bring in the applet class
import java.awt.*; //bring in the graphics class
import java.awt.event.*; //bring in the event class
import java.text.DecimalFormat; //bring in the decimal format class
import java.lang.Float; //bring in the float class
public class Bmi extends Applet implements ActionListener { //begin program and start ActionListener
Label weight, height; //define Label variable
TextField weighttext, heighttext; //define TextField variables
Button calculate; //define button variables
float index, wt, ht, max, min; //define float variables
DecimalFormat fmt2 = new DecimalFormat("#.00"); //set decimal format for reals
public void init() { //begin init()
weight = new Label("Please enter your weight in Kg. (2 decimal places): "); //define content of Label weight
weighttext = new TextField(6); //define size of TextField
height = new Label("Please enter your height in Metres (2 decimal places): "); //define content of Label height
heighttext = new TextField(5); //define size of TextField
calculate = new Button("Calculate!!"); //define content of Button
add(weight); //add Label weight to the GUI
add(weighttext); //add TextField weighttext to the GUI
add(height); //add Label height to the GUI
add(heighttext); //add TextField heighttext to the GUI
add(calculate); //add button calculate to the GUI
calculate.addActionListener(this); //wait for button to be returned
wt = 0; //reset wt to 0
index = 0; //reset index to 0
ht = 0; //reset ht to 0
max = 0; //reset max to 0
min = 0; //reset min to 0
public void actionPerformed( ActionEvent e ) { //run upon return of button
wt = Float.parseFloat(weighttext.getText()); //convert weighttext from String to Float
ht = Float.parseFloat(heighttext.getText()); //covert heighttext from String to Float
repaint(); //refresh paint area
public float indexer() //begin indexer method
float ind; //delare local variable ind
ind = wt/(ht*ht); //perform calculation
return ind; //make indexer() the value of variable ind
} // end of indexer method
public float maxWeight() //begin maxWeight method
float maxwt; //declare local variable maxwt
final float UPPER = 25.0f; //declare variable UPPER as a float with a decimal value of 25.0
maxwt = UPPER*ht*ht; //perform calculation
return maxwt; //make maxWeight() the value of variable maxwt
} // end of maxWeight method
public float minWeight() //begin minWeight method
float minwt; //declare local variable minwt
final float LOWER= 20.0f; //declare variable LOWER as a float with a decimal value of 20.0
minwt = LOWER*ht*ht; //perform calculation
return minwt; //make minWeight() the value of variable minwt
} // end of minWeight method
public void paint(Graphics g) //begin paint method, define g as Graphics
index=indexer(); //covert method indexer() to variable index
max=maxWeight(); //convert method maxWeight() to variable max
min=minWeight(); //convert method minWeight() to variable min
g.setFont(new Font("Verdana", Font.ITALIC, 15)); //define font, weight and size
g.setColor(new Color(90,90,90)); //set new colour
g.drawRect(5,100,300,75); //define size of rectangle
g.setColor(new Color(255,107,9)); //set new colour
g.drawString("BMI is " + fmt2.format(index) + " for " + fmt2.format(wt) + "kg",20,120); //create string in paint, define its on screen position
g.drawString("Maximum bodyweight is " + fmt2.format(max) + "kg", 20,140); //create string in paint, define its on screen position
g.drawString("Minimum bodyweight is " + fmt2.format(min) + "kg", 20,160); //create string in paint, define its on screen position
} // end of paint method
} // end of Bmi classI have written the above code to calculate someones BMI (Body Mass Index). Basically as you can see it recieves a weight and height from the user and calculates the rest. But whilst that good I would like to know how I can make it tell the user something to the effect of "Your overweight" or "Your underweight". The if statement runs like this:
if (wt > max)This forum doesn't quite handle <> properly. The greater and less than symbols. So above you will see > this is the html character code for a greater than symbol so please read it as such.
And then if wt is greater than max then it will say "Your overweight".
But I can't figure out how to include it in the above program. Becuase it won't run in paint, atleast it won't the way I have done it previously. So can you think of any other ways?
Help much appreciated,
SimonThanks very much that works well.
Simon
My code now looks like this: import java.applet.Applet; //bring in the applet class
import java.awt.*; //bring in the graphics class
import java.awt.event.*; //bring in the event class
import java.text.DecimalFormat; //bring in the decimal format class
import java.lang.Float; //bring in the float class
public class Bmi extends Applet implements ActionListener { //begin program and start ActionListener
Label weight, height; //define Label variable
TextField weighttext, heighttext; //define TextField variables
Button calculate; //define button variables
float index, wt, ht, max, min; //define float variables
DecimalFormat fmt2 = new DecimalFormat("#.00"); //set decimal format for reals
public void init() { //begin init()
weight = new Label("Please enter your weight in Kg. (2 decimal places): "); //define content of Label weight
weighttext = new TextField(6); //define size of TextField
height = new Label("Please enter your height in Metres (2 decimal places): "); //define content of Label height
heighttext = new TextField(5); //define size of TextField
calculate = new Button("Calculate!!"); //define content of Button
add(weight); //add Label weight to the GUI
add(weighttext); //add TextField weighttext to the GUI
add(height); //add Label height to the GUI
add(heighttext); //add TextField heighttext to the GUI
add(calculate); //add button calculate to the GUI
calculate.addActionListener(this); //wait for button to be returned
wt = 0; //reset wt to 0
index = 0; //reset index to 0
ht = 0; //reset ht to 0
max = 0; //reset max to 0
min = 0; //reset min to 0
public void actionPerformed( ActionEvent e ) { //run upon return of button
wt = Float.parseFloat(weighttext.getText()); //convert weighttext from String to Float
ht = Float.parseFloat(heighttext.getText()); //covert heighttext from String to Float
repaint(); //refresh paint area
public float indexer() //begin indexer method
float ind; //delare local variable ind
ind = wt/(ht*ht); //perform calculation
return ind; //make indexer() the value of variable ind
} // end of indexer method
public float maxWeight() //begin maxWeight method
float maxwt; //declare local variable maxwt
final float UPPER = 25.0f; //declare variable UPPER as a float with a decimal value of 25.0
maxwt = UPPER*ht*ht; //perform calculation
return maxwt; //make maxWeight() the value of variable maxwt
} // end of maxWeight method
public float minWeight() //begin minWeight method
float minwt; //declare local variable minwt
final float LOWER= 20.0f; //declare variable LOWER as a float with a decimal value of 20.0
minwt = LOWER*ht*ht; //perform calculation
return minwt; //make minWeight() the value of variable minwt
} // end of minWeight method
public void you(Graphics g)
String statement;
if(wt > max) statement="You are very fat";
else if(wt < min) statement="You are very thin";
else statement="You are in the recommended weight range for your height";
g.drawString(statement, 20,210);
public void paint(Graphics g) //begin paint method, define g as Graphics
you(g);
index=indexer(); //covert method indexer() to variable index
max=maxWeight(); //convert method maxWeight() to variable max
min=minWeight(); //convert method minWeight() to variable min
g.setFont(new Font("Verdana", Font.ITALIC, 15)); //define font, weight and size
g.setColor(new Color(90,90,90)); //set new colour
g.drawRect(5,100,300,75); //define size of rectangle
g.setColor(new Color(255,107,9)); //set new colour
g.drawString("BMI is " + fmt2.format(index) + " for " + fmt2.format(wt) + "kg",20,120); //create string in paint, define its on screen position
g.drawString("Maximum bodyweight is " + fmt2.format(max) + "kg", 20,140); //create string in paint, define its on screen position
g.drawString("Minimum bodyweight is " + fmt2.format(min) + "kg", 20,160); //create string in paint, define its on screen position
} // end of paint method
} // end of BmiThanks again,
Simon -
SSO java sample application problem
Hi all,
I am trying to run the SSO java sample application, but am experiencing a problem:
When I request the papp.jsp page I end up in an infinte loop, caught between papp.jsp and ssosignon.jsp.
An earlier thread in this forum discussed the same problem, guessing that the cookie handling was the problem. This thread recommended a particlar servlet , ShowCookie, for inspecting the cookies for the current session.
I have installed this cookie on the server, but don't see anything but one cookie, JSESSIONID.
At present I am running the jsp sample app on a Tomcat server, while Oracle 9iAS with sso and portal is running on another machine on the LAN.
The configuration of the SSO sample application is as follows:
Cut from SSOEnablerJspBean.java:
// Listener token for this partner application name
private static String m_listenerToken = "wmli007251:8080";
// Partner application session cookie name
private static String m_cookieName = "SSO_PAPP_JSP_ID";
// Partner application session domain
private static String m_cookieDomain = "wmli007251:8080/";
// Partner application session path scope
private static String m_cookiePath = "/";
// Host name of the database
private static String m_dbHostName = "wmsi001370";
// Port for database
private static String m_dbPort = "1521";
// Sehema name
private static String m_dbSchemaName = "testpartnerapp";
// Schema password
private static String m_dbSchemaPasswd = "testpartnerapp";
// Database SID name
private static String m_dbSID = "IASDB.WMDATA.DK";
// Requested URL (User requested page)
private static String m_requestUrl = "http://wmli007251:8080/testsso/papp.jsp";
// Cancel URL(Home page for this application which don't require authentication)
private static String m_cancelUrl = "http://wmli007251:8080/testsso/fejl.html";
Values specified in the Oracle Portal partner app administration page:
ID: 1326
Token: O87JOE971326
Encryption key: 67854625C8B9BE96
Logon-URL: http://wmsi001370:7777/pls/orasso/orasso.wwsso_app_admin.ls_login
single signoff-URL: http://wmsi001370:7777/pls/orasso/orasso.wwsso_app_admin.ls_logout
Name: testsso
Start-URL: http://wmli007251:8080/testsso/
Succes-URL: http://wmli007251:8080/testsso/ssosignon.jsp
Log off-URL: http://wmli007251:8080/testsso/papplogoff.jsp
Finally I have specified the cookie version to be v1.0 when running the regapp.sql script. Other parameters for this script are copied from the values specified above.
Unfortunately the discussion in the earlier thread did not go any further but to recognize the cookieproblem, so I am now looking for help to move further on from here.
Any ideas will be greatly appreciated!
/MadsPierre - When you work on the sample application, you should test the pages in a separate browser instance. Don't use the Run Page links from the Builder. The sample app has a different authentication scheme from that used in the development environment so it'll work better for you to use a separate development browser from the application testing browser. In the testing browser, to request the page you just modified, login to the application, then change the page ID in the URL. Then put some navigation controls into the application so you can run your page more easily by clicking links from other pages.
Scott -
SSO between a Java EE application (Running on CE) and r/3 backend
Hi All,
Over the past few days I have been trying to implement a SSO mechanism between NW CE Java Apps and R/3 backend without any success. I have been trying to use SAP logon tickets for implementing SSO.
Below is what I need:
I have a Java EE application which draws data from R/3 backend and does some processing before showing data to the users. As of now the only way the Java App on CE authenticates to r/3 backend is by passing the userid and pwds explicitly. See sample authentication code below:
BindingProvider bp = (BindingProvider) myService;
Map<String,Object> context = bp.getRequestContext();
context.put(BindingProvider.USERNAME_PROPERTY, userID);
context.put(BindingProvider.PASSWORD_PROPERTY, userPwd);
Now this is not the way we want to implement it. What we need is when the user authenticates to CE ( using CE's UME) CE issues a SAP logon ticket to the user. This ticket should be used to subsequently login to other system without having to pass the credentials. We have configured the CE and Backend to use SAP logon tickets as per SAP help.
What I am not able to figure out is: How to authenticate to SAP r/3 service from the java APP using SAP logon tickets. I couldnt find any sample Java code on SAP help to do this. (For example the above sample code authenticates the user by explicitly passing userid and pwd, I need something similar to pass a token to the backend)
Any help/pointers on this would be great.
Thanks,
DhananjayHi,
Have you imported the java certificate into R/3 backend system ? if so.
Then just go to backend system and check on sm50 for each applicaion instance of any error eg.
SM50-> Display files (ICON) as DB symbol with spect.(cntrlshiftF8)
You will get logon ticket details.
with thanks,
Rajat
Maybe you are looking for
-
Read Xml file for Sender and Receiver Info
Hi Is it possible to customize B2B to read Sender/Receiver/Document Information from the xml file which is supposed to be transmitted? I do NOT the option to specify this information in channel configuration under file name since file name will not h
-
Unable tu install and use Adobe Digital Editions
Hi, I tried to install Adobe Digital Editions 4.0 on my Windows 7 pc but it doesn't run... I tried to install the previous version 3.0 but the result is the same... Is possible to install the version 2.0 and where can I find it? Thank for your intere
-
The header and subject of messages show in inbox but they will not open
as of yesterday the headers of messages displayed in the inbox but would not open. messages downloaded previously still open and display.
-
Stock tranfer b/w sto loc with in plant
how to do stock tranfer b/w sto loc with in plant
-
Hi all... I'm sure it's been discussed, but I'm having a hard time trying to find the answer on here. I have two videos that I want to overlap each other, with a circular portion in the center of the top vid revealing the background video. How can I