http://blog.csdn.net/carefree31441/article/details/4857546
使用 Struts2,配置一切正常,使用常用tag也正常,但是在使用<s:form>标记时,发现控制台总是输出警告信息,
    警告信息内容如下: 
    
    
    警告: 
    
      No 
      
        configuration 
        
          found 
          
            for 
            
              the 
              
                specified 
                
                  action: 'ShowMessage' in namespace: ''. Form 
                  
                    action defaulting to '
                    
                      action' attribute's literal value. 
                      
                      2008-9-6 11:35:47 org.apache.
                      
                        struts2.components.Form evaluateExtraParamsServletRequest 
                        
                        警告: 
                        
                          No 
                          
                            configuration 
                            
                              found 
                              
                                for 
                                
                                  the 
                                  
                                    specified 
                                    
                                      action: 'ShowMessage' in namespace: ''. Form 
                                      
                                        action defaulting to '
                                        
                                          action' attribute's literal value. 
                                          
                                          
                                          showmsg.jsp代码如下 
                                          
                                          
                                          <%@ taglib prefix="s" uri="/struts-tags" %> 
                                          
                                          ...... 
                                          
                                          <div> 
                                          
                                          hello world 
                                          
                                          <s:form name="ShowMessage" method="post" 
                                          
                                            action="/hello/ShowMessage.
                                            
                                              action" > 
                                              
                                              <s:textfield label="user name" name="username"></s:textfield> 
                                              
                                              <s:submit></s:submit> 
                                              
                                              </s:form> 
                                              
                                              </div> 
                                              
                                              ...... 
                                              
                                              
                                              struts.xml配置如下: 
                                              
                                              ...... 
                                              
                                              <struts> 
                                              
                                              <package name="hello" extends="struts-default" namespace="/hello"> 
                                              
                                              <
                                              
                                                action name="ShowMessage" class="com.historycreator.strutstest.ShowMessage"> 
                                                
                                                <result>/digg/showmsg.jsp</result> 
                                                
                                                </
                                                
                                                  action> 
                                                  
                                                  </package> 
                                                  
                                                  </struts> 
                                                  
                                                  
                                                  打开showmsg.jsp页面时,就出现上述异常。尝试了各种配置和访问方法,均出现警告。搜索网络给出的答案几乎都说把<s:form name="ShowMessage" method="post" 
                                                  
                                                    action="/hello/ShowMessage.
                                                    
                                                      action" >中的.
                                                      
                                                        action去掉就可以解决了,做了测试,问题仍然没有解决。更有人让把<s:去掉,不用tag,直接写<form>这个当然不会有问题,但是一会用标记,一会不用,很杂乱,并且不是解决问题的根本之道。 
                                                        
                                                        
                                                        解决方法: 
                                                        
                                                        经过测试发现,是没有正确使用tag的原因,这种情况下,正确的写法应该是,<s:form name="ShowMessage" method="post" 
                                                        
                                                          action="ShowMessage" namespace="/hello" > 
                                                          
                                                          
                                                          
                                                          原因分析: 
                                                          
                                                          
                                                          因为开始使用的
                                                          
                                                            struts2标签(form)并未指定namespace属性。所以
                                                            
                                                              struts2会默认从根命名空间"/" 搜索
                                                              
                                                                action'/hello/ShowMessage.
                                                                
                                                                  action',如搜索不到则进入默认命名空间''搜索
                                                                  
                                                                    action串,在默认命名空间中是肯定找不到自己定义的
                                                                    
                                                                      action的,所以,
                                                                      
                                                                        struts2抛出一个警告信息。 
                                                                        
                                                                        
                                                                        现在我们指定了namespace为/hello,则
                                                                        
                                                                          struts2会直接在/hello命名空间寻找。可以想象,如果在这么命名空间里找不到请求的
                                                                          
                                                                            action,也会抛出一条类似的信息。 
                                                                            
                                                                            
                                                                            注意,<s:form name="ShowMessage" method="post" 
                                                                            
                                                                              action="ShowMessage" namespace="/hello" > 
                                                                              
                                                                              不能写成<s:form name="ShowMessage" method="post" 
                                                                              
                                                                                action="ShowMessage.
                                                                                
                                                                                  action" namespace="/hello" > 
                                                                                  
                                                                                  
                                                                                  这样仍然有对应的警告信息,并且提交后出现无法访问的结果。因为没有ShowMessage.
                                                                                  
                                                                                    action这样一个
                                                                                    
                                                                                      action,这个.
                                                                                      
                                                                                        action不能由我们手工添加,
                                                                                        
                                                                                          Struts2会自动为你完成这个工作,并且手工添加是不行的,就不必多此一举了。但是在其他的场合,比如使用超级链结,则可以加上这个.
                                                                                          
                                                                                            action。
                                                                                          
                                                                                        
                                                                                      
                                                                                    
                                                                                  
                                                                                
                                                                              
                                                                            
                                                                          
                                                                        
                                                                      
                                                                    
                                                                  
                                                                
                                                              
                                                            
                                                          
                                                        
                                                      
                                                    
                                                  
                                                
                                              
                                            
                                          
                                        
                                      
                                    
                                  
                                
                              
                            
                          
                        
                      
                    
                  
                
              
            
          
        
      
    
  


 
					 
					