Struts multi-module skills

xiaoxiao2021-03-06  72

In the past few days, the multi-module of Struts feels very embarrassed.

I also found some tips and experience.

With regard to multi-module configuration, just use different config, struts-config.xml as the default module, struts-config-module.xml as / module configuration

There are many related descriptions on 9CBS.

The module in Struts actually similar to subdirectory in the development of Web programs on weekdays, such as /-root / music / module / ..., the above / cms as the module name, all PATH in Struts-Config-CMS default /Module/xxx.do

Some tutorials say to put JSP pages in / web-inf, this is a good way, I do this, but unfortunately, Struts's Action tag does not support ContextRelative, only Forward support, if you want to use / xxx .do directly redirect or forward to a page is not going. Because their address is not found relative to /module/web-inf/xxx.jsp.

My suggestion is that the directory below root is consistent with Module. For example / / modulea / moduleb

Although safety is slightly lowered, it is very convenient to use.

General, to write a link, you can write , his benefit is built-in supporting Module, you don't need to write .do, this can make Your .do arbitrarily modifications are other without affecting the program. For example, .jspa, pretend to Webwork

The default is relative to Module. For example, the page that enters / module / Actiona points in this page, all LINK is converted to relative to / module as , actually / module / Actionb

So what should I do if I want to execute the default module? Oh, it is actually very simple. I started to start my brain, using SwitchAction to solve /Module/switch?prefix=&page=/xxx.do & ....

In fact, a traditional approach can be effectively solved. That is, You can return to the Module of the previous layer. I really didn't think it was.

The LINK label has three different link methods of Page, HREF, Action. Among them, the Action default points to a PATH, point points to a JSP page, and is also written to the external URL with respect to the Module's HREF.

转载请注明原文地址:https://www.9cbs.com/read-91484.html

New Post(0)