Article Source: Internet
In the use of struts multiple modules, find some tips and experience to share with you.
The configuration of multiple module is not said, just use a different config,
Struts-config.xml as the default module, Struts-config-module.xml as/module configuration
There are a lot of csdn on the show.
The module in struts is actually similar to a subdirectory in the development Web program on weekdays
Such as
For example, the above/music as a module name
Then all path defaults in Struts-config-music are/music/xxx.do
Some tutorials say it's a good way to put JSP pages into/web-inf,
I did it at first, too, but struts ' action tag does not support contextrelative, only forward support
Therefore, if you want to use/xxx.do Direct Redirect or forward to a page is not feasible.
Because their address is not the same as the/music/web-inf/xxx.jsp.
My suggestion is that the directory below root should be consistent with module.
For example
Although the security is somewhat reduced, it is very convenient to use.
In general, to write a link, you can write by
His advantage is the built-in support module, which does not need to be written by itself. Do, which can make your. do
Any modification to the other without affecting the operation of the program. For example,. Jspa, pretend webwork.
The default In this page, all link is converted to/module such as
So what if you want to perform the default module action? Hey, actually very simple. I began to rack my brains, using the switchaction to solve the/module/switch?prefix=&page=/xxx.do& Much trouble
In fact, a traditional approach can be effectively addressed. namely You can go back to the module in the previous layer. I couldn't have imagined it at first.
The
LINK tag has page,href,action three different linking methods.
where the action defaults to a path,page point to a JSP page, and also to an href that is relative to module to write an external URL.