You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Katherine Barry <kb...@ss8networks.com> on 2000/11/22 16:14:05 UTC

Action.xml

I want to break this file up into several files. Anyone know how to do this?

Katherine

Re: Action.xml

Posted by ma...@tumbleweed.com.
Here's a link to the Ant FAQ item on this:

http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayQuestionAnswer/action/SetAll/project_id/2/faq_id/16/topic_id/196/question_id/752

Hope this helps.

--
Martin Cooper
Tumbleweed Communications


At 01:28 PM 11/22/00 -0800, Craig R. McClanahan wrote:
>Katherine Barry wrote:
>
> > Craig,
> > The second approach is the one I am trying, but the problem is that the XML
> > syntax is in the DOCTYPE declaration. There isn't one in the action.xml. I
> > can add a declaration with the external file, and then reference it later,
> > but it still doesn't work.
> >
>
>Hmm, I thought I had seen references on the Ant mailing list to examples doing
>this.  Ant is in the same boat that Struts 0.5 is -- there is no DTD.
>
>In Struts 1.0, there is a DTD for the configuration file (which is now
>traditionally called "struts-config.xml" because it configures more than just
>actions), so you will be able to use a DOCTYPE declaration.
>
> >
> > Katherine
> >
>
>Craig



RE: need some explanations

Posted by Vilavanh Messien <vi...@agora.ulaval.ca>.
Thanks for your advice !
Nevertheless, I'd like to understand the mechanism used in the example.
The load() method of DatabaseServlet is called during the init(). Thats'ok.
But I don't know how to pass my parameters to the servlet in order to store
them in a file.
Could you explain me how it works ?

-----Message d'origine-----
De : Jim Richards [mailto:grumpy@cyber4.org]
Envoyé : 23 novembre, 2000 20:40
À : struts-user@jakarta.apache.org
Objet : Re: need some explanations



It's really only for an example. It you want real
object persistence, you'll need to develop your
owne layer. Something like EJB's will make this much,
much easier. Or some direct JDBC code perhaps.

Vilavanh Messien wrote:
>
> I analyzed the struts example in order to develop my own small
application.
> Unfortunatelaty, I don't really understand how the user's information are
> saved
> in the "database.xml" file.
> The DatabaseServlet must write the information in the "database.xml" when
> the destroy() method
> is called.
> My question is how to make the destroy() method perform ?
>
> How can I do to pass some arguments to the DatabaseServlet ?
>
> Thanks
>
> Vilavanh


Re: need some explanations

Posted by Jim Richards <gr...@cyber4.org>.
It's really only for an example. It you want real
object persistence, you'll need to develop your
owne layer. Something like EJB's will make this much,
much easier. Or some direct JDBC code perhaps.

Vilavanh Messien wrote:
> 
> I analyzed the struts example in order to develop my own small application.
> Unfortunatelaty, I don't really understand how the user's information are
> saved
> in the "database.xml" file.
> The DatabaseServlet must write the information in the "database.xml" when
> the destroy() method
> is called.
> My question is how to make the destroy() method perform ?
> 
> How can I do to pass some arguments to the DatabaseServlet ?
> 
> Thanks
> 
> Vilavanh

Re: need some explanations

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Vilavanh Messien wrote:

> Actually, I'm using Tomcat 3.2.
> If the prob comes from Tomcat, why the struts example has no trouble with it
> ?
>

The bug doesn't bite everyone -- whether or not your struts-example gets shut
down correctly or not depends on what other web apps are defined in the same
Tomcat installation (technically, it depends on the order in which the web apps
are enumerated in a Hashtable, plus which JVM you are running).

At any rate, the only damage this bug does is it will fail to save any changes
to the "users" or "subscriptions" that took place.  The application itself still
works OK.

Of course, as others have pointed out, this is only an example app anyway -- a
real system would use a database.  I just wanted something self contained, that
would run "out of the box" in most circumstances.

Craig



RE: need some explanations

Posted by Vilavanh Messien <vi...@agora.ulaval.ca>.
Actually, I'm using Tomcat 3.2.
If the prob comes from Tomcat, why the struts example has no trouble with it
?

