Tex Abrey

Greenhorn
+ Follow
since Oct 04, 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 Tex Abrey

The source for the test.class

package mypackage;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import oracle.xml.parser.v2.*;
import org.xml.sax.helpers.*;
import java.net.*;
import MyDocumentBuilder;

public class test
{
public test()
{
}
public void normalize(String user, String pass, String systemChoice) throws Exception
{
try {
SAXParser saxParser = new SAXParser();
MyDocumentBuilder docBuilder = new MyDocumentBuilder();
saxParser.setContentHandler(docBuilder);
saxParser.parse(fileNameToURL("C:/David/xml/test.xml"));
XMLDocument xdoc = docBuilder.getDocument();
PrintWriter out = new PrintWriter(new FileWriter("c:/David/xml/temp.xml"), true);
out.print("<?xml version='1.0' encoding='UTF-8'?>");
xdoc.print(out);
Document doc = parsing.parseXmlFile("c:/David/xml/temp.xml",false);
parsing.visit(doc, 0, user, pass, systemChoice);
}
catch (Exception ex) {
System.out.println("Caught an exception: \n" + ex);
}
}
public static URL fileNameToURL(String fileName) throws Exception
{
File file = new File(fileName);
String path = file.getAbsolutePath();
char fSep = file.separatorChar;
path = path.replace(fSep, '/');
if (path.length() > 0 && path.charAt(0) != '/')
path = '/' + path;
return new URL("file", null, path);
}

}

_______________________________________________
Tex
20 years ago
JSP
I tried changing it to Test1.normalize(user,pass,systemChoice); and i still get the same error:
normalize() in mypackage.test cannot be applied to (java.lang.String,java.lang.String,java.lang.String)
Tex
20 years ago
JSP
Graff,
<%-- java include files --%>
<%@ page import="java.io.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.util.*" %>
<%@ page import="mypackage.*" %>
<%
String user = request.getParameter("user");
String pass = request.getParameter("pass");
String systemChoice = request.getParameter("system");
test Test1 = new test();
test.normalize(user,pass,systemChoice);
%>
This is the code i have in my jsp page, The package is recognized because i used to get an error that it couldn't find it but i have added it to the C:\Program Files\Apache Group\Tomcat 4.1\shared\classes directory and the error saying that it couldn't find mypackage is gone.
I also have the direcotry in my class path variable. But i still get the same error.
Normalize is a public void function
public void normalize(String user, String pass, String systemChoice){
}
anything else that i could try??
Thanks
Tex
20 years ago
JSP
Hi,
I have inported a package that i have created and have imported it into my jsp page. When i try and call the function normalize() in the class test i get this error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\treeapp\running_jsp.java:59: normalize() in mypackage.test cannot be applied to (java.lang.String,java.lang.String,java.lang.String)
[javac] test.normalize(user,pass,systemChoice);
It sounds like its saying that there is a fuction called normalize() with no parameters and that passing three strings to it won't work but the normalize function reads in three strings and my jsp page passes three strings.
Any help would be gratly appreciated
Thanks
Tex
20 years ago
JSP
Hi,
I am trying to create a login page in Jsp and import a java package that i created. How do i go about doing this and what (if anything) do i have to do to the package. I am using apache and tomcat and am wondering if i have to put the package into a certain folder or....
Thanks
Tex
20 years ago
JSP
hi i am just wondering if anyone can tell me where i can get the package org.w3c.dom I have imported it but i am trying to use the org.w3c.dom.document class and in the class of org.w3c.dom that i have document is not part of it and i can't find out where to get it.
Thanks
Tex
20 years ago
How do you go about creating a java package. I need to create a package for this class so that i can import it into a jsp page.
Thanks
21 years ago
How do you create a package in java so that i can import the package??
Thanks
21 years ago
JSP
How do i go about importing a Java Class that i created into a JSP page so that I can call the method I need.
Thanks
21 years ago
JSP
Hi, I created a webpage in JSP that was using a uix server. I am trying to put that page on a windows 2000 server is there any change to the comnnection statements, if so can anyone give me an example?
Thanx
Tex
21 years ago
JSP
Hi,
I am trying to change permissions on a file from a jsp page here's my code.....
Runtime rt = Runtime.getRuntime();
rt.exec("chmod 444 " + absDIR + year + mon + pdfName);
I get know errors with this code but it does not work.
I can't seem to figure it out
thanks
Tex
21 years ago
JSP
I am using this code and all i get is False returned when i try and use the renameTO() method
<%-- java include files --%>
<%@ page import="java.io.*" %>
<%@ page import="java.io.File" %>
<%
//starts going through the list of pdf files
File old = new File("/inet/docroot/CorporateResources/Newsclippings/upload/02-01-11_R01.pdf");
File moved = new File("/inet/docroot/dabrey/Newsclippings/clippings/02/01/02-01-11_R01.pdf");
out.println(moved);

try{
boolean flag = false;
flag = old.renameTo(moved);
out.println(flag);
}
catch(Exception e) {
System.out.println(e);
}
%>
21 years ago
JSP
This is the out put i get
/inet/docroot/dabrey/Newsclippings/clippings/02/01/02-01-11_R01.pdf false
and the folder i am moving the file to has read/write/execute abilities
21 years ago
JSP
This is the code I am using
<%-- java include files --%>
<%@ page import="java.io.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.lang.Object" %>
<%@ page import="java.lang.System" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.StringTokenizer" %>
<%
//local directories
String dirURL= "/inet/docroot/Newsclippings/upload/.";
String absDIR= "/inet/docroot/Newsclippings/clippings/";
//collecting information from the clipping directory given above
File path = new File(dirURL);
//array for clipping directory contents
String[] list = path.list();
//starts going through the list of pdf files, searching for those that match the search criteria
for(int i = 0; i < list.length; i++) {
String pdfName = list[list.length - 1 - i];
String year = pdfName.substring(0,2) + "/";
String mon = pdfName.substring(3,5) + "/";
File old = new File(dirURL + pdfName);
File moved = new File(absDIR + year + mon + pdfName);
out.println(moved);

try{
boolean flag = false;
flag = old.renameTo(moved);
out.println(flag);
}
catch(Exception e) {
System.out.println(e);
}
}
%>
21 years ago
JSP
Does anyone have an example as to how to use the renameTo() I can't find a good example that explains at all whats going on, on the net I want to move a file from one directory to another
Thanks
Tex
21 years ago
JSP