Re: Module and pages Behind WEB-INF don't work...???

2004-08-08 Thread puneet . a

Thanks for the help..yes it works that
way...!!!

Puneet Agarwal
Tata Consultancy Services
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com





Jurn Ho <[EMAIL PROTECTED]>

07/29/2004 07:06 PM




Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>





To
"Struts Users Mailing
List" <[EMAIL PROTECTED]>


cc



Subject
Re: Module and pages Behind
WEB-INF don't work...???








Hi Puneet,

I was just playing with hiding JSP beneath WEB-INF/ and Modules today.

What you can do is edit your struts-module-config.xml
and as part of the  you can add the forwardPattern property

e.g. My setup is  
value="/WEB-INF/jsp$M$P"/>, so that my forward paths don't
contain the 
WEB-INF/jsp

read section 5.2.1 at http://struts.apache.org/userGuide/configuration.html
$M is module, and $P is path
By default it is "$M$P" like you have found out, but you're probably
after $P.

I think you might need to add this to each struts module config.xml that

you do. Does anyone know if you can set default controller properties for

all modules-config.xml?

cya,
Jurn

At 04:48 PM 29/07/2004, [EMAIL PROTECTED] wrote:

>I want to do both "hide my JSPs behind WEB-INF" and use "Struts
modules".
>
>and this does not work, I looked into the struts code. it does the
following
>
>If the path of ActionForward starts with "/", it obtains
the module prefix 
>and prefixes this to the path so...
>If my path was say "/WEB-INF/pages/INY0010S.jsp" it becomes

>"/iny/WEB-INF/pages/INY0010S.jsp"
>( which is unwanted..I wanted..."/WEB-INF/pages/INY0010S.jsp"
)
>
>
>but if the path of ActionForward does not start with "/",
it leaves the 
>path as it is ( i.e. does not prefix the module-prefix)
>but then the requested URI becomes like this
>
>http://:/
>
>instead of
>
>http://://
>
>so the problem is there is no slash - "/" before ""
>
>so if my path was "WEB-INF/pages/INY0010S.jsp" it searches
for 
>"http://:/WEB-INF/pages/INY0010S.jsp"
>which gives error...Can anyone suggest the way out..?
>
>or does this require a fix ? only a Quick resolution of this will be
able 
>help.
>
>Regards,
>Puneet Agarwal
>Tata Consultancy Services
>Mailto: [EMAIL PROTECTED]
>Website: http://www.tcs.com
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


ForwardSourceID:NT3BD2
   
DISCLAIMER: The information contained in this message is intended only and solely for 
the addressed individual or entity indicated in this message and for the exclusive use 
of the said addressed individual or entity indicated in this message (or responsible 
for delivery
of the message to such person) and may contain legally privileged and confidential 
information belonging to Tata Consultancy Services. It must not be printed, read, 
copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person 
other than the
addressee. Unauthorized use, disclosure or copying is strictly prohibited and may 
constitute unlawful act and can possibly attract legal action, civil and/or criminal. 
The contents of this message need not necessarily reflect or endorse the views of Tata 
Consultancy Services
on any subject matter.]
Any action taken or omitted to be taken based on this message is entirely at your risk 
and neither the originator of this message nor Tata Consultancy Services takes any 
responsibility or liability towards the same. Opinions, conclusions and any other
information contained in this message that do not relate to the official business of 
Tata Consultancy Services shall be understood as neither given nor endorsed by Tata 
Consultancy Services or any affiliate of Tata Consultancy Services. If you have 
received this message in error,
you should destroy this message and may please notify the sender by e-mail. Thank you.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: null pointer --org.apache.commons.digester.Digester.getXMLReader(Digester.java:902)

2004-08-08 Thread tiwari.rajeev

Could you please check web.xml file, specifically if any hardcoded path
is defined over there.

- regards

Raj
(+91-11-31261821)