-----Message d'origine-----
De : Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Envoyé : 24 novembre, 2000 16:00
À : struts-user@jakarta.apache.org
Objet : Re: need some explanations


Vilavanh Messien wrote:

> If I understand, destroy() should be called when the servlet container
(i.e
> Tomcat) is shutdown.
> But, in my small application, destroy() seems not to be called so that
> information cannot be
> written database.xml.
> I didn't manage to find where my error is.
>

Tomcat 3.2, right?  There was a bug in Tomcat that causes this.  It was
recently
fixed, and will work correctly in the upcoming final release.

>
> Thanks
>

Craig


>
> -----Message d'origine-----
> De : Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Envoyé : 24 novembre, 2000 15:33
> À : struts-user@jakarta.apache.org
> Objet : Re: need some explanations
>
> Vilavanh Messien wrote:
>
> > I analyzed the struts example in order to develop my own small
> application.
> > Unfortunatelaty, I don't really understand how the user's information
are
> > saved
> > in the "database.xml" file.
> > The DatabaseServlet must write the information in the "database.xml"
when
> > the destroy() method
> > is called.
> > My question is how to make the destroy() method perform ?
> >
>
> The destroy() method is called by the servlet container, when it removes
> this
> servlet from service or when the application is shut down.  Typically,
> server
> shutdown is the *only* time that a servlet is removed and destroy() is
> called.
>
> >
> > How can I do to pass some arguments to the DatabaseServlet ?
> >
>
> This is done by adding <init-param> entries in the WEB-INF/web.xml file.
> See
> the Servlet API Specification, version 2.2, for the details -- you can
> download
> it at:
>
>     http://java.sun.com/products/servlet/download.html
>
> There are also a growing number of articles and books covering the servlet
> 2.2
> API that discusses this kind of thing.  I would try looking for "web.xml"
in
> your favorite search engine, as a starting point.
>
> >
> > Thanks
> >
> > Vilavanh
>
> Craig McClanahan


Re: need some explanations

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Vilavanh Messien wrote:

> If I understand, destroy() should be called when the servlet container (i.e
> Tomcat) is shutdown.
> But, in my small application, destroy() seems not to be called so that
> information cannot be
> written database.xml.
> I didn't manage to find where my error is.
>

Tomcat 3.2, right?  There was a bug in Tomcat that causes this.  It was recently
fixed, and will work correctly in the upcoming final release.

>
> Thanks
>

Craig


>
> -----Message d'origine-----
> De : Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Envoyé : 24 novembre, 2000 15:33
> À : struts-user@jakarta.apache.org
> Objet : Re: need some explanations
>
> Vilavanh Messien wrote:
>
> > I analyzed the struts example in order to develop my own small
> application.
> > Unfortunatelaty, I don't really understand how the user's information are
> > saved
> > in the "database.xml" file.
> > The DatabaseServlet must write the information in the "database.xml" when
> > the destroy() method
> > is called.
> > My question is how to make the destroy() method perform ?
> >
>
> The destroy() method is called by the servlet container, when it removes
> this
> servlet from service or when the application is shut down.  Typically,
> server
> shutdown is the *only* time that a servlet is removed and destroy() is
> called.
>
> >
> > How can I do to pass some arguments to the DatabaseServlet ?
> >
>
> This is done by adding <init-param> entries in the WEB-INF/web.xml file.
> See
> the Servlet API Specification, version 2.2, for the details -- you can
> download
> it at:
>
>     http://java.sun.com/products/servlet/download.html
>
> There are also a growing number of articles and books covering the servlet
> 2.2
> API that discusses this kind of thing.  I would try looking for "web.xml" in
> your favorite search engine, as a starting point.
>
> >
> > Thanks
> >
> > Vilavanh
>
> Craig McClanahan


RE: need some explanations

Posted by Vilavanh Messien <vi...@agora.ulaval.ca>.
If I understand, destroy() should be called when the servlet container (i.e
Tomcat) is shutdown.
But, in my small application, destroy() seems not to be called so that
information cannot be
written database.xml.
I didn't manage to find where my error is.

