RE: Money for Projects

2002-04-17 Thread Dahnke, Eric


imo there's nothing wrong with what this person is putting together. what's
the harm.


-Original Message-
From: Jay Gardner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 1:57 PM
To: Tomcat Users List
Subject: RE: Money for Projects


Go away and don't come back!!

-Original Message-
From: Christopher Reed [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 12:00 PM
To: [EMAIL PROTECTED]
Subject: OT: Money for Projects


Apologies in advance if this feels spammy.

I have been working with a few folks on a grassroots way for people to
donate money to various non-profits  projects such as Apache, Hurd,
EFF, or even to a given developer.  This donation might be in response
to some helpful feedback given by that developer in response to a
question; it might be because their name and URL were in some software
they used.  Affero takes a bit off the top for our expenses , which we
think is reasonable given the costs involved in credit card auth and the
like. The software used to deliver the service is open source.

Take a look at a the link I created below

People can go to that URL and donate money, 35% of which goes to the
Squid, 35% to XFree86 and 30% to FSF Gen Fund-GCC.

We're very interested in any comments and feedback on the
site/service. You can check it out at http://www.affero.com.
BTW, we have been told that we should lower our $15.00 minimum donation.
What do you think?

Thanks

Reed


How valuable is my contribution? Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=creedp=Projects

Office: 415 371 9900
[EMAIL PROTECTED]
http://www.affero.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Older TC version (v4.0-b7)

2002-04-11 Thread Dahnke, Eric


How might I find the tomcat.exe file that came with the v4.0-b7 release of
TC for Windows.

BTW, TC v4.0-b7 is what is packaged w/ the jwsdp from Sun, and it doesn't
have the tomcat.exe file necessary to start TC as a service on NT.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: How to run tomcat as service program in Win2k [[HELP]]

2002-04-11 Thread Dahnke, Eric


I've followed this thread and am still having no luck. Here's the situation.
The TC that comes with jwsdp is TC4.0b7. This release of TC doesn't include
a tomcat.exe file, so I grabbed one from the TC4.0.1 release. I then run
following from the cmd prompt.

%CATALINA_HOME%\bin\tomcat.exe -install Tomcat
%JAVA_HOME%\jre\bin\classic\jvm.dll -Djava.class.path=
%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\lib\tools.jar
-Dcatalina.home=%CATALINA_HOME% -Xrs -start
org.apache.catalina.startup.Bootstrap -params start -stop
org.apache.catalina.startup.Bootstrap -params stop -out
%CATALINA_HOME%\logs\stderr.log

Response is:

The service was successfully installed.

Upon starting the service I get:

Could not start the service on Local Computer. The service did not return
an error. This could be a Windows error or an internal service error.

the stderr.log file is created but is empty.


Anyone have any ideas? How can I further troubleshoot. Regards Eric



-Original Message-
From: Jordan C N Chong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 2:06 AM
To: Tomcat Users List
Subject: Access local directory with Tomcat 4.0


Dear all,

Sorry to post this question again, cause I didn't receive any reply... so I
think I should rephrase my question.

I am using standalone Apache Tomcat 4.0, on my Windows 2000 machine.

I am making a servlet for file downloading using the Tomcat 4.0, but I am
not sure how to setup or configure the local directory, cause when I do
this:

FileInputStream filein = new FileInputStream(C:\\temp\\text.txt);

I got IOException for that, because Tomcat 4.0 complains the directory is
not accessible... Please help me. Thank you very much.


Best regards,
Jo


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Re[2]: How to run tomcat as service program in Win2k [[HELP]]

2002-04-11 Thread Dahnke, Eric


Thanks for the response:

jdk1.3.1_02

I tried both

%JAVA_HOME%\jre\bin\classic\jvm.dll

and

%JAVA_HOME%\jre\bin\hotspot\jvm.dll

same result.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Designing for scalability ?

2002-04-10 Thread Dahnke, Eric


A software solution is to use Windows 2000 Advanced Server.  In a
clustered environment, there is a parameter called Affinity.  Affinity
will maintain the client's session to one particular server in the
cluster.  Advanced Server works by assigning the cluster 1 IP address
and each individual server a secondary IP address.

Bewarned. I've seen this w2k solution fail miserably twice out of two
attempted deployments. Hardware loadbalancing is the way to go imo.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: jk_nt_service with 4.0.1, can't find my web.xml

2002-04-08 Thread Dahnke, Eric


i've been watching this thread, as i've got to do the same thing here. tc4.0
on win2k as a service. would you be so kind as to put together a brief howto
when you get it.


btw, i have been trying for a few days, but always get thankfully side
tracked with somethign else.


-Original Message-
From: Chris Gross [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 3:37 PM
To: tomcatlist
Subject: jk_nt_service with 4.0.1, can't find my web.xml



I found instructions on how to use the jk_nt_service from v3.2 with v4.0.1.
I followed the instructions and it seemed to work.  Tomcat starts
successfully but Tomcat is saying it can't find the web.xml for my webapp.
Its definitely there.  Here's whats in the log:

2002-04-08 15:04:37 ContextConfig[/MyApp]: Missing application web.xml,
using defaults only
2002-04-08 15:04:37 ContextConfig[/MyApp]: Added certificates - request
attribute Valve
2002-04-08 15:04:37 StandardWrapper[/MyApp:default]: Loading container
servlet default
2002-04-08 15:04:37 default: init
2002-04-08 15:04:37 StandardWrapper[/MyApp:invoker]: Loading container
servlet invoker
2002-04-08 15:04:37 invoker: init
2002-04-08 15:04:37 jsp: init
2002-04-08 15:04:37 Internal Error: File /WEB-INF/web.xml not found
2002-04-08 15:04:58 StandardHost[localhost]: MAPPING configuration error for
request URI
2002-04-08 15:05:00 StandardHost[localhost]: MAPPING configuration error for
request URI

If I use startup.bat everything works fine.

-chris


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Oracle Drive and Tomcat 4

2002-04-05 Thread Dahnke, Eric


TC4 needs jar files to have the .jar extension. This was not true of TC3. In
my case I always unzip the file, and build it back using the jar command. I
don't just change the file extension from .zip to .jar

-Original Message-
From: Jack Li [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 11:30 AM
To: '[EMAIL PROTECTED]'
Subject: Oracle Drive and Tomcat 4


I installed Tomcat 4 and JDK 1.3 on a new server. I put oracle's
classes12.zip in c:\jdk\bin\ and set 
 
CLASSPATH=c:\jdk\bin\;c:\jdk\bin\classes12.zip; 
 
When I call Oracle database, I got error message: Oracle Driver not found.
The same program on another server runs ok.
 
Any ideas?
 
Thanks,
Jack Li

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Re[2]: Oracle Drive and Tomcat 4

2002-04-05 Thread Dahnke, Eric

just being extra careful. didn't know jar and zip were so similar. thx for
the info

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 12:12 PM
To: Tomcat Users List
Subject: Re[2]: Oracle Drive and Tomcat 4


Hello Eric,

Why would you need to do that?  jar file use the zip format, so you
don't gain anything.  I renamed the oracle driver to .jar from .zip
with no other changes and it works like a dream.  What is your basis
for saying this...or are you just being extra careful?

Jake

Friday, April 05, 2002, 10:53:06 AM, you wrote:


DE TC4 needs jar files to have the .jar extension. This was not true of
TC3. In
DE my case I always unzip the file, and build it back using the jar
command. I
DE don't just change the file extension from .zip to .jar

DE -Original Message-
DE From: Jack Li [mailto:[EMAIL PROTECTED]]
DE Sent: Friday, April 05, 2002 11:30 AM
DE To: '[EMAIL PROTECTED]'
DE Subject: Oracle Drive and Tomcat 4


DE I installed Tomcat 4 and JDK 1.3 on a new server. I put oracle's
DE classes12.zip in c:\jdk\bin\ and set 
 
DE CLASSPATH=c:\jdk\bin\;c:\jdk\bin\classes12.zip; 
 
DE When I call Oracle database, I got error message: Oracle Driver not
found.
DE The same program on another server runs ok.
 
DE Any ideas?
 
DE Thanks,
DE Jack Li

DE --
DE To unsubscribe:   mailto:[EMAIL PROTECTED]
DE For additional commands: mailto:[EMAIL PROTECTED]
DE Troubles with the list: mailto:[EMAIL PROTECTED]



-- 
Best regards,
 Jacobmailto:[EMAIL PROTECTED]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




HTML special chars - convert

2002-04-04 Thread Dahnke, Eric


using java how can I convert (unescape) html special chars like lt;brgt;
to br?


regards

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: TOMCAT STOPS!

2002-04-03 Thread Dahnke, Eric


If this is true:

If we use lynx on the server running Tomcat, we CAN access the
pages.

then Tomcat is not your problem, and it is more likely a networking /
firewall issue. When it goes down what does telnetting to port 80 show you?
How about traceroute?

could also be a hostname dns thing. when you run lynx do you use localhost?
What is the  exact URL you use in lynx?



-Original Message-
From: Bob Swerdlow [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 4:58 PM
To: Tomcat Users List
Cc: [EMAIL PROTECTED]
Subject: Re: TOMCAT STOPS!


One more detail, which may be important:
If we use lynx on the server running Tomcat, we CAN access the pages.  I
can't figure that out at all.

Please help if you can.

- Original Message -
From: Bob Swerdlow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, April 03, 2002 4:51 PM
Subject: TOMCAT STOPS!


 We're in trouble.

 We're using Tomcat 4.0.2 Stand-alone on Solaris 8.  Periodically it just
 stops servicing requests.

 We know it is Tomcat because we can still get to the machine on other
ports.
 We can SSH to it and everything seems fine.

 We know it is not just one project since we cannot get to any projects
that
 Tomcat should be running.  Not even /manager/list.

 If we are patient enough, it sometimes comes back after 4 or 5 minutes.
 Then everything seems normal again.  Usually we don't wait because our
site
 is down, so we just stop and restart it.  However, it often takes several
 restarts to get it going again.

 I'm not even sure where to start looking!  Any help would be greatly
 appreciated!

 Bob Swerdlow
 Chief Operating Officer
 Transpose, LLC
 [EMAIL PROTECTED]


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




TC Performance Testing

2002-03-28 Thread Dahnke, Eric


Performance Testing:

Test Machine: TC4.0, JDK1.3.1_01, RH7.1, 700MHZ, 256M
Page being served = h1Hello World/H1 index.html

concurrent users: 10
requests/sec: 39
test duration   : 5 mins
result code 200 (pages served)  : 11690
result code NA (failures)   : 0

concurrent users: 100
requests/sec: 168
test duration   : 5 mins
result code 200 (pages served)  : 49376
result code NA (failures)   : 1238

concurrent users: 400
requests/sec: 233
test duration   : 5 mins
result code 200 (pages served)  : 47321
result code NA (failures)   : 22806


I have tested Apache 1.3.x and IIS serving static pages using these
parameters and both display about 2x the performance. (twice as many pages
served in the same amount of time and half as many errors). IS THERE
ANYTHING I CAN DO TO INCREASE TC  PERFORMANCE. (ie. MinSpareServers 5,
MaxSpareServers 10, stuff like that).

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: TC Performance Testing

2002-03-28 Thread Dahnke, Eric

 I have tested Apache 1.3.x and IIS serving static pages using these
 parameters and both display about 2x the performance. (twice as many pages
 served in the same amount of time and half as many errors). IS THERE
 ANYTHING I CAN DO TO INCREASE TC  PERFORMANCE. (ie. MinSpareServers 5,
 MaxSpareServers 10, stuff like that).

- Disable access logging if you don't need it

How would I disable access logging?

and anyone know what acceptCount=10 does?

Connector className=org.apache.catalina.connector.http.HttpConnector
port=80 minProcessors=5 maxProcessors=300
enableLookups=false redirectPort=8443
acceptCount=10 connectionTimeout=6 debug=0
scheme=http secure=false/

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Multiple users share java bean?

2002-03-27 Thread Dahnke, Eric

If I comment out the init() method in my servlet do I get an instance of it
for each request?

Do people commonly do this?

I suspect that if you do this Eric, it won't compile...


It compiles fine, and works fine too. But I haven't testing it in a
multiuser environment yet.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Page Loading occurring causing double POST messages

2002-03-27 Thread Dahnke, Eric


Some browsers might execute your javascript *AND* submit your form if the
submit button and form tags are correct. Make sure you're doing one or the
other, not both.


-Original Message-
From: Pavel Brun [mailto:[EMAIL PROTECTED]]
Sent: Miércoles, 27 de Marzo de 2002 02:08 p.m.
To: Tomcat User
Subject: Page Loading occurring causing double POST messages


Hello all,

I have finally debugged enough to find out that my tags are being executed
twice (on a number of pages) because the page seems to be loaded twice. Does
anyone know why a page would be loaded twice? I thought that a
document.form.submit()
would cause a signal post to the same page.

Any answers or explanations would be appreciated.

Paul



Pavel (Paul) Brun
Software Designer
Messaging and Applications
Mitel Networks, Ottawa, ON, Canada

Work Email: [EMAIL PROTECTED]
Personal:   [EMAIL PROTECTED]

Bus. Phone: (613) 592-5660 ext.1520
or  Call Speak@Ease (613) 592-7213



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: AW: Multiple users share java bean?

2002-03-26 Thread Dahnke, Eric


Referring to this point:

Great, that's what I thought.  But here's why I'm getting confused. The 
servlet tutorial says that a servlet is created once and once only (that's 
when the init() is run).

If I comment out the init() method in my servlet do I get an instance of it
for each request?

Do people commonly do this?

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




BufferedReader oject between servlet and jsp

2002-03-20 Thread Dahnke, Eric

wondering if someone might help me out. I'm trying to pass a BufferedReader
object between a servlet and jsp page using the session. on the jsp page I
want to read out line by line the BufferedReader object. The idea works
within the servlet code as shown, but within the jsp page no matter what I
do

out.println(br);

shows something like this:

java.io.BufferedReader@3c550f 

and the while loop (in the jsp) never executes. Any ideas? (how can i
troubleshoot?)



I have a servlet with the following code:
===
BufferedReader br = new BufferedReader( new
InputStreamReader(proc.getInputStream()));

HttpSession session = request.getSession(true);
session.setAttribute(BufferedReader, br); 

String str;
while ((str = br.readLine()) != null) {
System.out.println(str);
} //works

and a jsp page which is called from the servlet like this

RequestDispatcher rd = request.getRequestDispatcher(en/bdy.jsp);
rd.include(request, response);

bdy.jsp
=
%@ page import=java.io.* %

%
BufferedReader br = (BufferedReader) session.getAttribute(BufferedReader);
String str;
out.println(br);
while ((str = br.readLine()) != null) {
out.println(str);
out.println(HI);
} //doesn't work
%

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Where's my fish? How do I go fishing? (Tomcat 4.0)

2002-03-19 Thread Dahnke, Eric


If there is a JSP page either calling the servlet or the servlet includes or
forward to a JSP page, you may want to try to touch *.jsp in the dirs
containing the jsps.

HTH

-Original Message-
From: JavaJosh [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 4:08 PM
To: [EMAIL PROTECTED]
Subject: Where's my fish? How do I go fishing? (Tomcat 4.0)


Hello,

Tomcat 4.0.3 is apparently not reloading a recompiled servlet. According
to the docs, this should be the default behavior.

Interestingly, it WILL load a new servlet.

I have 2 questions, of the where's my fish sort and of the how do I
fish sort.

Where's my fish: why isn't Tomcat reloading my changed servlet? I have
verified that the class file has changed by checking the timestamp, so
I'm pretty sure it's not a build problem.

How do I fish: what is a reasonable way to troubleshoot this problem?

While I would love to have a fish right now, I am perfectly willing to
learn how to fish and catch my own.

Some fishing I've already done:
1) tried restarting tomcat. Picks up the new class!
2) tried restarting the browser. No go.
3) examined the tomcat logs. Nothing interesting.
4) examined the servlet class file in the webapps dir. Yup, it sure
changed.
5) tried adding a second servlet. Tomcat picks it up!
6) tried changing the second servlet. No go.

