Re: Nightly log4j configuration

2002-03-18 Thread Torgeir Veimo

Alejandro Velasco wrote:
 Hi all.
 I've been reading with attention the user group for a while and learned 
 so much from all of you... ;-) Now I dare to put a question.
 
 I'm testing now the new features in nigthly builds and face this problem.
 
 In latest nigthly build, I try to run an app that works ok with 1.0.2, 
 beneath Tomcat 4.0.1 standalone, and I get these messages:
 
 log4j:ERROR No appenders could be found for category 
 (org.apache.commons.digester.Digester).
 log4j:ERROR Please initialize the log4j system properly.
 
 I put the example application in webapps and the errors are exactly the 
 same.
 
 Despite the errors, the applications (mine and example) seems to work 
 correctly...
 
 What has changed in nightly that needs an appender?
 How can I get rid of these error messages (I do NOT want by now to use 
 log4j)?
 Could anybody post an example log4j.properties I could use to avoid 
 these errors?

The recent common-logging package (which struts uses) now defaults to 
log4j if it can find it. Try removing log4j from your classpath.

Alternatively, you can initialize log4j before struts starts. Put this 
in your web.xml file (before the struts reference);

 servlet
 servlet-namelog4j-init/servlet-name
 
servlet-classcom.ecomda.common.config.Log4jInitServlet/servlet-class
 init-param
 param-namelog4j-init-file/param-name
 param-value/WEB-INF/log4j.properties/param-value
 /init-param
 load-on-startup1/load-on-startup
 /servlet

The servlet looks like this;

package com.ecomda.common.config;

import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
import org.apache.log4j.PropertyConfigurator;

public class Log4jInitServlet extends HttpServlet {

 public void init() {
 String prefix = getServletContext().getRealPath(/);
 String file = getInitParameter(log4j-init-file);

 if (file != null) {
 PropertyConfigurator.configure(prefix+file);
 }
 }

 public void doGet(HttpServletRequest req, HttpServletResponse res) { }
}

And the log4j.properties goes in WEB-INF;

# Set root category priority to DEBUG and its only appender to A1.

log4j.rootCategory=DEBUG,A1,F1
log4j.category.com=DEBUG,A1,F1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# log4j.appender.A1.layout.ConversionPattern=%d %-4r [%t](%F:%L)  %-5p 
%c %x - %m%n
log4j.appender.A1.layout.ConversionPattern=%d [%t](%F:%L) %-5p %x - %m%n

# F1 is set to be a RollingFileAppender that uses PatternLayout, add F1 
to the desired categories to enable file trace
log4j.appender.F1=org.apache.log4j.RollingFileAppender
log4j.appender.F1.layout=org.apache.log4j.PatternLayout
log4j.appender.F1.layout.ConversionPattern=%p %t %c - %m%n
log4j.appender.F1.File=epd.log
log4j.appender.F1.MaxFileSize=100KB
log4j.appender.F1.MaxBackupIndex=1

log4j.category.org=DEBUG,A1,F1




-- 
-Torgeir


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




multi-app interapp visibility ?

2002-03-08 Thread Torgeir Veimo

Could the visibility of forwards between sub application in the new 
multi-app support be clarified a bit?

Especially how html:link forward= and others behave when using sub 
application.

Wouldn't it be appropriate that a html:link forward= gets the 
subapplication's name prefixed, but a html:link page= would not? I 
need to specify a page= reference back to the default application.


-- 
-Torgeir


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




form/multipart

2002-03-07 Thread Torgeir Veimo

I am having trouble with a form that contains both a file upload button 
and some other button.

There is one input field which is used to create a new file, and a 
submit button for that. There is also a file upload button, and a submit 
button for that.

html:form action=/publishing/folder.do method=POST 
enctype=multipart/form-data

 %-- create a new file --%
 html:text name=resourceForm property=newFolder size=20/
 html:submit property=submit value=new_document/

 %-- upload a file --%
 html:file name=resourceForm property=newFile /
 html:submit property=submit value=upload_file/

/html:form

Upload of file works ok. The trouble I'm having is that if I want to 
create a new file, by entering a filename and selecting the new_document 
submit action, I get an exception.

It works if I select a file to upload, yet still selects new_document.

Is there a way around this?

Here the exception I get

javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:756)
at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2602)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:2025)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:562)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:536)

root cause

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1418)
at 
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1321)
at 

multi-app support and page= forward= across sub applications

2002-03-07 Thread Torgeir Veimo

We use html:link  with page  forward attributes primarily to avoid 
coding the context path. Now we are splitting up our application into 
separate sub-applications, but there is one catch; How do we link 
between actions in different sub-applications, while still using page= 
or forward=? All the actions in a subapp automatically gets prefixed 
with its sub-application name.


-- 
-Torgeir


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




Re: logic tag: checking presense of key or value in a map?

2002-02-26 Thread Torgeir Veimo

Torgeir Veimo wrote:
 Is there a simple way of checking wether a map contains a given key or 
 value?
 
 I tried something like
 
 logic:equal name=child property=properties.key value=keyname
 /logic:equal

I guess I have to do this myself. I need a logic:containsKey value= 
and logic:containsValue value=.



-- 
-Torgeir


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





logic tag: checking presense of key or value in a map?

2002-02-25 Thread Torgeir Veimo

Is there a simple way of checking wether a map contains a given key or 
value?

I tried something like

logic:equal name=child property=properties.key value=keyname
/logic:equal

but I'm not shure if what I'm trying to do is supported. (The child 
bean has a method Map getProperties().)

-- 
-Torgeir


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




Re: best practices for logging in

2002-02-24 Thread Torgeir Veimo

 has anyone encountered special cases where they've had to come up with some 
 unique way of handling logins?

Why not use container managed authentication?

You don't need to protect your pages statically using statements in web.xml.

If you need to protect specific pages, then redirect to a login page (or 
a page protected by a statement in web.xml) when necessary. You can 
check if someone is logged in by checking if request.getUserPrincipal() 
returns null or not.


-- 
-Torgeir


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




configuring an action for url pattern

2002-02-22 Thread Torgeir Veimo

I would like to redirect all url's of the form 
/pages/whatever/comes/here to a single action.

How do I do that?

I tried setting up a forwarding of the /pages/* url to the action 
servlet in web.xml, but I don't know how to use patterns in the 
strust-config.xml.

-- 
-Torgeir


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




Re: Personalisation Best Practice

2001-09-07 Thread Torgeir Veimo

Peter Pilgrim wrote:
 
 How do I get a  *.css file recognised as valid Java Server Page?

Have you tried;

link rel=stylesheet type=text/css href=style/font_styles.jsp

and in the jsp;

%@page contentType=text/css%


-- 
- Torgeir



Re: Struts - acronym or not? - pls respond

2001-09-05 Thread Torgeir Veimo

Jose Correia wrote:
 
 Thanks!
 
 Ted Husted wrote:
 
  Jose Correia wrote:
   I thought this would be an easy question for those involved in the
   project.
 
  Not. It's a reference to struts in the architectural sense.

Struts means ostrich (the bird) in norwegian.

The funny thing about Struts'es (the bird) is that they think the
tallest individual is the superior one, so farmers that have struts'es
usually walks around with a large umbrella, and then the struts'es
leaves the farmer untouched.


-- 
- Torgeir