Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Struts2 dynamic call DMI and error Solution     - Deploy Apache Spark cluster environment in Ubuntu (Server)

- Permissions and attributes of files and directories under Linux (Linux)

- Ubuntu terminal command - see the port occupied and off (Linux)

- Bash variable expansion modifier (Programming)

- MongoDB Learning the notes (Database)

- C ++ type conversion and RTTI (Programming)

- RMAN backup file is much larger than the size of the database Cause Analysis (Database)

- Ubuntu Gnome and Fedora 22 Gnome desktop, extended to achieve global menu (Linux)

- Source code compiled by the installation program under Linux (Linux)

- Linux Task Scheduler (at, crontab) (Linux)

- How to clear the DNS query cache under Linux / Unix / Mac (Linux)

- JDK comes with tools JPS (Linux)

- AngularJS - Custom instructions (Programming)

- Configuring automatic mail GAMIT under CentOS system (Linux)

- Linux Firewall Builder shorewall (Linux)

- Linux and SELinux Exploration Program Manager (Linux)

- PPA on Ubuntu Linux installation Plank 0.8.0 (Linux)

- Deepin Tutorial: Depth Description Installer expert mode (Linux)

- CentOS 6.5 platform offline compile and install PHP5.6.6 (Server)

- 10 Linux in the passwd command examples (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:      
 
- Moosefs Distributed File System Configuration (Server)
- How do you turn on and off IPv6 address on Fedora (Linux)
- Linux systems dmesg command processing failures and system information collected seven usage (Linux)
- Linux 10 useful examples of command-line completion (Linux)
- LAMP environment to build Apache, MySQL, PHP under Ubuntu (Server)
- The method of MySQL two kinds of incomplete recovery (Database)
- APF firewall installation and configuration under Linux (Linux)
- Virt Related Command Summary (Linux)
- C ++ stderr / stdout redirected to a file (Programming)
- How to use Java to read OpenOffice document (Programming)
- C ++ constant definition (Programming)
- Linux /var/spool/ insufficient clientmqueue space solutions (Linux)
- Database Blob data type conversion String (Programming)
- CentOS 6.6 install rsync server (Server)
- Set multiple IP addresses for a single network card on Ubuntu 15.10 (Linux)
- ORA-30926 and MERGE tables empty the temporary occupation problem (Database)
- Kibana use installation (Linux)
- Save the database data files into Oracle Learning (Database)
- C # get the current screenshot (Programming)
- Spark source code compiler package (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.