1. 程式人生 > >struts2標籤報錯的處理方法

struts2標籤報錯的處理方法

按照網上的教程試驗了一下,在index.jsp檔案中使用struts2標籤,總是報錯:

The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed forthis tag. - [unknown location]  

web.xml如下:

<filter>
   <filter-name>struts2</filter-name>
   <filter-class>
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
   </filter-class>
 
  </filter>
  <filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>*.action</url-pattern>
  </filter-mapping>

折騰了好久,原來是因為控制器只處理了。action的訪問,需要把.jsp也交給控制器處理才能正確使用struts標籤。解決方法就是在web.xml加入以下配置:

  <filter-mapping>  
 <filter-name>struts2</filter-name>  
 <url-pattern>*.jsp</url-pattern>  
  </filter-mapping>

相關推薦

struts2標籤處理方法

按照網上的教程試驗了一下,在index.jsp檔案中使用struts2標籤,總是報錯: The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without t

java 項目 導入成功後jsp頁面處理方法

sco 右擊 選擇 end ref 服務器 ati AC 項目   本人新導入一個maven項目可是jsp頁面一直報錯,我先按照網上的經驗操作如下步驟:   在pom.xml配置文件中添加上javax.servlet的相關依賴:     <dependency>

zabbix3導入percona模板文件的處理方法

zabbix 模板 1、監控mysql的時候想使用percona模板,直接導入,卻發現以下信息:2、如下圖所示,出現時間格式的報錯 Import failed Invalid XML tag "/zabbix_export/date": "YYYY-MM-DDThh:mm:ssZ" is expect

Oracle ORA-08104處理方法及註意事項

nbsp local 3.0 性能 AI image IV sqlt 很多 【環境介紹】 系統環境:IBM P740 8205-E6C (AIX) + 11.2.0.3.0 Oracle RAC 【背景介紹】 故障描述:數據庫表空間超過90%,無法進行擴容表空間,需要業務側

CSDN程式碼內容複製後在程式中格式處理方法

很多人遇到程式程式碼複製後格式問題報錯後,往往都是直接一行一行的調節格式內容,可能程式碼量不多,一般花費10-40分鐘都可以調節過來,但其實不需要這麼麻煩,可以總結一些簡單的方法: 1、拷貝程式程式碼 2、程式設計軟體中整體報錯

go get 處理方法

報錯: package golang.org/x/text/unicode/norm: unrecognized import path "golang.org/x/text/unicode/norm" (https fetch: Get https://golang.org/x/text/un

hibernate中delete()方法處理方法

    @Override     public void del(Picture picture) {         session.beginTransaction();         System.out.println(picture.getId());   

Maven3.0環境變數設定與安裝時的處理方法

Maven3.0 環境變數配置 M2_HOME:  D:\apache-maven-3.3.9 Path:  %M2_HOME%\bin;   Maven clean時報錯的處理 錯誤: Exception in thread "main" java.lang.

SpringMVC或SpringBoot請求時間引數處理方法

一:先亮出最好的,全域性性引數處理 新建一個GlobalHandler類,同時也可以在這裡做全域性異常處理(類要加上Spring的ControllerAdvice註解);類中加入: @InitBinder public void initBinder(WebDat

一開始匯入maven專案處理方法

DescriptionResourcePathLocationType ArtifactDescriptorException:Failed to read artifact descriptor f

Fluentd整理-以及部分處理方法

1、報錯:buffer flush took longer time than slow_flush_log_threshold 2019-01-09 16:37:59 +0800 [warn]: #16 buffer flush took longer time than slow_flush_lo

Java-Eclipse匯入maven專案時,Pom.xml檔案處理方法

匯入maven專案,FIle→Import→Existing Maven Projects→找到自己想要匯入的檔案目錄→Finish。專案就匯入完成啦。接著就遇上了各種報錯!!一、Pom.xml檔案第一次報錯CoreException: Could not get the

Eclipse中的Maven專案處理方法

1.pom檔案總是提示Missing artifact  *.jar 某些jar包,自己明明下載過。如電腦重啟後或Eclipse重啟後,pom.xml檔案提示 Missing artifact 某

eclipse out of memory 記憶體溢位處理方法

在eclipse開發除錯中頻繁出現 out of memory 記憶體溢位報錯,非常頭疼,行之有效處理方法:(debug configuration --->jre---->  在Vm arguments新增) -Xms256m -Xmx512m -XX:Per

匯入sql時出現Invalid default value for 'create_time'處理方法

    當執行SQL會出現:[Err] 1067 - Invalid default value for 'c

安裝 OhMyZsh 方法 以及處理

安裝方式有兩種 curl 或 wget  curl 方式: sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/

struts2中直接訪問jsp頁面解決方法

問題描述: The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Strut s tags

ORA-01653解決方法(表空間使用率過高處理

建立oracle表時遇見以下報錯:ORA-01653: unable to extend table JT_AUDIT.CFG_AUSYS_AUDIT_PROC by 128 in tablespace AUDIT_TABLESPACE從報錯資訊來看,應該是oracle表空間

使用struts2標籤,其他功能正常。

web.xml檔案中將struts2的filter-mapping改為下面這樣的即可。 <filter-mapping>   <filter-name>struts2</filter-name>   <url-pattern>/*</url-pattern

使用pip install jupyter處理辦法及修改Jupyter默認加載路徑的方法

文件 .com -c install ali 配置 notebook align generate 1、配置python環境之後想使用Jupyter,網上查看可以使用pip install Jupyter安裝,執行命令行後正常安裝,安裝到一半以後報錯,如圖1、2 圖