I *suspect* that in the murky depths of this problem swims an enormous
caching flounder. Is its name Tomcat 4.0.3? Is it IE 5? Either way, I
want to hook it, filet it, and have it for dinner tonight.

Thanks for your help,
Josh Rehman

Here are some more facts for you:
Hardware: Dell Inspiron 7000 Laptop - P2-366 256M/10G
OS: MS Windows 2000 (NT5) Professional SP2 1024x768x64k
Java: Sun J2SE 1.3.1_01 - c:\java\jdk131
Tomcat: 4.0.3 - c:\java\jakarta-tomcat-4.0.3
%CATALINA_HOME%\conf\web.xml is stock
%CATALINA_HOME%\conf\server.xml is stock
Environment variables: 
CATALINA_HOME=C:\java\jakarta-tomcat-4.0.3
JAVA_HOME=c:\java\jdk131_01
JIKES_HOME=c:\java\jikes114
ANT_HOME=c:\java\ant14
Project organization:
Deploy root: %CATALINA_HOME%\webapps\tomcat40
\WEB-INF\web.xml
\WEB-INF\classes\joshbrain\tomcat40\FirstServlet.class
\WEB-INF\classes\joshbrain\tomcat40\SecondServlet.class

Contents of web.xml:
!DOCTYPE web-app 
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN 
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app
display-nameTomcat 4.0.3 Evaluation Application/display-name