-Original Message-
From: Shilpa Nalgonda [mailto:[EMAIL PROTECTED]
Sent: Friday, August 06, 2004 9:53 PM
To: Struts Users Mailing List
Subject: FW: null pointer
--org.apache.commons.digester.Digester.getXMLReader(Digester.java:902)


I am trying to deploy my prototype shoppingcart application onto linux
environment , i am using apache tomcat4.0.4, and struts 1.1.  The same
application was deployed successfully on windows.  I have copied
prototype.war into /var/lib/tomcat4/webapps.
restarted tomcat as /etc/init.d/tomcat4 restart and it does not work.  I
please help.
And i get this error in log file :...localhost_log.2004-08-06.txt


==
2004-08-06 03:32:25 StandardContext[/prototype]: Servlet /prototype
threw
load()
 exception
javax.servlet.ServletException: Servlet.init() for servlet action threw
exceptio
n
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:946)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:81
0)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3279)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3
421)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
5)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:478)

at
org.apache.catalina.core.StandardHost.install(StandardHost.java:738)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:324
)
at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:389)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:232)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:155)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)

at
org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)

at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343
)
at
org.apache.catalina.core.StandardService.start(StandardService.java:3
88)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:506
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at
org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
- Root Cause -
- Root Cause -
java.lang.NullPointerException
at
org.apache.commons.digester.Digester.getXMLReader(Digester.java:902)
at
org.apache.commons.digester.Digester.parse(Digester.java:1567)
at
org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java
:1433)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:466)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:918)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:81
0)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3279)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3
421)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
5)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:478)

at
org.apache.catalina.core.StandardHost.install(StandardHost.java:738)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:324
)
at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:389)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:232)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:155)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)

at
org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)

at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343
)
at
org.apache.catalina.core.StandardService.start(StandardService.java:3
88)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:506
)

Re: Struts, checkbox and optionally displaytag

2004-08-08 Thread Koon Yue Lam
Hi !

>From your question, I guess that you need a multiple of checkboxes, so
you need  instead of 

for your reference:
http://struts.apache.org/userGuide/struts-html.html#multibox

and a wonderful example:
http://j2ee.lagnada.com/struts/multibox-example1.htm

you would need an action form, which contains 2 arrays (normally they
would be String array)
eg. an Action form called FrmMultiBox with properties :
String [] options; String[] selected;

options[] is holding the "options" of the checkboxes that user going to select
selected[] would be populated by Struts after form submission, value
of selected[] is the value of "checked" checkboxes.

so if options = new String {"1", "2", "3"} (you can made them final or
load the values from another Action dynamically from somewhere else)

in your JSP:


   
 
   
   


if user check "1" and "3" then selected[] would contains "1" and "3"
(Thanks Struts !)

and don't forget the formal getter and setter method of your Action form

Hope this help

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[ANN] Providers 0.5 Released

2004-08-08 Thread Guillermo Meyer
We have released the version 0.5 of Providers.
Providers is a Struts extension that allows you to manipulate select
options easily.
 
This new version comes with some enhancements in ComboSelectTag (a tag
to create dependant drop down lists) allowing you to set in each select
a provider (in the previous version you need to create a matrix, and now
this is no longer needed).
 
You can download providers from
https://sourceforge.net/project/showfiles.php?group_id=99364
 &package_id=106580&release_id=259054
 
And can get some documentation or information (examples included) at
http://providers.sourceforge.net/
 
Check out the ComboSelect example at
http://providers.sourceforge.net/examples.html to see how you can create
dependant drop down lists just defining some providers that collects
data from your database.
 
If you need more information please contact us or use the providers
sf.net forums.
 
Cheers.
Guillermo.
 


ot: testing a forum - join?

2004-08-08 Thread Vic Cekvenich
I am testing a forum, that should be for advanced developers and people 
interested in operating RiA/SoA.
If you want to help or are interested, please join baseBeans.com forum. 
I will be keeping it up to date on RiA/SoA.

.V
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Trying to highlate error causing fields

2004-08-08 Thread joe a.
I'm trying to use #3 on this page:
http://www.niallp.pwp.blueyonder.co.uk/. It is a tag library that I'm
trying to use with my struts web app. But I have no clue how to use
the class file he provided. I don't know where to put it at compile
time, and it has a different package name than my current project
(package lib.framework.taglib;)

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



