Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Struts2 dynamic call DMI and error Solution     - Graphics of Java Tools (Programming)

- STL spatial Configurator (Programming)

- Linux system started to learn: how to view the contents of the seed on the Linux file (Linux)

- Ubuntu / openSUSE users to install Veusz 1.21.1 (Linux)

- Bash difference in single quotes and double quotes (Programming)

- New experience Budgie (Budgerigar) desktop environment (Linux)

- I use the desktop environment in GNU / Linux combination tool (Linux)

- Ubuntu installed Gimp 2.6.11 (stable version) with PPA (Linux)

- Installing Linux and Windows 10 dual system (Linux)

- Oracle 10g relations with the constraint of column properties NULLABLE (Database)

- Eight kinds of techniques to solve hard problems Linux (Linux)

- Linux System Getting Started Learning: The Linux ac command (Linux)

- Denyhosts prevent hackers using SSH scanning (Linux)

- Element content of Java HashSet change issues (Programming)

- C language - Traverse pci device (Programming)

- General Linux interface server parameter tuning (Server)

- MySQL uses Federate engine mapping table to achieve operation of the local remote operation table (Database)

- CentOS 7.0 Enable iptables firewall (Linux)

- ORA-01000 Solution (Database)

- Linux Network Statistics Tools / Command (Linux)

 
         
  Struts2 dynamic call DMI and error Solution
     
  Add Date : 2018-11-21      
         
       
         
  In Strust2 the action can define your own way, there are two ways to call a method, one way is struts.xml specified method to indicate the need to use the method, but this method disadvantage is that if there are many ways you Action in the to configure many times, this is very complicated, another method is to use a dynamic method invocation DMI.

To take a simple example -

For example, there LoginAction add, dell method,

1, the configuration file struts.xml

1 < package name = "default" extends = "struts-default">
2 < action name = "login" class = "com.action.loginAction">
3 < result name = "add"> / add.jsp < / result>
4 < result name = "dell"> / dell.jsp < / result>
5 < / action>
6 < / package>

2, the preparation method and add in loginAction the dell methods:

public String add ()
{
  return "add";
}
public String dell ()
{
  return "dell";
}

3, used in the link! Dynamic call the desired method:

< a href="login!add"> call the add method < /a>
< a href="login!dell"> call dell method < /a>


Common mistakes:

 There is no Action mapped for namespace [/ XXX] and action name [xxx! Xxx] associated with context path [/ xxx_method].

Solution:

 The default is such Struts.xml

< Constant name = "struts.enable.DynamicMethodInvocation" value = "false" />

 We will be wrong in the address bar exclamation dynamic invocation method, we only need to change this sentence to

  < ! - Open the Struts DMI ->

 < Constant name = "struts.enable.DynamicMethodInvocation" value = "true" />
     
         
       
         
  More:      
 
- Virtual Judge environment to build and configure under Ubuntu (Server)
- Python virtual environment: Virtualenv (Linux)
- What Java 8 fastest garbage collector (Programming)
- Jetty JNDI Development combat (Linux)
- JSON data normalization (normalize) (Programming)
- To install Emacs under CentOS 6.5 (Linux)
- Examples 14 grep command (Linux)
- Linux environment Duplex (multi-machine) automatic mutual backup scheme (Linux)
- How to create SWAP files in Ubuntu 14.04 (Linux)
- Use Docker / LXC quickly launch a desktop system (Linux)
- libreadline.so.6: can not open shared object file problem solution (Linux)
- How to handle special characters in JSON (Programming)
- Android design patterns - state mode (Programming)
- Reset CentOS / RHEL root account password 7 (Linux)
- Python image processing library (PIL) to install and simple to use (Linux)
- Linux shell scripts bubble sort (Programming)
- Ubuntu 14.04 Nvidia graphics driver installation and settings (Linux)
- How to write a new Git protocol (Linux)
- Redhat Close SELinux correct step (Linux)
- The Linux kernel and AVL tree in red-black tree (Programming)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.