Thanks

-----Message d'origine-----
De : Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Envoyé : 24 novembre, 2000 15:33
À : struts-user@jakarta.apache.org
Objet : Re: need some explanations


Vilavanh Messien wrote:

> I analyzed the struts example in order to develop my own small
application.
> Unfortunatelaty, I don't really understand how the user's information are
> saved
> in the "database.xml" file.
> The DatabaseServlet must write the information in the "database.xml" when
> the destroy() method
> is called.
> My question is how to make the destroy() method perform ?
>

The destroy() method is called by the servlet container, when it removes
this
servlet from service or when the application is shut down.  Typically,
server
shutdown is the *only* time that a servlet is removed and destroy() is
called.

>
> How can I do to pass some arguments to the DatabaseServlet ?
>

This is done by adding <init-param> entries in the WEB-INF/web.xml file.
See
the Servlet API Specification, version 2.2, for the details -- you can
download
it at:

    http://java.sun.com/products/servlet/download.html

There are also a growing number of articles and books covering the servlet
2.2
API that discusses this kind of thing.  I would try looking for "web.xml" in
your favorite search engine, as a starting point.

>
> Thanks
>
> Vilavanh

Craig McClanahan



Re: need some explanations

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Vilavanh Messien wrote:

> I analyzed the struts example in order to develop my own small application.
> Unfortunatelaty, I don't really understand how the user's information are
> saved
> in the "database.xml" file.
> The DatabaseServlet must write the information in the "database.xml" when
> the destroy() method
> is called.
> My question is how to make the destroy() method perform ?
>

The destroy() method is called by the servlet container, when it removes this
servlet from service or when the application is shut down.  Typically, server
shutdown is the *only* time that a servlet is removed and destroy() is called.

>
> How can I do to pass some arguments to the DatabaseServlet ?
>

This is done by adding <init-param> entries in the WEB-INF/web.xml file.  See
the Servlet API Specification, version 2.2, for the details -- you can download
it at:

    http://java.sun.com/products/servlet/download.html

There are also a growing number of articles and books covering the servlet 2.2
API that discusses this kind of thing.  I would try looking for "web.xml" in
your favorite search engine, as a starting point.

>
> Thanks
>
> Vilavanh

Craig McClanahan



need some explanations

Posted by Vilavanh Messien <vi...@agora.ulaval.ca>.
I analyzed the struts example in order to develop my own small application.
Unfortunatelaty, I don't really understand how the user's information are
saved
in the "database.xml" file.
The DatabaseServlet must write the information in the "database.xml" when
the destroy() method
is called.
My question is how to make the destroy() method perform ?

How can I do to pass some arguments to the DatabaseServlet ?

Thanks

Vilavanh


Re: Action.xml

Posted by Wong Kok Wai <wo...@pacific.net.sg>.
Using XInclude is the solution but I don't know whether Xerces support XInclude or
not.

Katherine Barry wrote:

> What I've got is:
>
> Action.xml:
>
> <!DOCTYPE action [
>         <!ENTITY deployment SYSTEM "file:./deploymentaction.xml">
> ]>
> <action-mappings>
>         <!-- Default Forward when mapping.findForward() does not find a forward
> name   -->
>         <forward name="home" path="/home.jsp"/>
>         &deployment;
>         <!--Search Schedule -->
>         <action ....
>         </action>
> </action-mappings>
>
> ------------------------------------------
> I've had to add the DOCTYPE declaration since the action.xml doesn't
> normally have one.
>
> This causes a parsing error on startup. I've tried referencing deployment
> with %(%deployment instead of &deployment)-> can't find the path when I run
> it. I've tried different names for the doctype, doesn't care. Suggestions?
>
> Katherine
>
> -----Original Message-----
> From: Martin Cooper [mailto:martin.cooper@tumbleweed.com]
> Sent: Wednesday, November 22, 2000 5:53 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: Action.xml
>
> Craig & Katherine,
>
> Here's a message from ant-user that describes how to do this (for Ant, at
> least, although it should work for action.xml as well).
>
> --
> Martin Cooper
> Tumbleweed Communications
>
> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@bost.de>
> To: <an...@jakarta.apache.org>
> Sent: Friday, October 13, 2000 12:50 AM
> Subject: Re: including other build files
>
> > I've added an entry for this to the FAQ but unfortuately it hasn't
> > been approved yet (I have no influence on this).
> >
> > Stefan
> >
> > -------------------------------------------------------------------------
> >
> > How do I include another fragment of a buildfile?
> >
> > You can use XML's way of including external files and let the parser
> > do the job for Ant:
> >
> > <?xml version="1.0"?>
> >
> > <!DOCTYPE project [
> >     <!ENTITY common SYSTEM "file:./common.xml">
> > ]>
> >
> > <project name="test" default="test" basedir=".">
> >
> >   <target name="setup">
> >     ...
> >   </target>
> >
> >   &common;
> >
> >   ...
> >
> > </project>
> >
> > will literally include the contents of common.xml where you've placed
> > the &common; entity.
> >
> > In combination with a DTD this would look like this:
> >
> > <!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "file:./ant.dtd" [
> >    <!ENTITY include SYSTEM "file:./header.xml">
> > ]>


