본문 바로가기

IT-Consultant

How to disable the Validate JSP Fragments (jsp include) preference

Include 한 jsp파일에서 JSP Problem 메세지 없애기.



Question
The activation of the Validate JSP Fragments preference is not documented or intuitive in IBM® Rational® Application Developer (RAD) v7.0. How can this preference, enabled by default, be disabled?
 
Cause
The RAD v7.0 Help does not document preference.
 
Answer
The JSP Fragment validation preference is new to RAD v7.0 in the context of Eclipse 3.2.x/Web Tools Platform (WTP) 1.5.x, which provides the underlying JSP Source editor and validation.

To set this preference :

  1. Update to a minimum of RAD v7.0.0.4 which has this fix:
    APAR PK50605: Eclipse WTP Bugzilla BUG 199175
    "Disabling JSP Fragment validation does not ignore Source validation in JSPF file"

    for RAD to work correctly with the scenario described in this bug.

  2. Verify you have the Web Developer (Basic) capability by navigating to:
    Window > Preferences... > General > Capabilities.

    If the Web developer (Basic) capability is not checked, add the capability by selecting Advanced... and selecting it from the list. Then select OK in the Advanced page.

    Select Apply followed by OK in the Preferences page to apply the changes and exit.

    It is necessary to exit the Preferences wizard for the Web Developer (Basic) capability to take effect and enable other preferences dependent on Web Developer (Basic), such as JSP Files used in the next step.

  3. Set the Validate JSP Fragments preference by navigating to it as follows:
    Window > Preferences... > Web and XML > JSP Files : [ ] Validate JSP Fragments

    It is enabled/checked by default, and must be unchecked to disable validation of JSP Fragments.

  4. Do a clean build. Any change in reported errors will be reflected in the Problems view.

The preference is enabled/checked by default. Un-check this preference if you do not want to see validation errors on a JSP Fragment (*.jspf) file. Errors on a jsp fragment may not be relevant if the jsp include file (a fragment) is dependent on settings in the parent JSP page. For example, a fragment that references a bean that is defined in the main JSP would encounter an error similar to:
    myBean cannot be resolved

This preference will only validate a jsp fragment (= jsp segment as of JSP 2.0 , also referred to as jsp include files), if the file type is *.jspf.
If a jsp file (file type = jsp) is being used as an include file (for example, as a jsp fragment), it is possible to set its Eclipse/WTP content type to "JSP Fragment" for validation purposes, The Eclipse base actually allows you to assign a content type to a specific file name in a workspace . To assign a content type to a file you can go to:
Window > Preferences... > General > Content Types > Text > JSP > JSP Fragment
Add... (button)
and then type in a file name (no full path, just the exact file name).

For example, if you have a jsp fragment named myinclude.jsp, you can enter that file name. Then, all files named myinclude.jsp in this workspace will automatically be considered jsp fragments. The resource/file RC > Properties now will show a JSP Fragment property. It will not be validated if you uncheck:
[ ] Validate JSP Fragments
, as shown previously.
You can add as many such file names or file name patterns as needed.
Warning:
You can only enter file names, not file directories (an Eclipse base limitation). Use this carefully as you may not wish for every occurence of that filename in every project to be treated as a JSP Fragment.


Note:

Eclipse WTP enhancement request bug102882: [validation] way to exclude directories & files from vali... (see Related Information section), has been submitted to provide greater control over what files are validated. You may add your comments and votes for this bugzilla.

A RAD v7.0 Help documentation APAR has been submitted requesting that the how-to information in this technote be provided and is being tracked as PK54665 for some future release.


JSP Fragment Information:
The Related information item below, Code Conventions for the JavaServer Pages Technology Version 1.x Language, discusses jsp fragments and JSP 2.0 among other things.

'IT-Consultant' 카테고리의 다른 글

jsp 에러 발생시...  (0) 2010.04.20
WTP 설치  (0) 2010.04.20
이건 뭐지...  (0) 2010.04.18
Corner Stone Case가 삭제되는 경우는 어떻게 처리하는가?  (0) 2010.04.17
Bash For Loop Examples  (0) 2010.04.17