You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2013/03/03 21:20:34 UTC
struts2/spring Parameter is on the excludeParams list of patterns!
The input
http://localhost:8080/ecommerce/login.jsp
The Output
login is succcese Sun Mar 03
01:01:16 CST 2013
problem
login.jsp->loginAction->struts.xml->applicationContext.xml->loginAction->neuco.AcctAction->inject acctsmgr-….->
but in the AcctAction.java,
public String Execute() throws
Exception {neuco.AcctAction
System.out.println("loginId="+getLoginId()+"\n");
System.out.println("password="+getPassword()+"\n");
System.out.println("here\n");
In the logfile , it should display my input
from login.jsp, but it did not show up at all, instead, shows warning
WARNING: Parameter [loginId] is on the
excludeParams list of patterns!
Mar 3, 2013 12:57:58 PM
com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Parameter [password] is on the
excludeParams list of patterns!
So, looks like
neuco.AcctAction is not triggered/initiated by spring assmeble, otherwise it
should display debug info, but if not triggered, how come it return “success”
to success.jsp ?
Please help
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce
# cat login.jsp
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:actionerror/>
<s:form action="login">
<s:textfield name="loginId"
label="login"/>
<s:textfield name="password"
label="password"/>
<s:submit value="logint"/>
</s:form>
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce
# cat success.jsp
login is succcese <%= new java.util.Date() %>
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes
# cat struts.xml
<struts>
<constant
name="struts.objectFactory" value="spring"/>
<package
name="neuco" extends="struts-default">
<action name="login"
class="loginAction">
<result name="success">success.jsp</result>
<result name="error">error.jsp</result>
</action>
</package>
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat struts.xml
<struts>
<constant name="struts.devMode" value="true" />
<constant name="struts.objectFactory" value="spring"/>
<package name="neuco" extends="struts-default">
<action name="login" class="loginAction">
<result name="success">success.jsp</result>
<result name="error">error.jsp</result>
</action>
</package>
</struts>
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF
# cat applicationContext.xml.....
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">.....
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property
name="dataSource" ref="dataSource"/>
<property
name="mappingResources">
<list> <value>AcctsSecurity.hbm.xml</value> </list>
</property>
</bean>
<bean
id="loginAction" class="neuco.AcctAction"
scope="prototype">
<property name="mgr"
ref="acctsmgr"/>
</bean>
<bean id="acctssecurityDao"
class="neuco.AcctsecurityDaoHibernate">
<property
name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean
id="acctsmgr" class="neuco.AcctManagerImpl">
<property
name="acctsecurityDao" ref="acctssecurityDao"/>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property
name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:advice id="txAdvice"
transaction-manager="transactionManager">
<tx:attributes>
<tx:method
name="get*" read-only="true"/>
<tx:method
name="*"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut
id="leePointcut" expression="execution(*
neuco.*Impl.*(..))"/>
<aop:advisor
advice-ref="txAdvice" pointcut-ref="leePointcut"/>
</aop:config>
</beans>
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/src/neuco # cat AcctAction.java
package neuco;
/** lot of import * */
public class AcctAction extends ActionSupport {
protected AcctManager mgr;
private String loginId;
private String password;
String login_return=null;
public void setMgr(AcctManager mgr) { this.mgr=mgr; }
public void setLoginId(String loginId) { this.loginId=loginId; }
public void setPassword(String password) { this.password=password; }
public String getLoginId() { return loginId; }
public String getPassword() { return password; }
public String Execute() throws Exception {
System.out.println("loginId="+getLoginId()+"\n");
System.out.println("password="+getPassword()+"\n");
System.out.println("here\n");
Map session=ActionContext.getContext().getSession();
login_return=mgr.loginValid(getLoginId(), getPassword());
if (login_return !=null ) {
session.put("loginid",login_return);
addActionMessage("Login Success");
return SUCCESS;
}
else
addActionError("loginid/password not match");
return "failure";
}
}
Re: struts2/spring Parameter is on the excludeParams list of patterns!
Posted by Lukasz Lenart <lu...@apache.org>.
2013/3/3 john lee <sh...@yahoo.com>:
> The input
> http://localhost:8080/ecommerce/login.jsp
Wrong
> login.jsp->loginAction->struts.xml->applicationContext.xml->loginAction->neuco.AcctAction->inject acctsmgr-….->
The flow is wrong, you should never omit action and expose jsp directly.
> In the logfile , it should display my input
> from login.jsp, but it did not show up at all, instead, shows warning
> WARNING: Parameter [loginId] is on the
> excludeParams list of patterns!
> Mar 3, 2013 12:57:58 PM
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
> WARNING: Parameter [password] is on the
> excludeParams list of patterns!
The log says it clearly - your excludeParams are very restrictive or
which version of Struts do you use?
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org