RE: Action.xml

Posted by Katherine Barry <kb...@ss8networks.com>.
What I've got is:

Action.xml:

<!DOCTYPE action [
	<!ENTITY deployment SYSTEM "file:./deploymentaction.xml">
]>
<action-mappings>
	<!-- Default Forward when mapping.findForward() does not find a forward
name   -->
	<forward name="home" path="/home.jsp"/>
	&deployment;
	<!--Search Schedule -->
	<action ....
	</action>
</action-mappings>

------------------------------------------
I've had to add the DOCTYPE declaration since the action.xml doesn't
normally have one.

This causes a parsing error on startup. I've tried referencing deployment
with %(%deployment instead of &deployment)-> can't find the path when I run
it. I've tried different names for the doctype, doesn't care. Suggestions?

Katherine

-----Original Message-----
From: Martin Cooper [mailto:martin.cooper@tumbleweed.com]
Sent: Wednesday, November 22, 2000 5:53 PM
To: struts-user@jakarta.apache.org
Subject: Re: Action.xml


Craig & Katherine,

Here's a message from ant-user that describes how to do this (for Ant, at
least, although it should work for action.xml as well).

--
Martin Cooper
Tumbleweed Communications

----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Friday, October 13, 2000 12:50 AM
Subject: Re: including other build files


> I've added an entry for this to the FAQ but unfortuately it hasn't
> been approved yet (I have no influence on this).
>
> Stefan
>
> -------------------------------------------------------------------------
>
> How do I include another fragment of a buildfile?
>
> You can use XML's way of including external files and let the parser
> do the job for Ant:
>
> <?xml version="1.0"?>
>
> <!DOCTYPE project [
>     <!ENTITY common SYSTEM "file:./common.xml">
> ]>
>
> <project name="test" default="test" basedir=".">
>
>   <target name="setup">
>     ...
>   </target>
>
>   &common;
>
>   ...
>
> </project>
>
> will literally include the contents of common.xml where you've placed
> the &common; entity.
>
> In combination with a DTD this would look like this:
>
> <!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "file:./ant.dtd" [
>    <!ENTITY include SYSTEM "file:./header.xml">
> ]>





Re: Action.xml

Posted by Martin Cooper <ma...@tumbleweed.com>.
Craig & Katherine,

Here's a message from ant-user that describes how to do this (for Ant, at
least, although it should work for action.xml as well).

--
Martin Cooper
Tumbleweed Communications

----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Friday, October 13, 2000 12:50 AM
Subject: Re: including other build files


> I've added an entry for this to the FAQ but unfortuately it hasn't
> been approved yet (I have no influence on this).
>
> Stefan
>
> -------------------------------------------------------------------------
>
> How do I include another fragment of a buildfile?
>
> You can use XML's way of including external files and let the parser
> do the job for Ant:
>
> <?xml version="1.0"?>
>
> <!DOCTYPE project [
>     <!ENTITY common SYSTEM "file:./common.xml">
> ]>
>
> <project name="test" default="test" basedir=".">
>
>   <target name="setup">
>     ...
>   </target>
>
>   &common;
>
>   ...
>
> </project>
>
> will literally include the contents of common.xml where you've placed
> the &common; entity.
>
> In combination with a DTD this would look like this:
>
> <!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "file:./ant.dtd" [
>    <!ENTITY include SYSTEM "file:./header.xml">
> ]>