description
  This is version 1.0 of a simple evaluation application 
  written by Josh Rehman ([EMAIL PROTECTED]).
/description

context-param
  param-namewebmaster/param-name
  param-value[EMAIL PROTECTED]/param-value
  description
The EMAIL address of the administrator to whom questions
and comments about this application should be addressed.
  /description
/context-param

servlet
  servlet-namefirst/servlet-name
  servlet-classjoshbrain.tomcat.FirstServlet/servlet-class
/servlet

servlet
  servlet-namesecond/servlet-name
  servlet-classjoshbrain.tomcat.SecondServlet/servlet-class
/servlet

servlet-mapping
  servlet-namefirst/servlet-name
  url-pattern/first/url-pattern
/servlet-mapping

servlet-mapping
  servlet-namesecond/servlet-name
  url-pattern/second/url-pattern
/servlet-mapping

session-config
  session-timeout30/session-timeout!-- 30 minutes --
/session-config

/web-app

Contents of FirstServlet.java (SecondServlet similar):
/*
 * FirstServlet.java
 *
 * Created on March 18, 2002, 4:56 PM
 */

package joshbrain.tomcat;

import javax.servlet.*;
import javax.servlet.http.*;

/**
 *
 * @author  Josh Rehman
 * @version
 */
public class FirstServlet extends HttpServlet
{
public void init(ServletConfig config) throws ServletException
{
super.init(config);

}
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, java.io.IOException
{
response.setContentType(text/html);
java.io.PrintWriter out = response.getWriter();
out.println(html);
out.println(head);
out.println(titleServlet/title);
out.println(/head);
out.println(body);
out.println(bThis is the string that will change!/b);
out.println(/body);
out.println(/html);

out.close();
}

protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, java.io.IOException
{
processRequest(request, response);
}

protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, java.io.IOException
{
processRequest(request, response);
}
}

