Solve the problem of struts.xml can't auto-complete in MyEclipse

Source: Internet
Author: User

Because of the web-based approach, after being configured in MyEclipse, the struts.xml does not automatically eject, and finally discovers that the problem is caused by the inconsistency between the jar package referenced by the program and the version of the DTD file referenced in the Struts.xml.

The first section of the Web-based method for configuring Struts.xml in MyEclipse

first open window, select " window "menu Line-height:26px;background-color:rgb (255,255,255); font-family: ' Times New Roman '; >preferences "option:

650) this.width=650; "src=" http://s14.sinaimg.cn/mw690/9772ef17gx6CQErdwXr2d&690 "width=" 446 "height=" 370 "name = "image_operate_92151379826256485" alt= "MyEclipse in the configuration Struts.xml auto Prompt" title= "myeclipse automatically Prompt" Struts.xml " Margin:0px;padding:0px;border:0px;list-style:none; "/>


2, and then open the "Preferencesdialog box, select the leftXMLoption, under theXML Catalogoption, and then select the rightADDbutton, open the following dialog box:


650) this.width=650; "src=" http://s13.sinaimg.cn/mw690/9772ef17gx6CQEruG0Q9c&690 "width=" 690 "height=" 448 "name = "image_operate_58201379826390354" alt= "MyEclipse in the configuration Struts.xml auto Prompt" title= "myeclipse automatically Prompt" Struts.xml " Margin:0px;padding:0px;border:0px;list-style:none; "/>


3, in the dialog box that opens, in the Location"in the inputStruts.xmlfile that corresponds to theDTDthe location of the file, it is best not to choose a Chinese directory, sometimes it is because of the selection of the Chinese directory, so there is no prompt, select "File System"button to findDTDThe location of the file, under the Struts installation directoryStruts-2.0.14-all\struts-2.0.14\src\core\src\main\resources,below this path there is a "STRUTS-2.3.DTD"The file, this is the file we are looking for, so after selecting the file, LocationThe content is: "E:\STRUTS-2.3.4.1\SRC\CORE\SRC\MAIN\RESOURCES\STRUTS-2.3.DTD", Next in theKey Type"The local Choice type is"URI", in theKey"Where to enter"HTTP://STRUTS.APACHE.ORG/DTDS/STRUTS-2.3.DTD"That sentence could be on thatDTDfileDOCTYPEfound in the. :

650) this.width=650; "src=" http://s11.sinaimg.cn/mw690/9772ef17gx6CQErDzzs9a&690 "width=" 566 "height=" 496 "name = "image_operate_44431379826585563" alt= "MyEclipse in the configuration Struts.xml auto Prompt" title= "myeclipse automatically Prompt" Struts.xml " Margin:0px;padding:0px;border:0px;list-style:none; "/>


Click "OK" button to return, save exit.

This is just the one step that we want to appear automatically prompt, when I set the completion, or press "alt+/" appear prompt, press "<</span>" still no hint, so again surf the internet to check, this just know need to change editor, for MyEclipse , for a struts.xml file, its default setting is not set to myeclipse xml editor, but is set to MyEclipse STRUTS2 XML editor, so we're going to set the editor for the XML file to be the myeclipse XML editor. The specific steps are as follows:

1 , first open the Span style= "font-family: ' Times New Roman ';" >myeclipse 's window, select "file types " select "*.xml ", select" default button to set it to default, click ok button to save the exit. :


650) this.width=650; "src=" http://s2.sinaimg.cn/mw690/9772ef17gx6CQEs8NAl11&690 "width=" 690 "height=" 671 "name= "image_operate_60061379826587184" alt= "MyEclipse in the configuration Struts.xml auto Prompt" title= "myeclipse automatically Prompt" Struts.xml " Margin:0px;padding:0px;border:0px;list-style:none; "/>


So when we're in Struts.xml file, enter " <</span>"There will be a hint:

650) this.width=650; "src=" http://s16.sinaimg.cn/mw690/9772ef17gx6CQEseIvZbf&690 "width=" 389 "height=" 283 "name = "image_operate_4451379826587618" alt= "MyEclipse in the configuration Struts.xml auto Prompt" title= "myeclipse automatically Prompt" Struts.xml " Margin:0px;padding:0px;border:0px;list-style:none; "/>

Section II fix does not automatically eject the problem

After configuring MyEclipse with the above steps, The Struts.xml file is still not automatically prompted, and the reason for this is that the Struts2-core.2.2.1.1.jar package referenced in the program is inconsistent with the STRUTS-2.0.DTD version referenced in Struts.xml, so it is resolved by the following methods.

    1. Unzip the Struts2-core.jar package and copy the DTD file into a folder

      Jar XF Struts2-core-2.2.1.1.jar

    2. Reconfigure the previous configuration again and reopen the Struts.xml file to automatically eject the prompt.

Solve the problem of struts.xml can't auto-complete in MyEclipse

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.