Re: Hopefully a simple problem with 0.5

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Doug Ahmann wrote:

> Sorry to spam you all with what I hope is a simple config issue:
>
> Error: 500
> Location: /vserver/login.jsp
> Internal Servlet Error:
>
> org.apache.jasper.JasperException: Unable to open taglibrary
> /WEB-INF/struts.tld : Parse Error in the tag library descriptor: Element
> "web-app" does not allow "servlet" here.
>         at

Ooh ooh ... I know this one :-)

You are running under Tomcat 3.something, right?  Well, it turns out that Tomcat does
not validate the web.xml file when it loads your web application.  However, when you
use a JSP page with a custom tag, the JSP page compiler parses web.xml again (to find
taglib declarations), and it *does* call the validating parser.  That means you need to
have the elements in the web.xml file in the order required by the DTD.  In your case,
you have a <servlet> element out of place.

In Tomcat 4.0, a validating parser is called even the first time that web.xml is read,
so that you will find out about such problems immediately.

> Doug

Craig



Hopefully a simple problem with 0.5

Posted by Doug Ahmann <da...@macromedia.com>.
Sorry to spam you all with what I hope is a simple config issue:

Error: 500
Location: /vserver/login.jsp
Internal Servlet Error:

org.apache.jasper.JasperException: Unable to open taglibrary
/WEB-INF/struts.tld : Parse Error in the tag library descriptor: Element
"web-app" does not allow "servlet" here.
	at
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
ntListener.java:672)
	at
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
ener.java:116)
	at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1073)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1034)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182)
	at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
	at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:149)
	at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:161)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
	at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
	at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
	at java.lang.Thread.run(Thread.java:484)


Anybody know a quick and dirty solution to this? I have done what I think
are all the correct configuration items in web.xml and friends.

Thanks,
Doug


Re: Action.xml

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Katherine Barry wrote:

> Craig,
> The second approach is the one I am trying, but the problem is that the XML
> syntax is in the DOCTYPE declaration. There isn't one in the action.xml. I
> can add a declaration with the external file, and then reference it later,
> but it still doesn't work.
>

Hmm, I thought I had seen references on the Ant mailing list to examples doing
this.  Ant is in the same boat that Struts 0.5 is -- there is no DTD.

In Struts 1.0, there is a DTD for the configuration file (which is now
traditionally called "struts-config.xml" because it configures more than just
actions), so you will be able to use a DOCTYPE declaration.

>
> Katherine
>

Craig



RE: Action.xml

Posted by Katherine Barry <kb...@ss8networks.com>.
Craig,
The second approach is the one I am trying, but the problem is that the XML
syntax is in the DOCTYPE declaration. There isn't one in the action.xml. I
can add a declaration with the external file, and then reference it later,
but it still doesn't work.

Katherine

-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: Wednesday, November 22, 2000 2:37 PM
To: struts-user@jakarta.apache.org
Subject: Re: Action.xml


Katherine Barry wrote:

> I want to break this file up into several files. Anyone know how to do
this?
>
> Katherine

Offhand, I can think of at least two approaches:

* Store the pieces of action.xml in separate text files, and then
  have (as part of your build script) a command that combines them.

* There is some XML syntax that I don't remember off the top of
  my head that essentially does an "include" type operation inside
  the parser.

Craig McClanahan




Re: Action.xml

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Katherine Barry wrote:

> I want to break this file up into several files. Anyone know how to do this?
>
> Katherine

Offhand, I can think of at least two approaches:

* Store the pieces of action.xml in separate text files, and then
  have (as part of your build script) a command that combines them.

* There is some XML syntax that I don't remember off the top of
  my head that essentially does an "include" type operation inside
  the parser.

Craig McClanahan