struts2

How do I handle multiple actions in single form in WILDCARD action mapping?

邮差的信 提交于 2021-02-08 06:59:24
问题 According this solution Struts2 handle multiple actions... I know the Struts2 DMI can handle multiple acitons in single form easily. Recently, Struts2 turned off DMI mechanism for security issue. Now, we use WILDCARD MAPPINGS to map all actions in struts.xml example: <action name="*/*" class="action.{1}Action" method="{2}"> ... </action> In WILDARD MAPPINGS, it has a little problem to deal with mapping multiple actions/methods in single form. <s:form action="actionA/method2" theme="simple" >

Couldn't get resource paths for class path resource

自作多情 提交于 2021-02-08 04:41:26
问题 all, I am puzzled about the struts2 action unit test import org.apache.struts2.StrutsSpringTestCase; import org.junit.Test; import com.opensymphony.xwork2.ActionProxy; public class TestLoginAction extends StrutsSpringTestCase { @Test public void testCheck() throws Exception { ActionProxy proxy = null; LoginAction test = null; request.setParameter("username", "admin"); proxy = getActionProxy("/checkLogin"); test = (LoginAction) proxy.getAction(); String result = proxy.execute(); assertEquals(

How to disable tomcat server console log?

老子叫甜甜 提交于 2021-02-08 04:11:46
问题 My log4j.proerties log4j.rootLogger=DEBUG,R log4j.appender.R = org.apache.log4j.RollingFileAppender log4j.appender.R.File = logs/backup.log log4j.appender.R.Append = true log4j.appender.R.DatePattern = '.'yyy-MM-dd log4j.appender.R.layout = org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n log4j.additivity.info.release.scheduler=false My Action class is private static final Logger logger = Logger.getLogger(LogAction.class); if

How to disable tomcat server console log?

≡放荡痞女 提交于 2021-02-08 04:09:39
问题 My log4j.proerties log4j.rootLogger=DEBUG,R log4j.appender.R = org.apache.log4j.RollingFileAppender log4j.appender.R.File = logs/backup.log log4j.appender.R.Append = true log4j.appender.R.DatePattern = '.'yyy-MM-dd log4j.appender.R.layout = org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n log4j.additivity.info.release.scheduler=false My Action class is private static final Logger logger = Logger.getLogger(LogAction.class); if

How to disable tomcat server console log?

这一生的挚爱 提交于 2021-02-08 04:09:23
问题 My log4j.proerties log4j.rootLogger=DEBUG,R log4j.appender.R = org.apache.log4j.RollingFileAppender log4j.appender.R.File = logs/backup.log log4j.appender.R.Append = true log4j.appender.R.DatePattern = '.'yyy-MM-dd log4j.appender.R.layout = org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n log4j.additivity.info.release.scheduler=false My Action class is private static final Logger logger = Logger.getLogger(LogAction.class); if

How to disable tomcat server console log?

时光总嘲笑我的痴心妄想 提交于 2021-02-08 04:04:46
问题 My log4j.proerties log4j.rootLogger=DEBUG,R log4j.appender.R = org.apache.log4j.RollingFileAppender log4j.appender.R.File = logs/backup.log log4j.appender.R.Append = true log4j.appender.R.DatePattern = '.'yyy-MM-dd log4j.appender.R.layout = org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n log4j.additivity.info.release.scheduler=false My Action class is private static final Logger logger = Logger.getLogger(LogAction.class); if

How can we append 2 strings in Struts

醉酒当歌 提交于 2021-02-07 21:52:17
问题 I need to append 2 String class variables using Struts 2 I tried like this <s:set var="Name" value="#variable1+#variable2"/> but no result. 回答1: Use OGNL to force evaluation of concatenation operation <s:set var="Name" value="%{#variable1 + #variable2}"/> 回答2: it is also working. <s:set var="Name" value="#variable1+''+#variable2"/> 来源: https://stackoverflow.com/questions/23789198/how-can-we-append-2-strings-in-struts

How can we append 2 strings in Struts

心已入冬 提交于 2021-02-07 21:50:52
问题 I need to append 2 String class variables using Struts 2 I tried like this <s:set var="Name" value="#variable1+#variable2"/> but no result. 回答1: Use OGNL to force evaluation of concatenation operation <s:set var="Name" value="%{#variable1 + #variable2}"/> 回答2: it is also working. <s:set var="Name" value="#variable1+''+#variable2"/> 来源: https://stackoverflow.com/questions/23789198/how-can-we-append-2-strings-in-struts

Struts2 Access specific index of list when index is a variable

强颜欢笑 提交于 2021-02-07 20:28:08
问题 I'm having some trouble accessing a specific element of a list when the index is a variable. When the index is just a number, I have no issues at all displaying what I'm looking for. <s:property value="#session.userList[1].email" /> That works perfectly, and displays the email found in that element of UserList However, when I change the index to be a variable, I'm having difficulties finding the proper way to write the ognl statement. I've tried every combination of %# I can think of with no

Struts 2.3.14 junit test

こ雲淡風輕ζ 提交于 2021-02-07 14:13:01
问题 I'm using Struts 2.3.14 for my application... I need some unit test in my application... so I'm using junit4... but when I use ActionProxy in my test, it will show NullPointerException ... my test code is: ActionProxy proxy=getActionProxy("/customize/saveRewards"); SaveRewardsPlus rewards=(SaveRewardsPlus)proxy.getAction(); request.setParameter("list[0].img_id", "1"); request.setParameter("list[0].tag", "Test Tag"); request.setParameter("list[0].desc", "Test Desc"); String result=proxy