You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Liu, Benson" <be...@sscims.com> on 2005/04/20 22:44:41 UTC
Struts Validator Illegal Argument Exception - Digester problem?
Hi,
I'm working on a Struts/Tiles web app with Websphere 5.1.2 and Struts 1.2.4
I'm getting exceptions when trying to use the Validator framework.
After debugging, it almost seems as if the strut-config.xml is not being properly digested.
The property maps of the Plug-Ins are always null.
Thus, the ValidatorPlugIn does not know that I've specified a "pathnames" property.
Here's my struts-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<!-- Data Sources -->
<data-sources>
</data-sources>
<!-- Form Beans -->
<form-beans>
<form-bean name="reconWorkqueueActionForm" type="com.sscims.palms.gui.workqueue.recon.ReconWorkqueueActionForm">
</form-bean>
<form-bean name="reconActionForm" type="com.sscims.palms.gui.recon.ReconActionForm">
</form-bean>
<form-bean name="progressActionForm" type="com.sscims.palms.gui.recon.progress.ProgressActionForm">
</form-bean>
<form-bean name="loginActionForm" type="com.sscims.palms.gui.LoginActionForm">
</form-bean>
<form-bean name="tmvDetailsActionForm" type="com.sscims.palms.gui.recon.tmvdetails.TMVDetailsActionForm">
</form-bean>
<form-bean name="analysisActionForm" type="com.sscims.palms.gui.recon.analysis.AnalysisActionForm">
</form-bean>
<form-bean name="cashActionForm" type="com.sscims.palms.gui.recon.cash.CashActionForm">
</form-bean>
<form-bean name="positionActionForm" type="com.sscims.palms.gui.recon.cash.PositionActionForm">
</form-bean>
<form-bean name="checklistActionForm" type="com.sscims.palms.gui.recon.cash.ChecklistActionForm">
</form-bean>
</form-beans>
<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>
<!-- Global Forwards -->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward name="loginPage" path="/showLogin.do" redirect="true">
</forward>
</global-forwards>
<!-- Action Mappings -->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action path="/PALMSBase" type="com.sscims.palms.gui.PALMSBaseAction">
</action>
<action path="/login" type="com.sscims.palms.gui.LoginAction" input="/pages/login/login.jsp" name="loginActionForm" scope="request" validate="true">
<forward name="success" path="/defaultPageDispatcher.do" redirect="false">
</forward>
</action>
<action path="/logout" type="com.sscims.palms.gui.LogoutAction" >
<forward name="success" path="/showLogin.do" redirect="true">
</forward>
</action>
<action path="/showLogin" type="com.sscims.palms.gui.ShowLoginAction" validate="false">
<forward name="success" path="/pages/login/login.jsp" >
</forward>
</action>
<action path="/recon/showWorkqueue" type="com.sscims.palms.gui.workqueue.recon.ShowReconWorkqueueAction">
<forward name="success" path="/pages/workqueue/workqueue.jsp">
</forward>
</action>
<action path="/recon/showReconWorkqueue" type="com.sscims.palms.gui.workqueue.recon.ShowReconWorkqueueAction" name="reconWorkqueueActionForm" scope="request" input="/pages/workqueue/recon/recon.jsp">
<forward name="success" path="/pages/workqueue/recon/recon.jsp">
</forward>
</action>
<action path="/recon/showProgress" type="com.sscims.palms.gui.recon.progress.ShowProgressAction" name="progressActionForm" scope="request" input="/pages/recon/progress/progress.jsp">
<forward name="success" path="/pages/recon/progress/progress.jsp">
</forward>
</action>
<action path="/recon/showTMVDetails" type="com.sscims.palms.gui.recon.tmvdetails.ShowTMVDetailsAction" name="tmvDetailsActionForm" input="/pages/recon/tmvDetails/tmvDetails.jsp" scope="request" validate="false" >
<forward name="success" path="/pages/recon/tmvDetails/tmvDetails.jsp">
</forward>
</action>
<action path="/recon/showAnalysis" type="com.sscims.palms.gui.recon.analysis.ShowAnalysisAction" name="analysisActionForm">
<forward name="success" path="/pages/recon/analysis/analysis.jsp">
</forward>
</action>
<action path="/recon/showCash" type="com.sscims.palms.gui.recon.cash.ShowCashAction" name="cashActionForm" scope="request" input="/pages/recon/cash/cash.jsp">
<forward name="success" path="/pages/recon/cash/cash.jsp">
</forward>
</action>
<action path="/recon/showPosition" type="com.sscims.palms.gui.recon.position.ShowPositionsAction">
<forward name="success" path="/pages/recon/position/position.jsp">
</forward>
</action>
<action path="/recon/showChecklist" type="com.sscims.palms.gui.recon.checklist.ShowChecklistAction">
<forward name="success" path="/pages/recon/checklist/checklist.jsp">
</forward>
</action>
<action path="/recon/processTMVDetails" type="com.sscims.palms.gui.recon.tmvdetails.ProcessTMVDetailsAction" input="/pages/recon/tmvDetails.jsp" name="tmvDetailsActionForm" scope="request">
<forward name="success" path="/pages/recon/tmvDetails/tmvDetails.jsp">
</forward>
<forward name="progress" path="/recon/showProgress.do">
</forward>
</action>
<action path="/recon/processAnalysis" type="com.sscims.palms.gui.recon.analysis.ShowAnalysisAction" name="analysisActionForm">
<forward name="success" path="/pages/recon/anlysis/analysis.jsp">
</forward>
</action>
<action path="/defaultPageDispatcher" type="com.sscims.palms.gui.DefaultPageDispatcherAction">
<forward name="recon_default" path="/recon/showWorkqueue.do" redirect="true">
</forward>
</action>
<action path="/recon/reconDefaultPageDispatcher" type="com.sscims.palms.gui.recon.ReconDefaultPageDispatcherAction">
<forward name="analysis" path="/recon/showAnalysis.do" redirect="true">
</forward>
<forward name="mktvalues" path="/recon/showTMVDetails.do" redirect="true">
</forward>
<forward name="progress" path="/recon/showProgress.do" redirect="true">
</forward>
</action>
<action path="/testPA" type="com.sscims.palms.sample.PATestAction">
<forward name="success" path="/pages/basicPage.jsp">
</forward>
</action>
</action-mappings>
<!-- ============================================= Controller Configuration -->
<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<!-- Message Resources -->
<message-resources parameter="ApplicationResources" null="false"/>
<!-- =============================================== Plug Ins Configuration -->
<!-- ======================================================= Tiles plugin -->
<!--
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation
Paths found in Tiles definitions are relative to the main context.
-->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tileDefinitions.xml"/>
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>
<!-- =================================================== Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in>
</struts-config>
My ActionForm:
package com.sscims.palms.gui;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorActionForm;
import org.apache.struts.validator.ValidatorForm;
/**
* Form bean for a Struts application.
* @version 1.0
* @author
*/
public class LoginActionForm extends ValidatorActionForm {
private String username;
private String password;
/**
* Constructor
*/
public LoginActionForm() {
super();
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
// Reset values are provided as samples only. Change as appropriate.
}
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = super.validate(mapping, request);
if (errors == null) {
errors = new ActionErrors();
}
// Validate the fields in your form, adding
// adding each error to this.errors as found, e.g.
// if ((field == null) || (field.length() == 0)) {
// errors.add("field", new ActionError("error.field.required"));
// }
return errors;
}
/**
* Returns the password.
* @return String
*/
public String getPassword() {
return password;
}
/**
* Returns the username.
* @return String
*/
public String getUsername() {
return username;
}
/**
* Sets the password.
* @param password The password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Sets the username.
* @param username The username to set
*/
public void setUsername(String username) {
this.username = username;
}
}
My validation.xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
<form-validation>
<global>
<constant>
<constant-name>postalCode</constant-name>
<constant-value>^\d{5}\d*$</constant-value>
</constant>
</global>
<formset>
<!-- An example form -->
<form name="/login">
<field
property="username"
depends="required">
<arg key="login.username"/>
</field>
<field
property="password"
depends="required,mask">
<arg key="login.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
Thanks in advance!
-Ben
[4/20/05 13:37:53:965 PDT] 63d4584b WebGroup E SRVE0026E: [Servlet Error]-[action]: java.lang.IllegalArgumentException: Resources cannot be null.
at org.apache.commons.validator.Validator.<init>(Validator.java:188)
at org.apache.struts.validator.Resources.initValidator(Resources.java:299)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:106)
at com.sscims.palms.gui.LoginActionForm.validate(LoginActionForm.java:40)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:921)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:206)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: mapping.getInputForward() - why not part of ActionConfig?
Posted by Craig McClanahan <cr...@gmail.com>.
My memory on this is vague, but I suspect it's primarily an oversight.
Craig
On 4/20/05, Joe Germuska <Jo...@germuska.com> wrote:
> I just happened to notice that there's a method on ActionMapping,
> "getInputForward()" which applies some config logic, while there's no
> corresponding method on ActionConfig. I could see where we might not
> directly reproduce it, since ActionConfig shouldn't depend on
> ActionForward -- but why is there method like
>
> public ForwardConfig getInputForwardConfig(){}
>
> which encapsulates the same logic?
>
> I can add it, but I thought I'd see if anyone had a good reason for
> leaving it out when ActionConfig was broken out from ActionForward?
>
> If it's a question of which classes know what, this is something
> which could probably be pushed into the ActionContext interface as
> well, but it is handy when one is doing validation inside an action.
> (In the chain, the logic is performed in AbstractSelectInput rather
> than calling on ActionMapping)
>
> Thanks
> Joe
>
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction" -The Ex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: mapping.getInputForward() - why not part of ActionConfig?
Posted by Dakota Jack <da...@gmail.com>.
Good idea!
<SNIP>
On 4/20/05, Martin Cooper <mf...@gmail.com> wrote:
> I have to say that, with some of the changes we've been making
> recently, I feel like we might want to take a step back and see where
> we really want to be at the end of (this chapter of) the journey.
> Martin Cooper
</SNIP>
--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: mapping.getInputForward() - why not part of ActionConfig?
Posted by Martin Cooper <mf...@gmail.com>.
On 4/20/05, Joe Germuska <Jo...@germuska.com> wrote:
> At 7:04 PM -0700 4/20/05, Martin Cooper wrote:
> >On 4/20/05, Joe Germuska <Jo...@germuska.com> wrote:
> >> I just happened to notice that there's a method on ActionMapping,
> >> "getInputForward()" which applies some config logic, while there's no
> >> corresponding method on ActionConfig. I could see where we might not
> >> directly reproduce it, since ActionConfig shouldn't depend on
> >> ActionForward -- but why is there method like
> >>
> >> public ForwardConfig getInputForwardConfig(){}
> >
> >Can you clarify where you found this? I can't find any method with
> >this name, so I'm missing your point, I'm afraid. ;-(
>
> ActionMapping has
>
> public ActionForward getInputForward();
>
> ActionConfig has no corresponding method. Thus, when one has an
> ActionConfig and validation has failed, and one wants to send the
> view back to the input, one has to either
>
> (1) cast the ActionConfig to ActionMapping (and hope that you have
> one; of course in Struts these days you always do, but why have
> ActionConfig if we aren't going to steer towards using it instead of
> ActionMapping?)
>
> or
>
> (2) perform the logic oneself which is currently done in
> Actionmapping.getInputForward():
>
> if (getModuleConfig().getControllerConfig().getInputForward()) {
> return (findForward(getInput()));
> } else {
> return (new ActionForward(getInput()));
> }
Ah, that. I see.
So this brings us back to the reason for the split between
ActionConfig and ActionMapping, and the other such pairs, I think. I
could easily be mistaken here (Craig, please correct me if I'm wrong),
but I thought the original idea was that ActionConfig and its kin in
o.a.s.config were the pure config JavaBean classes, while the
extensions of those classes added the necessary logic. The lack of
getInputForward() in the ActionConfig class seems to reinforce that.
However, ActionConfig now seems to be far from a simple config bean,
so I'm not sure where we want to go from here. Ideally, I'd like to
see us have an internal configuration representation that's not tied
to either the XML file format we use or the logic we apply on top of
the config, but which most accurately reflects the intent of the
configuration itself. Then we would be in a better position to
separate the logic from the configuration, as well as allow for
entirely different ways of loading the configuration.
I have to say that, with some of the changes we've been making
recently, I feel like we might want to take a step back and see where
we really want to be at the end of (this chapter of) the journey.
(That's really where my earlier comment was going, in another thread
on config complexity.)
--
Martin Cooper
> Joe
>
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction" -The Ex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: mapping.getInputForward() - why not part of ActionConfig?
Posted by Joe Germuska <Jo...@Germuska.com>.
At 7:04 PM -0700 4/20/05, Martin Cooper wrote:
>On 4/20/05, Joe Germuska <Jo...@germuska.com> wrote:
>> I just happened to notice that there's a method on ActionMapping,
>> "getInputForward()" which applies some config logic, while there's no
>> corresponding method on ActionConfig. I could see where we might not
>> directly reproduce it, since ActionConfig shouldn't depend on
>> ActionForward -- but why is there method like
>>
>> public ForwardConfig getInputForwardConfig(){}
>
>Can you clarify where you found this? I can't find any method with
>this name, so I'm missing your point, I'm afraid. ;-(
ActionMapping has
public ActionForward getInputForward();
ActionConfig has no corresponding method. Thus, when one has an
ActionConfig and validation has failed, and one wants to send the
view back to the input, one has to either
(1) cast the ActionConfig to ActionMapping (and hope that you have
one; of course in Struts these days you always do, but why have
ActionConfig if we aren't going to steer towards using it instead of
ActionMapping?)
or
(2) perform the logic oneself which is currently done in
Actionmapping.getInputForward():
if (getModuleConfig().getControllerConfig().getInputForward()) {
return (findForward(getInput()));
} else {
return (new ActionForward(getInput()));
}
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: mapping.getInputForward() - why not part of ActionConfig?
Posted by Martin Cooper <mf...@gmail.com>.
On 4/20/05, Joe Germuska <Jo...@germuska.com> wrote:
> I just happened to notice that there's a method on ActionMapping,
> "getInputForward()" which applies some config logic, while there's no
> corresponding method on ActionConfig. I could see where we might not
> directly reproduce it, since ActionConfig shouldn't depend on
> ActionForward -- but why is there method like
>
> public ForwardConfig getInputForwardConfig(){}
Can you clarify where you found this? I can't find any method with
this name, so I'm missing your point, I'm afraid. ;-(
--
Martin Cooper
> which encapsulates the same logic?
>
> I can add it, but I thought I'd see if anyone had a good reason for
> leaving it out when ActionConfig was broken out from ActionForward?
>
> If it's a question of which classes know what, this is something
> which could probably be pushed into the ActionContext interface as
> well, but it is handy when one is doing validation inside an action.
> (In the chain, the logic is performed in AbstractSelectInput rather
> than calling on ActionMapping)
>
> Thanks
> Joe
>
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction" -The Ex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
mapping.getInputForward() - why not part of ActionConfig?
Posted by Joe Germuska <Jo...@Germuska.com>.
I just happened to notice that there's a method on ActionMapping,
"getInputForward()" which applies some config logic, while there's no
corresponding method on ActionConfig. I could see where we might not
directly reproduce it, since ActionConfig shouldn't depend on
ActionForward -- but why is there method like
public ForwardConfig getInputForwardConfig(){}
which encapsulates the same logic?
I can add it, but I thought I'd see if anyone had a good reason for
leaving it out when ActionConfig was broken out from ActionForward?
If it's a question of which classes know what, this is something
which could probably be pushed into the ActionContext interface as
well, but it is handy when one is doing validation inside an action.
(In the chain, the logic is performed in AbstractSelectInput rather
than calling on ActionMapping)
Thanks
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Struts Validator Illegal Argument Exception - Digester problem?
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Can you ask this type of question on the user list please.
Niall
----- Original Message -----
From: "Liu, Benson" <be...@sscims.com>
To: <de...@struts.apache.org>
Sent: Wednesday, April 20, 2005 9:44 PM
Subject: Struts Validator Illegal Argument Exception - Digester problem?
Hi,
I'm working on a Struts/Tiles web app with Websphere 5.1.2 and Struts 1.2.4
I'm getting exceptions when trying to use the Validator framework.
After debugging, it almost seems as if the strut-config.xml is not being
properly digested.
The property maps of the Plug-Ins are always null.
Thus, the ValidatorPlugIn does not know that I've specified a "pathnames"
property.
Here's my struts-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<!-- Data Sources -->
<data-sources>
</data-sources>
<!-- Form Beans -->
<form-beans>
<form-bean name="reconWorkqueueActionForm"
type="com.sscims.palms.gui.workqueue.recon.ReconWorkqueueActionForm">
</form-bean>
<form-bean name="reconActionForm"
type="com.sscims.palms.gui.recon.ReconActionForm">
</form-bean>
<form-bean name="progressActionForm"
type="com.sscims.palms.gui.recon.progress.ProgressActionForm">
</form-bean>
<form-bean name="loginActionForm"
type="com.sscims.palms.gui.LoginActionForm">
</form-bean>
<form-bean name="tmvDetailsActionForm"
type="com.sscims.palms.gui.recon.tmvdetails.TMVDetailsActionForm">
</form-bean>
<form-bean name="analysisActionForm"
type="com.sscims.palms.gui.recon.analysis.AnalysisActionForm">
</form-bean>
<form-bean name="cashActionForm"
type="com.sscims.palms.gui.recon.cash.CashActionForm">
</form-bean>
<form-bean name="positionActionForm"
type="com.sscims.palms.gui.recon.cash.PositionActionForm">
</form-bean>
<form-bean name="checklistActionForm"
type="com.sscims.palms.gui.recon.cash.ChecklistActionForm">
</form-bean>
</form-beans>
<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>
<!-- Global Forwards -->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward name="loginPage" path="/showLogin.do" redirect="true">
</forward>
</global-forwards>
<!-- Action Mappings -->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action path="/PALMSBase"
type="com.sscims.palms.gui.PALMSBaseAction">
</action>
<action path="/login" type="com.sscims.palms.gui.LoginAction"
input="/pages/login/login.jsp" name="loginActionForm" scope="request"
validate="true">
<forward name="success" path="/defaultPageDispatcher.do"
redirect="false">
</forward>
</action>
<action path="/logout" type="com.sscims.palms.gui.LogoutAction" >
<forward name="success" path="/showLogin.do" redirect="true">
</forward>
</action>
<action path="/showLogin"
type="com.sscims.palms.gui.ShowLoginAction" validate="false">
<forward name="success" path="/pages/login/login.jsp" >
</forward>
</action>
<action path="/recon/showWorkqueue"
type="com.sscims.palms.gui.workqueue.recon.ShowReconWorkqueueAction">
<forward name="success" path="/pages/workqueue/workqueue.jsp">
</forward>
</action>
<action path="/recon/showReconWorkqueue"
type="com.sscims.palms.gui.workqueue.recon.ShowReconWorkqueueAction"
name="reconWorkqueueActionForm" scope="request"
input="/pages/workqueue/recon/recon.jsp">
<forward name="success" path="/pages/workqueue/recon/recon.jsp">
</forward>
</action>
<action path="/recon/showProgress"
type="com.sscims.palms.gui.recon.progress.ShowProgressAction"
name="progressActionForm" scope="request"
input="/pages/recon/progress/progress.jsp">
<forward name="success" path="/pages/recon/progress/progress.jsp">
</forward>
</action>
<action path="/recon/showTMVDetails"
type="com.sscims.palms.gui.recon.tmvdetails.ShowTMVDetailsAction"
name="tmvDetailsActionForm" input="/pages/recon/tmvDetails/tmvDetails.jsp"
scope="request" validate="false" >
<forward name="success"
path="/pages/recon/tmvDetails/tmvDetails.jsp">
</forward>
</action>
<action path="/recon/showAnalysis"
type="com.sscims.palms.gui.recon.analysis.ShowAnalysisAction"
name="analysisActionForm">
<forward name="success" path="/pages/recon/analysis/analysis.jsp">
</forward>
</action>
<action path="/recon/showCash"
type="com.sscims.palms.gui.recon.cash.ShowCashAction" name="cashActionForm"
scope="request" input="/pages/recon/cash/cash.jsp">
<forward name="success" path="/pages/recon/cash/cash.jsp">
</forward>
</action>
<action path="/recon/showPosition"
type="com.sscims.palms.gui.recon.position.ShowPositionsAction">
<forward name="success" path="/pages/recon/position/position.jsp">
</forward>
</action>
<action path="/recon/showChecklist"
type="com.sscims.palms.gui.recon.checklist.ShowChecklistAction">
<forward name="success" path="/pages/recon/checklist/checklist.jsp">
</forward>
</action>
<action path="/recon/processTMVDetails"
type="com.sscims.palms.gui.recon.tmvdetails.ProcessTMVDetailsAction"
input="/pages/recon/tmvDetails.jsp" name="tmvDetailsActionForm"
scope="request">
<forward name="success"
path="/pages/recon/tmvDetails/tmvDetails.jsp">
</forward>
<forward name="progress" path="/recon/showProgress.do">
</forward>
</action>
<action path="/recon/processAnalysis"
type="com.sscims.palms.gui.recon.analysis.ShowAnalysisAction"
name="analysisActionForm">
<forward name="success" path="/pages/recon/anlysis/analysis.jsp">
</forward>
</action>
<action path="/defaultPageDispatcher"
type="com.sscims.palms.gui.DefaultPageDispatcherAction">
<forward name="recon_default" path="/recon/showWorkqueue.do"
redirect="true">
</forward>
</action>
<action path="/recon/reconDefaultPageDispatcher"
type="com.sscims.palms.gui.recon.ReconDefaultPageDispatcherAction">
<forward name="analysis" path="/recon/showAnalysis.do"
redirect="true">
</forward>
<forward name="mktvalues" path="/recon/showTMVDetails.do"
redirect="true">
</forward>
<forward name="progress" path="/recon/showProgress.do"
redirect="true">
</forward>
</action>
<action path="/testPA" type="com.sscims.palms.sample.PATestAction">
<forward name="success" path="/pages/basicPage.jsp">
</forward>
</action>
</action-mappings>
<!-- ============================================= Controller
Configuration -->
<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<!-- Message Resources -->
<message-resources parameter="ApplicationResources" null="false"/>
<!-- =============================================== Plug Ins
Configuration -->
<!-- ======================================================= Tiles
plugin -->
<!--
This plugin initialize Tiles definition factory. This later can takes
some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In
this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the
first
initialized plugin (generally the one associated with the
default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration
file.
true : validate. DTD should be specified in file header
(default)
false : no validation
Paths found in Tiles definitions are relative to the main context.
-->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config"
value="/WEB-INF/tileDefinitions.xml"/>
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>
<!-- =================================================== Validator
plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in>
</struts-config>
My ActionForm:
package com.sscims.palms.gui;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorActionForm;
import org.apache.struts.validator.ValidatorForm;
/**
* Form bean for a Struts application.
* @version 1.0
* @author
*/
public class LoginActionForm extends ValidatorActionForm {
private String username;
private String password;
/**
* Constructor
*/
public LoginActionForm() {
super();
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
// Reset values are provided as samples only. Change as appropriate.
}
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = super.validate(mapping, request);
if (errors == null) {
errors = new ActionErrors();
}
// Validate the fields in your form, adding
// adding each error to this.errors as found, e.g.
// if ((field == null) || (field.length() == 0)) {
// errors.add("field", new ActionError("error.field.required"));
// }
return errors;
}
/**
* Returns the password.
* @return String
*/
public String getPassword() {
return password;
}
/**
* Returns the username.
* @return String
*/
public String getUsername() {
return username;
}
/**
* Sets the password.
* @param password The password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Sets the username.
* @param username The username to set
*/
public void setUsername(String username) {
this.username = username;
}
}
My validation.xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
<form-validation>
<global>
<constant>
<constant-name>postalCode</constant-name>
<constant-value>^\d{5}\d*$</constant-value>
</constant>
</global>
<formset>
<!-- An example form -->
<form name="/login">
<field
property="username"
depends="required">
<arg key="login.username"/>
</field>
<field
property="password"
depends="required,mask">
<arg key="login.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
Thanks in advance!
-Ben
[4/20/05 13:37:53:965 PDT] 63d4584b WebGroup E SRVE0026E: [Servlet
Error]-[action]: java.lang.IllegalArgumentException: Resources cannot be
null.
at org.apache.commons.validator.Validator.<init>(Validator.java:188)
at org.apache.struts.validator.Resources.initValidator(Resources.java:299)
at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:106)
at com.sscims.palms.gui.LoginActionForm.validate(LoginActionForm.java:40)
at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.j
ava:921)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:206)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServle
tInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecy
cleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServ
let.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecyc
leServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java
:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidSer
vletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletIns
tanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(
WebAppRequestDispatcher.java:983)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppReques
tDispatcher.java:564)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequest
Dispatcher.java:200)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker
.java:276)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(C
achedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletReq
uestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListene
r.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.jav
a:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org