varying form element types using struts

2004-08-08 Thread Victor Grazi

I am creating  a Struts form with some dynamically populated drop down 
lists. There is a general requirement that any drop down that contains just 
a single element should display as free html text instead of as a drop down.

Is there any way to specify this type of variation using struts?

Regards
Victor


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: File upload problem

2004-08-08 Thread Erik Weber
Well the idea was to save time, since the upload Servlet already was 
working.

I think I see the connection now -- it seems that FormFile is where the 
Commons implementation is lurking, whereas the Servlet works directly 
with FileItem objects. It is tough to make the connection to Commons 
FileUpload just by looking at those Struts examples, and I didn't want 
to reimplement features that DiskFileUpload gave me (such as the memory 
management/tmp dir). So I was trying to figure out how to use FormFile 
in my form, but somehow work with DiskFileUpload in myAction class. 
Probably not worth the trouble (but someone please let me know if you 
have done this or if there is a good reason to). I'll try handling the 
input stream myself with FormFile as the example shows. But that Commons 
FileUpload API is nice to work with.

Thanks,
Erik
Craig McClanahan wrote:
On Sun, 08 Aug 2004 06:37:33 -0400, Erik Weber <[EMAIL PROTECTED]> wrote:
 

A colleague gave me a nice file upload Servlet to use; it uses the
jakarta commons file upload classes.
   

Is there a particular reason that you're not using the standard Struts
support for file upload (also based on Commons FileUpload but already
integrated into Struts)?  The "struts-upload.war" (Struts 1.1) or
"struts-examples.war" (Struts 1.2) webapp contains examples of using
this feature.
Craig
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: File upload problem

2004-08-08 Thread Axel Stahlhut
Craig McClanahan wrote:
On Sun, 08 Aug 2004 06:37:33 -0400, Erik Weber <[EMAIL PROTECTED]> wrote:

A colleague gave me a nice file upload Servlet to use; it uses the
jakarta commons file upload classes.

Is there a particular reason that you're not using the standard Struts
support for file upload (also based on Commons FileUpload but already
integrated into Struts)?  The "struts-upload.war" (Struts 1.1) or
"struts-examples.war" (Struts 1.2) webapp contains examples of using
this feature.
Craig
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi,
with tha i always get a "duplicate entry in classpath" error when tomcat 
is loading the context (jdk 1.4.04). Does anybody know why?

regards axel
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: File upload problem

2004-08-08 Thread Craig McClanahan
On Sun, 08 Aug 2004 06:37:33 -0400, Erik Weber <[EMAIL PROTECTED]> wrote:

> A colleague gave me a nice file upload Servlet to use; it uses the
> jakarta commons file upload classes.

Is there a particular reason that you're not using the standard Struts
support for file upload (also based on Commons FileUpload but already
integrated into Struts)?  The "struts-upload.war" (Struts 1.1) or
"struts-examples.war" (Struts 1.2) webapp contains examples of using
this feature.

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: I suspect this is a bad idea...so what's a better one?

2004-08-08 Thread Craig McClanahan
On Sun, 8 Aug 2004 03:23:35 -0400, Joe Hertz <[EMAIL PROTECTED]> wrote:
> [snip]
> Now, I can only count on this working if, and only if, the Action class
> itself got instantiated for the purpose of processing the request, and
> destroyed afterward (otherwise the protected variable is going to get
> shared between requests). Am I safe here?

You are not safe here ... there is one and only one instance of each
Action, shared by all requests through the lifetime of the web
application.

> 
> If not, I suppose I could make it a ThreadLocal, but then I'd just be
> replacing the create/destroy steps with a casting step. And since my
> goal here is to try abd have all the work done outside of the "real"
> methods, that's kind of self-defeating. Same holds true with using
> request.setAttribute() instead. Ideally the persistence layer shouldn't
> have to know it's in a web application, so I'd like to not have to pass
> in a request object to it at any point.
> 
> Am I safe with my first guess? (I suspect not).  Failing that, what's a
> better idea?
> 

