To clear my doubts, I re-built this application using WW 2.2.4. I expected that it will work perfectly and that would prove it's some sort of a bug. To my surprise, it exhibited the exact same behavior!!!!!
Now, since it's quite remote that such a drastic bug exists in WW 2.2.4, I'm starting to think that maybe the behavior I expect is not the correct one. Now, could someone please clarify whether the following is true? 1- When parameters are available in the "query string", those parameters are made available to the action through " ActionContext.getContext().getParameters()". Is this true? 2- If a property on the action has the same name as one of those parameters then the framework will attempt to set the property with the parameter's name. This is not what is currently happening. Since WW 2.2.4 is supposed to be production quality then I'm guessing that there must be something wrong with the configuration. It can not be that some configuration I've provided is wrong, simply because I have not provided any. It could be, though, that some configuration is missing. The changes I've made to the application to get it to work with WW 2.2.4 is minimal, so I won't go ahead and copy all the files here. -----Original Message----- From: Tarek Nabil Sent: Monday, November 27, 2006 5:29 PM To: Struts Users Mailing List Subject: RE: Parameters not being set on Action in Struts 2 Thanks Peter and Ted. I'm afraid I didn't understand your advice regarding the IDE with integrated debugging. Would that require me to use the source of Struts 2 rather than the JAR files as part of my application? To keep things simple, I started an application from scratch. Kept things to the bare minimum and I can still confirm that the problem exists. web.xml ======= <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts Blank</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-cla ss> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</l istener-class> </listener> </web-app> Struts.xml ========== <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="sample" extends="struts-default"> <action name="sample" class="sample.SampleAction"> <result>/Sample.jsp</result> </action> </package> </struts> SampleAction.java ================= package sample; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class SampleAction extends ActionSupport { private Integer param; public String execute() { System.out.println("ActionContext.getContext().getParameters() = " + ActionContext.getContext().getParameters()); return SUCCESS; } public void setParam(Integer param) { this.param = param; } public Integer getParam() { return param; } } Sample.jsp ========== <%@ page contentType="text/html;charset=UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>Sample</title> </head> <body> <h2>param = <s:property value="param"/></h2> </body> </html> applicationContext.xml ====================== <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans default-autowire="autodetect"> <!-- add your spring beans here --> </beans> struts.properties ================= <EMPTY> Configured the context path to be "sample". Ran the application and put this URL in the address bar http://cpu2800:8988/sample/sample.action?param=1 That produced the following in the console (as I did away with logging, just plain System.out.println) 06/11/27 17:23:33 ActionContext.getContext().getParameters() = {} And my browser showed the following param = I can assure you that those are the only files in my project. Thanks again for your help. -----Original Message----- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Sunday, November 26, 2006 6:07 PM To: Struts Users Mailing List Subject: Re: Parameters not being set on Action in Struts 2 On 11/26/06, Tarek Nabil <[EMAIL PROTECTED]> wrote: > I was pretty sure that the correct method was being executed, because I > had some logging statements inside. One of those statements is the one > that attempts to log the parameter Map and it's still giving the same > result; an empty Map. We'd need to see all the code exactly as it's written. For example, logger.debug(getContext().getParameters()); won't work, unless the Action has added a getContext method of its own. To simplify the test, try instead logger.debug(ActionContext.getContext().getParameters()); I added tried calling ActionContext.getContext in one of my own Actions and set a breakpoint in IDEA, to be sure it works correctly. One thing to not about type property is that it is an integer, so be sure your test is passing an integer as a parameter. That should affect the map, but it would affect what's set to the property. If time is going to be an issue, I'd strongly recommend trying an IDE with integrating debugging, since a quick step through can save a lot of temporary logging statements. The W2/S2 framework is also very testable, and nothing saves more development time than a solid set of unit tests from the get-go. If your application does need to do alot of logging, a very good place to do that is from an Intercetpor, so that the logging can be applied uniformly. HTH, Ted. ********************************************DISCLAIMER******************************************** This email and any files transmitted with it are confidential and contain privileged or copyright information. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify us of the receipt thereof. If you have received this message in error, please notify the sender immediately, and delete this email from your system. Please note that e-mails are susceptible to change.The sender shall not be liable for the improper or incomplete transmission of the information contained in this communication,nor for any delay in its receipt or damage to your system.The sender does not guarantee that this material is free from viruses or any other defects although due care has been taken to minimise the risk. ************************************************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]