See Also
Code clips are snippets of code in the
Code Clips tab of the Palette
that you can use in your applications. You can insert a code clip into
code that is open in an IDE source editor, such as the Java
Editor or the JSP Editor. You can also add new code clips to the Palette
from any editor. In addition, you can rename, edit, or delete code
clips in the Palette.
The Code Clips tab has the following categories:
- Samples. Clips used to create the sample applications.
- Database and Web Services. Clips used to provide functionality
for applications using databases and web services, such as clips to access
the first, next, and previous rows in an application.
- Application Data. Clips used to access values in the application,
such as clips to retrieve values from a session.
- Web App Functions. Clips used to perform common web application
functions, such as sending email.
- Java Basics. Clips used to perform common Java programming tasks, such as loops.
- Enterprise JavaBeans. Clips that support the Enterprise JavaBeans sample program.
- JavaScript. Clips supplying some sample JavaScript code, such as getting and setting cookies.
To use a clip in your code:
- Open your code in the Java Editor or the JSP Editor, depending on the type
of code clip and where you want it to go.
- Position the cursor in your code where you want the code clip to be inserted.
- In the Palette, select the code clip and then use one of the following
techniques to add it to your code:
- Drag the code clip to the location where you want it in the source
editor.
- Right-click the code clip and choose Add to Source.
To add a clip to the Palette:
- In the Code Clips tab of the Palette, right-click the category where you want
to add the clip and choose New Clip.
- In the Code Clips Editor, type the text.
- Click Save Changes.
- If desired, rename the code clip.
To rename a clip:
- In the Palette, right-click the code clip and choose Rename.
- In the Rename Code Clips dialog box, type the new name and click OK.
To edit a clip:
- In the Palette, right-click the code clip and choose Edit.
- In the Code Clips Editor, edit the text and click OK.
To delete a clip:
- In the Palette, right-click the code clip and choose Delete.
To add a category to the Code Clips tab:
- Right-click any category and choose Create New Category.
- Enter the name of the new category in the New Palette Category dialog box, and then
click OK.
To delete a category from the Code Clips tab:
- Right-click the category you want to delete and choose
Delete Category.
- When the delete confirmation dialog box appears, click Yes.
- As stated in the confirmation dialog box, any code clips in the category
will be deleted when you delete the category.
- See Also
- About Components
- Component Tasks: Quick Reference