My ant build script:

project name=Tomcat 

RE: JAXMServlet + SOAP

2002-03-18 Thread Dahnke, Eric

I recently did this by parsing the SOAP Message (via JAXM) with SAX. My
parser class happily takes an XML file or any kind of input stream, so I
just wrote the SOAP message out to a OS (did a OS - IS conversion as
follows).


// write the SOAPMessage to an OutputStream, convert that to
// a string and close the OutputStream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.writeTo(baos);
String strSOAPMsg = baos.toString();
baos.close();

// now build an InputSource to send to the SAXParser 
// from the strSOAPMsg 
StringReader chrStream = new StringReader(strSOAPMsg);
InputSource is = new InputSource(chrStream);

// this is the code to call the SAXParser (goes with the
// SAXParseHandler class) 
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser parser = spf.newSAXParser();
parser.parse(is, new SAXParseHandler());





HTH




-Original Message-
From: Paul Brown [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 1:03 PM
To: Tomcat Users List
Subject: JAXMServlet + SOAP


Hi

I've got a Servlet which extends JAXMServlet and i'm trying to
write some code to process received messages.


I am following the Sun example
http://java.sun.com/xml/jaxm-0_9_2-prd-spec.pdf


To get a DOM from a SOAPMessage you need to do this apparently:

 DOMSource domSrc = (DOMSource)
soapEnvelope.getContentAs(DOMSource.FEATURE );

However, the getContentAs method does not exist on the SOAPEnvelope.


Have any of you come across this?

Has anybody got a code sample that shows how to get a DOM from one of
the SOAP
objects in the JAXM api?

thanks
Paul

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




JDBC mSQL

2002-03-11 Thread Dahnke, Eric


Is anyone using mini-sql (mSQL) w/ jdbc. If so could you send me your driver
.jar file and an example of how you're calling it.

I've installed msql-jdbc-1-0.jar, but no matter how I call it, I get a 
Connection failed.
java.sql.SQLException: Connection failed.
at
com.imaginary.sql.msql.MsqlConnection.connect(MsqlConnection.java:328)


This is for a legacy system, I have no option of installing a different DB.

TIA

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: NEED HELP TO DEFINE ENTRY POINT FOR MY APPLICATION

2002-03-06 Thread Dahnke, Eric


Take a look at MVC architectures.



-Original Message-
From: Barney Hamish [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 9:41 AM
To: 'Tomcat Users List'
Subject: RE: NEED HELP TO DEFINE ENTRY POINT FOR MY APPLICATION


Rather than writing your own, maybe you should think about using the Struts
framework (also part of the Jakarta project). This allows you to configure
page flow etc centrally.
Hamish

-Original Message-
From: Gurmeet [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 3:32 PM
To: Tomcat Users List
Subject: NEED HELP TO DEFINE ENTRY POINT FOR MY APPLICATION


Hi,

I want to define a entry point for my application. i.e. all requests to my
application be recieved by a JSP, which then redirects to the requested
resource.

How do I do that?

Thanks in advance.

Gurmeet



-Original Message-
From: Gustavo Souza [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 7:10 PM
To: [EMAIL PROTECTED]
Subject: Just a test


hello, just a test

1º message to the list

thanks



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




mvc.gif
Description: GIF image

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]


RE: how to set env varible

2002-03-06 Thread Dahnke, Eric


This has always been a question of mine too. You've got to get the modified
environment variables (JAVA_HOME, CATALINA, etc) to the user session
starting Tomcat.

Often times I've had to reboot as all users get the env variables read to
them from /etc/profile at startup. Hope that answers your question. 

Is there not a way on linux (*nix) to broadcast new system wide environment
variables w/o logging out (that user) or su'ing to that user and manually
running export JAVA_HOME=/usr/java..

HTH

-Original Message-
From: Jianping Zhu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 6:24 PM
To: [EMAIL PROTECTED]
Subject: how to set env varible 


I have redhat 7.2.
I am istalling tomcat which need an env varible JAVA_HOME point to JDK
I need to set an env varible JAVA_HOME point to directoy /usr/java

I did this by adding 2 line to etc/profile

JAVA_HOME=/usr/java:$JAVA_HOME
export JAVA_HOME

I used source profile, it's fine.
But I try to start tomcat, it gives me error message:
JAVA_HOME env varible is not defined 



Any suggetion?
Thanks

Jianping Zhu
Department of Computer Science
Univerity of Georgia 
Athens, GA 30602
Tel 706 5423900



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: runaway process in java while using tomcat

2002-03-04 Thread Dahnke, Eric

Does the process go away or release back CPU eventually?

On what system?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 6:41 PM
To: '[EMAIL PROTECTED]'
Subject: runaway process in java while using tomcat


Hello,

I am hoping someone can help me with this problem I am having.
I am using tomcat 4.0.1 to run a web site with jsps. This site uses alot of
database connecting with Informix.
For some reason, usually within 2 hours of starting up tomcat, a process
will start to take up 100% of the CPU.
The time it takes for this to happen varies.  Ive tried to reproduce it on
a test site by myself but cannot seem to reproduce it.
It only happens when alot of users are using the site and some user seems
to be causing this to happen.
The site has alot of people hitting it because it is close to easter and
people are ordering from this site.

Well, I was wondering what could cause this runaway process in tomcat.  I
have check all my loops and logic it doesnt seem to be any infinite loops
in the code.  Has anyone else had this problem with tomcat? If anyone has a
suggestion to track this problem down or someone who has a similar problem
please respond as soon as possible.

Ive spent about 1 week on this and cant seem to find the problem.  I really
need to get this fixed immediately.

Thanks in advanced,

Dave


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Problem starting Tomcat4 (starts then stops)

2002-02-27 Thread Dahnke, Eric


Hello,

Does anyone know why upon running ./startup.sh my RH7.1 box briefly shows
some java activity, but then quits. Here is the output of ps ax. These
processes live for a few seconds then... nothing.

2836 pts/1R  0:01 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2863 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2864 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2865 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2866 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2867 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2868 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2869 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo
2870 pts/1S  0:00 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
-Xbootclasspath/p:/roo


I've seen something similar where the problem was because of a different jdk
running, but in my case there is nothing. i do a killall -9 java before
running startup.sh and still get the same problem. Nothing ever gets put
into catalina.log. TIA

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: changing a user's password on linux using jsp exec.

2002-02-14 Thread Dahnke, Eric


The only password you could ever change is the one for the user Tomcat is
running as (nobody i believe).

I've been down the road you're going down. Your options are:

-1- (compiling apache/tomcat to run as user root (unreasonable on anything
other than a intranet environment). big security hole.
-2- you can use the expect programming language. 
-3- you can hand the passwd execution to a cron job that runs as root. just
dump the user to change password into a text file. grep the text file every
5 seconds or something from cron. if an entry exists chpasswd on it and
delete the entry from the file. cron is very light weight. see man chpasswd

HTH



-Original Message-
From: Al-Qalb el-Mounir [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 1:53 PM
To: Tomcat Users List
Subject: changing a user's password on linux using jsp exec.


Is it possible? I wrote this jsp file, but nothing
seems to happen. Any ideas?

== Code ===
%@ page import=java.io.DataInputStream%
%@ page import=java.io.DataOutputStream%

%@ page import=java.io.BufferedWriter%
%@ page import=java.io.FileWriter%
%@ page import=java.io.IOException%



%

String username = TestUserId;

String old_p_word = oldPassword;

String new_p_word = newPassword;

   Process proc = null;
  
 
Runtime thisRun = Runtime.getRuntime();

String cmd = passwd  + username;

proc = thisRun.exec(cmd); 
   

//Returns a Stream connected to the output of the
child process. 
   
 DataInputStream inputstream = new
DataInputStream(proc.getInputStream());
 //Reads output from process
 
 String procOutputline = inputstream.readLine();
   
if (procOutputline != null)
{
   out.println(Process output:  +
procOutputline);
}

//Returns a Stream connected to the input of the child
process. 
//we assume user exists and that the process will ask
for the old password first.

DataOutputStream outputstream = new
DataOutputStream(proc.getOutputStream());
outputstream.writeBytes(old_p_word);

 
//read output from process. We assume that the process
will ask for the new password
 procOutputline = inputstream.readLine();

 if (procOutputline != null)
 {
out.println(Process output:  +
procOutputline);
}

//send value of new password to the process.
outputstream.writeBytes(new_p_word);


//Process should ask us to confirm the new password
//Returns a Stream connected to the output of the
child process. 

 procOutputline = inputstream.readLine();

 if (procOutputline != null)
 {
out.println(Process output:  +
procOutputline);
}

//confirm the new password to the process.
outputstream.writeBytes(new_p_word);


 //Waits for the subprocess to complete. 
 proc.waitFor();

 //Returns the exit value for the subprocess.
   out.println(Process existed with value: 
+proc.exitValue());
 
 //Returns the an InputStream connected to the error
stream of the child process. 
DataInputStream errorinputstream = new
DataInputStream(proc.getErrorStream());
 String line = errorinputstream.readLine();

 if (line != null)
 {
throw new Exception(There was a problem
changing password for :  + username +  -- + line);
 }

//out.println(The output string is
+proc.toString()); 
proc.destroy(); 
  
  
%

= End of code.



__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: changing a user's password on linux using jsp exec.

2002-02-14 Thread Dahnke, Eric


Do a man chpasswd from the linux command line. See the format it expects
(user_name:password). Just write the username and pw into a file using that
format from your tomcat app. (say the file is: /tmp/new_pw). chown new_pw to
nobody.nobody or chmod it 666.

Then in your /etc/crontab file add:

05 * * * * root chpasswd /tmp/new_pw

This will run the chpasswd as root every 5 seconds. Actually rather than
calling chpasswd from cron I would create a shell script that does some
checking to make sure that your web app isn't trying to change the pw for
root or any other important system users. And that also empties the file
new_pw after chpasswd is run. Be careful. Don't look yourself out of your
machine on my account ;-






-Original Message-
From: Al-Qalb el-Mounir [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 2:30 PM
To: Tomcat Users List
Subject: RE: changing a user's password on linux using jsp exec.


Hi Dahnke,
The cron idea seems interesting. Do you have something
working? Or even an example for me to follow.

Thanks.


--- Dahnke, Eric [EMAIL PROTECTED] wrote:
 
 The only password you could ever change is the one
 for the user Tomcat is
 running as (nobody i believe).
 
 I've been down the road you're going down. Your
 options are:
 
 -1- (compiling apache/tomcat to run as user root
 (unreasonable on anything
 other than a intranet environment). big security
 hole.
 -2- you can use the expect programming language. 
 -3- you can hand the passwd execution to a cron job
 that runs as root. just
 dump the user to change password into a text file.
 grep the text file every
 5 seconds or something from cron. if an entry exists
 chpasswd on it and
 delete the entry from the file. cron is very light
 weight. see man chpasswd
 
 HTH
 
 
 
 -Original Message-
 From: Al-Qalb el-Mounir [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 14, 2002 1:53 PM
 To: Tomcat Users List
 Subject: changing a user's password on linux using
 jsp exec.
 
 
 Is it possible? I wrote this jsp file, but nothing
 seems to happen. Any ideas?
 
 == Code ===
 %@ page import=java.io.DataInputStream%
 %@ page import=java.io.DataOutputStream%
 
 %@ page import=java.io.BufferedWriter%
 %@ page import=java.io.FileWriter%
 %@ page import=java.io.IOException%
 
 
 
 %
 
 String username = TestUserId;
 
 String old_p_word = oldPassword;
 
 String new_p_word = newPassword;
 
Process proc = null;
   

 Runtime thisRun = Runtime.getRuntime();
 
 String cmd = passwd  + username;
 
 proc = thisRun.exec(cmd); 

 
 //Returns a Stream connected to the output of the
 child process. 

  DataInputStream inputstream = new
 DataInputStream(proc.getInputStream());
  //Reads output from process
  
  String procOutputline = inputstream.readLine();

 if (procOutputline != null)
 {
out.println(Process output:  +
 procOutputline);
 }
 
 //Returns a Stream connected to the input of the
 child
 process. 
 //we assume user exists and that the process will
 ask
 for the old password first.
 
 DataOutputStream outputstream = new
 DataOutputStream(proc.getOutputStream());
 outputstream.writeBytes(old_p_word);
 
  
 //read output from process. We assume that the
 process
 will ask for the new password
  procOutputline = inputstream.readLine();
 
  if (procOutputline != null)
  {
 out.println(Process output:  +
 procOutputline);
 }
 
 //send value of new password to the process.
 outputstream.writeBytes(new_p_word);
 
 
 //Process should ask us to confirm the new password
 //Returns a Stream connected to the output of the
 child process. 
 
  procOutputline = inputstream.readLine();
 
  if (procOutputline != null)
  {
 out.println(Process output:  +
 procOutputline);
 }
 
 //confirm the new password to the process.
 outputstream.writeBytes(new_p_word);
 
 
  //Waits for the subprocess to complete. 
  proc.waitFor();
 
  //Returns the exit value for the subprocess.
out.println(Process existed with value: 
 +proc.exitValue());
  
  //Returns the an InputStream connected to the error
 stream of the child process. 
 DataInputStream errorinputstream = new
 DataInputStream(proc.getErrorStream());
  String line = errorinputstream.readLine();
 
  if (line != null)
  {
 throw new Exception(There was a problem
 changing password for :  + username +  -- +
 line);
  }
 
 //out.println(The output string is
 +proc.toString()); 
 proc.destroy(); 
   
   
 %
 
 = End of code.
 
 
 
 __
 Do You Yahoo!?
 Send FREE Valentine eCards with Yahoo! Greetings!
 http://greetings.yahoo.com
 
 --
 To unsubscribe:  
 mailto:[EMAIL PROTECTED]
 For additional commands:
 mailto:[EMAIL PROTECTED]
 Troubles with the list:
 mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe:  
 mailto:[EMAIL PROTECTED

RE: How can I tell who is connecting to the database?

2002-02-13 Thread Dahnke, Eric


You can turn on logging with MySQL with the -l flag. I'll assume you're
running on a unix* system.

Where MySQL starts up add a -l flag to it. Below is how it is on my machine
(linux RPM install)

$bindir/safe_mysqld -l --datadir=$datadir --pid-file=$pid_file 

then your log file will be created in /var/lib/mysql/your_host_name.log

HTH

-Original Message-
From: Brandon Cruz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 10:59 AM
To: Tomcat Users List
Subject: RE: How can I tell who is connecting to the database?


I am using mySQL.  Is there any java method that can distinguish these
computers?

-Original Message-
From: Reynir Hübner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 6:55 PM
To: Tomcat Users List
Subject: RE: How can I tell who is connecting to the database?


dependes on the database you are using I guess..
.. which one are you using ?




 -Original Message-
 From: Brandon Cruz [mailto:[EMAIL PROTECTED]]
 Sent: 13. febrúar 2002 01:00
 To: Tomcat Users List
 Subject: How can I tell who is connecting to the database?


 If several developers are connecting to the database using
 tomcat 3.2.4 on
 localhost, is there a way to tell which computer is actually
 connecting?
 When I try to get IP, it is always the same since they are at
 localhost.

 Please help!!!

 Brandon


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Sharing a bean between servlet and jsp. Arrggghhhhh

2002-02-11 Thread Dahnke, Eric

Now I'm going crazy. This can't be so hard. Please help... I can't figure
this out. I'm trying to share a bean between a jsp page and servlet.
Arggh... Please I help on other lists... and donate time to
charity. I've been to Barnes and Noble and looked at a heap of texts. I've
done no less than 500 Google searches.


There are no errors, I just can't get this jsp:getProperty
name=myFormBean property=userName / goddamned thing to display the
userName bean property if fb.validate() fails. Everything works. I've got
this begugger and can see the userName variable throughout the POST process.
Everything's cool until the rd.forward (request, response), but once the
forward takes place my jsp cannot again pick up the bean properties
eventhough I say jsp:useBean id=myFormBean class=beans.FormBean
scope=session/ I've tried every scope, and am using beans with straight
JSP no problem (same application).

Any ideas? Millions of Thanks


Here's the JSP page.
===
jsp:useBean id=myFormBean class=beans.FormBean scope=session/
form method=POST action=controller
input type=text name=userName
jsp:getProperty name=myFormBean property=userName /
input type=hidden name=event value=FORM_TEST
input type=submit name=submit value=next
/form

Here's the two relavant parts of the servlet.

public void process (ServletContext sc, HttpServletRequest request,
  HttpServletResponse response)
  throws IOException, ServletException {

FormBean fb = new FormBean();
fb.setUserName(request.getParameter(userName));

if (fb.validate()) {
URL = index.jsp;
} else {
// go back
URL = signup1.jsp;
}
}
public void forward (HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException {

RequestDispatcher rd = request.getRequestDispatcher(URL);
rd.forward (request, response);
}

Here's the bean
===
package beans;
public class FormBean implements java.io.Serializable {
public String userName;
public FormBean() {}
public boolean validate() {
boolean allOk=false;
return allOk;
}

public String getUserName() {
//return this.userName; // doesn't work either
return userName;
}
public void setUserName(String uname) {
this.userName = uname;
}
}

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Using a JavaBean from within a servlet

2002-02-10 Thread Dahnke, Eric

Hello,

This is killing me. I've got a form that posts to a servlet. I simply want
to get the form variables into a bean's properties. 

I can find only one reference to what I'm trying to do here. it is a
formToBean() method from a FormUtils package, that some company sells.
Reading form variables into and out of javabean from a servlet has to be a
common activity. I can find heaps of info about using beans from JSP pages
(specifically about introspection), but I need to manipulate bean properties
from both Servlets and or JSPs. How do I do the introspection thing within a
servlet?




Code included below. 


JSP Post to a Servlet. - Servlet instantiates a FormBean -
FormBean.validate() is called. - but the validate() is always false because
the bean property vals are empty. Do I have to explicitly read each
request.getParameter(FORM_VAR) and set that to a bean property?

// from the servlet
//
FormBean fb = new FormBean();
fb.setProperty(*); // * this aint workin - here *
if (fb.validate()) { 
URL = WELCOME;
} else {
// go back
URL = INDEX;  
}


// from FormBean 
//
private String UserName;
private String Password;

public boolean validate() {
Debug.log (this, validate,GETTING THIS FAR AT LEAST);

boolean allOk=true;
if (UserName.equals()) {
errors.put(UserName,Please enter a username);
//UserName=;
allOk=false;
}
if (Password.equals() ) {
errors.put(Password,Please enter a valid
password);
Password=;
allOk=false;
}
return allOk;
}

public void setUserName(String uname) {
UserName = uname;
}
public void setPassword(String pword) {
Password =pword;
}

public String getUserName() {
return UserName;
}
public String getPassword() {
return Password;
}



SORRY IF THIS IS MORE OF A STRAIGHT JAVA QUESTION THAN A TOMCAT QUESTION. I
AM USING TOMCAT. JI JI. TIA.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Using a JavaBean from within a servlet

2002-02-10 Thread Dahnke, Eric


Thanks a lot,

how might I get at that FormBean instance from either the Welcome or Index
jsp pages per the example below?

I have properties in the FormBean class pertaining to error_msgs and such
I'd like to get from the jsp. For the instance of the FormBean object that
validate() was run on.


Regads, eric

 
-Original Message-
From: Charles Baker [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 10, 2002 7:28 PM
To: Tomcat Users List
Subject: Re: Using a JavaBean from within a servlet



--- Dahnke, Eric [EMAIL PROTECTED] wrote:
 Hello,
 
 This is killing me. I've got a form that posts to a
 servlet. I simply want
 to get the form variables into a bean's properties. 
 
 I can find only one reference to what I'm trying to
 do here. it is a
 formToBean() method from a FormUtils package, that
 some company sells.
 Reading form variables into and out of javabean from
 a servlet has to be a
 common activity. I can find heaps of info about
 using beans from JSP pages
 (specifically about introspection), but I need to
 manipulate bean properties
 from both Servlets and or JSPs. How do I do the
 introspection thing within a
 servlet?
 
 
 
 
 Code included below. 
 
 
 JSP Post to a Servlet. - Servlet instantiates a
 FormBean -
 FormBean.validate() is called. - but the validate()
 is always false because
 the bean property vals are empty. Do I have to
 explicitly read each
 request.getParameter(FORM_VAR) and set that to a
 bean property?
 
 // from the servlet
 //
 FormBean fb = new FormBean();
 fb.setProperty(*); // * this aint workin - here
 *
 if (fb.validate()) { 
   URL = WELCOME;
 } else {
   // go back
   URL = INDEX;  
 }
 
 
 // from FormBean 
 //
 private String UserName;
 private String Password;
 
 public boolean validate() {
   Debug.log (this, validate,GETTING THIS FAR AT
 LEAST);
 
   boolean allOk=true;
   if (UserName.equals()) {
   errors.put(UserName,Please enter a
 username);
   //UserName=;
   allOk=false;
   }
   if (Password.equals() ) {
   errors.put(Password,Please enter a valid
 password);
   Password=;
   allOk=false;
   }
   return allOk;
 }
 
 public void setUserName(String uname) {
   UserName = uname;
 }
 public void setPassword(String pword) {
   Password =pword;
 }
 
 public String getUserName() {
   return UserName;
 }
 public String getPassword() {
   return Password;
 }
 
 
SNIP

What I do is something like this:

// assuming we are creating a new session for login
HttpSession session = request.getSession(true);

FormBean formBean = new FormBean();

formBean.setUserName(
request.getParameter(userName));

formBean.setPassword(request.getParameter(password));

if ( formBean.validate()) {

session.setAttribute(formBean, formBean);
URL = Welcome;

} else {

URL = Index;

}

=
[EMAIL PROTECTED]
Hacking is a Good Thing!
See http://www.tuxedo.org/~esr/faqs/hacker-howto.html

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]