A useful design pattern for something like this is to create a common
subclass for your actions that does the setup/teardown work in the
execute() method, and then delegates to the action-specific work in
some other method.  For your scenario, it might look like this:

public abstract class BaseAction extends Action {

public ActionForward execute(...) throws Exception {
Persistence persistence =
ActionHelper.getPersistenceObject(request);
try {
ActionForward forward = delegate(mapping, form,
request, response, persistence);
} finally {
persistence.release)(;
}
}

protected abstract ActionForward delegate(ActionMapping
mapping, ActionForm form,
  HttpServletRequest request, HttpServletResponse response,
Persistence persistence)
  throws Exception;

}

Then, your real business logic is implemented in a delegate() method
that is passed in for you, and you never have to remember to allocate
and release the persistence object.

public class RealAction extends BaseAction {

protected ActionForward delegate(...) {
... use the persistence object as needed ...
}

}

This is pretty close to what you've got now ... the key difference is
that it uses a local variable instead of an instance variable to avoid
sharing problems.  Also, because of the finally clause, it also
ensures that the persistence object is cleaned up, even if the
delegate() method throws an exception.

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



File upload problem

2004-08-08 Thread Erik Weber
A colleague gave me a nice file upload Servlet to use; it uses the 
jakarta commons file upload classes.

I am trying to convert it to a Struts Action class.
Converting the Servlet's doPost method to work in the Action class has 
not been a problem. The problem is with the source JSP.

If I use html:form/html:file in the source JSP, the upload does not work 
-- DiskFileUpload.parseRequest returns zero FileItems.



 

Even if I change the html:file tag to a regular HTML input tag, and use 
a form bean that is just an empty class, it still doesn't work.



 

If I change the html:form tag to be a regular HTML form tag, and change 
my struts-config action mapping so that it doesn't associate a form bean 
at all, everything works -- DiskFileUpload.parseRequest now returns 1 
FileItem.



 

I assume that using a form bean at all is screwing this up, but I'm 
perhaps too tired to understand why. I couldn't really surmise by 
looking at the upload example that comes with Struts, as it appears to 
use a different technique for the upload implementation (not 
DiskFileUpload, etc.).

How can I make the source JSP work with my Action class and at the same 
time use the struts tags and an associated form bean, so that I can take 
advantage of validation, etc.?

Thanks,
Erik


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


I suspect this is a bad idea...so what's a better one?

2004-08-08 Thread Joe Hertz
I got tired of, in all my action classes, beginning with something to
get a database connection and at the end destroy it. I want to automate
this a bit.

Here is a first shot at what I came with: 

In my subclass of whatever flavor of Action I'm using, a have a
protected variable which holds my Persistence class object. My subclass
implements execute() such that it will instantiate the persistence
object, assign it to the protected class variable and call
super.execute(), getting rid of the connection afterwards. The action
methods themselves just refer to the protected class variable, rather
than doing anything to generate/obtain it itself. 

Now, I can only count on this working if, and only if, the Action class
itself got instantiated for the purpose of processing the request, and
destroyed afterward (otherwise the protected variable is going to get
shared between requests). Am I safe here?

If not, I suppose I could make it a ThreadLocal, but then I'd just be
replacing the create/destroy steps with a casting step. And since my
goal here is to try abd have all the work done outside of the "real"
methods, that's kind of self-defeating. Same holds true with using
request.setAttribute() instead. Ideally the persistence layer shouldn't
have to know it's in a web application, so I'd like to not have to pass
in a request object to it at any point.

Am I safe with my first guess? (I suspect not).  Failing that, what's a
better idea?

TIA

-Joe

-Basically what I have now is something like this-

protected Persistence persistence;

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
 HttpServletResponse response) throws
Exception {

 
 persistence = ActionHelper.getPersistenceObject(request);

 ActionForward result = super.execute(mapping, form, request,
response);

 persistence.release();

 return result;
   }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]