Tom Pepe'

Greenhorn
+ Follow
since Nov 02, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tom Pepe'

ok so how do I refer to a file for file io using JSP? certainly someone has wanted to access a file using JSP before. All I want is the simplest answer to this question - How do I create a File object refering to a document online in JSP?
Thanks again,
Tom
20 years ago
JSP
I posted this question in the JSP forum and haven't recieved many responses. Perhaps someone here can help me. I keep getting the following error:
java.io.FileNotFoundException: http:/www.mycgiserver.com~trp956s/Firefly/XMLbeanReportGenerator.xsl
(No such file or directory)
no matter how many /'s I type the server searches http:/www.mycgiserver.com. Is there another way to access my file ps the jsp file is at www.mycgiserver.com~trp956s/Firefly/ClientSignUp.jsp and the JSP discussion is at https://coderanch.com/t/283313/JSP/java/JSP-File-Not-Found
Thanks,
Tom
20 years ago
The problem is I keep getting this error:
java.io.FileNotFoundException: http:/www.mycgiserver.com~trp956s/Firefly/XMLbeanReportGenerator.xsl
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at java.io.FileReader.<init>(FileReader.java:41)
at __27etrp956s._Firefly._ClientSignUp__jsp._jspService(/~trp956s/Firefly/ClientSignUp.jsp:36)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:181)
at com.caucho.server.http.Invocation.service(Invocation.java:291)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:341)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:268)
at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
at java.lang.Thread.run(Thread.java:543)
Thanks
20 years ago
JSP
I agree with your security idea but right now I am just trying to get it working. What do you mean by "servelet engine's classpath?"
Thanks,
Tom
20 years ago
JSP
I am trying to use the XMLTransform class to parse the xml generated by the XMLEncoder into html using an xsl file in the same directory as the jar file and as the JSP file, but I keep getting the exception that the file cannot be found. How do I create a file object in JSP which refrences a file on my website?
Thanks!
Tom Pepe
20 years ago
JSP
I need to run jvm on some of my websites but I also need to save money. So far I have been using java to develop apps because it's free. I have found some hosts that will host jvm 1.4.1 for free but the address is not mine. Is there a way around this or does anyone know of a host who will provide jvm support (and subdomains and live support) for under $10/month?
PS - I am considering using frames but that's not realy browser independent. Any help would be appreciated, thanks.
Tom Pepe
20 years ago
The error occured because when referencing the StreamResult Object Constructor I sent it a Writer Object instead of an OutputStream Object. When I replaced the argument to the Constructor it worked.
Thanks,
Tom Pepe
Hello,
I want my HTML to look like this:
Springfield, MO Horses
Performance Horses
Name: BEY Impresario ...
Name: JM Bodacious BEY ...
.
.
.
Young Prospects
.
.
.
Broodmares
.
.
.
Kansas City, MO Horses...
However my XML file looks like this:
...
<java>
<object class="horse">
<location> Springfield, MO </location>
<category> Performance Horse </category>
<name> BEY Impresario </name>
<object>
.
.
.
How do I make the inner properties of my XML objects headers for groups of those objects?
Thanks,
Tom Pepe
I have learned throught a painstaking process of trial and error that the reason some of my properties from my objects are not being encoded into XML is because they are the default values. But I still want to display these values on my JSP pages. Is there an easy way to do this, or do I need to go back to square one?
Thanks!
-Tom Pepe
Well, I don't know why it is acting the way that it is. So, after I caught the TransformerException, per your suggestion, and tried to retrieve the SourceLocator through the getLocator() method of the TransformerException class, it returned a null value. That is to say
catch (TransformerException te){
SourceLocator solo = te.getLocator();

// solo == null.
Sorry, I have tried to work with it but I cannot get my simple XML and XSL examples to work. If you can refer me to a simple example that works, I would be much abliged.
-Tom Pepe
Is it possible to cast an object Dynamically?
public class overLoadMe
public void overLoad(Object o, Object o2){
System.out.println("... some default code");
}
public class overLoadMe2 extends overLoadMe
public void overLoad(MyClass myClass1, MyClass2 myClass2){
System.out.println("... some specific code");
}
public class wrapperClass
public void wrapperMethod(overLoad ol, Object o, Object o){
ol.overLoad(o, o2);
/** no matter what object I send to the second argument of the wrapper method, the ol.overLoad method always prints out "... some default code" **/
}
How do I get around this?
Thanks again,
Tom Pepe
20 years ago
Thanks Bill, but after adding the code you suggested, I get the compile error:
XML2HTML.java [36:1] exception org.xml.sax.SAXException is never thrown in body of corresponding try statement
} catch(org.xml.sax.SAXException spe){
^
1 error
Thanks,
Tom
Thanks in advance. I don't know why I'm getting this error in my code.
My files are
XML2HTML.java
----------------------------------------
public static main(String[] args)throws
TransformerConfigurationException, FileNotFoundException, IOException,
TransformerException {
BufferedReader xsl = new BufferedReader(
new FileReader("C:\\Documents and Settings\\Valued Customer\\My "
+ "Documents\\com\\jspPractice\\Test.xsl"));

BufferedReader xml = new BufferedReader(
//new StringReader(new XMLPrintTest().getXML().toString()));
new FileReader("C:\\Documents and Settings\\Valued Customer\\My "
+ "Documents\\com\\jspPractice\\Test.xml"));

BufferedWriter html = new BufferedWriter(new StringWriter());

display(xml);
display(xsl);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
transformer.transform(new StreamSource(xml),
new StreamResult(html));
display(new BufferedReader(new StringReader(html.toString())));
}
Test.xml
-----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.4.1_02" class="java.beans.XMLDecoder">
<object class="javax.swing.JButton">
<string>Hello world</string>
</object>
</java>
Test.xml
-----------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform" version=
"1.0">
<xsl utput method="html" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="java">
<table border="2" width="50%">
<xsl:for-each select="object">
<tr>
<td>
<i><xsl:value-of select=
"string"/></i>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
The Problem:
When XSL parses my XML it interprets the href="{XPath}" literally. For instance I want to link to "about.html" instead it links to "{TITLE@path}" of course there is no file named that in my local directory so it's a dead link. What Am I doing wrong?
The Code:
index.html
<html>
<body>
<img src="../images/mto.gif" width="163" height="85">
<script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("index.xml")
// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("index.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script>
</body>
</html>
index.xml
<?xml version="1.0" encoding="ISO8859-1" ?>
<?xml-stylesheet type="text/xsl" href="index.xsl"?>
<INDEX>
<HELP_SET>
<TITLE path="about.html">About</TITLE>
<DESCRIPTION>Design specifications
and general description of the More Time Outdoors Consignment
and Point Of Sales Information System.</DESCRIPTION>
</HELP_SET>
<HELP_SET>
<TITLE path="mailto:trp956s@hotmail.com">trp956s@hotmail.com</TITLE>
<DESCRIPTION>E-mail me for further help</DESCRIPTION>
</HELP_SET>
</INDEX>
index.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<table border="2" width="600">
<xsl:for-each select="INDEX/HELP_SET">
<tr>
<td><a href="{TITLE/@path}"><xsl:value-of select="TITLE"/></a></td>
<td><xsl:value-of select="DESCRIPTION"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Thanks in advance - Tom