To create and register a new JavaServer Pages (JSP) files to display in the storefront,
you must decide where to put the file in your store directory structure, create it, and register it
in the Struts configuration file.
Procedure
-
To create the JavaServer Pages (JSP) file:
-
In the Enterprise Explorer view, expand .
- Optional:
Choose or create a folder to contain the new JSP file. For example, you may want to make a new
folder under the ShoppingArea folder to contain your JSP file.
-
Right-click the folder where you want the new JSP file; then select
-
In the File name field, enter a name for the new JSP file and click
Finish. The newly created file automatically opens.
-
You are now ready to develop the code for your JSP file. However, you may want to continue
with the rest of this task, and register the file with WebSphere Commerce before proceeding with
coding. This allows you to develop the page in iterations, and see the results in the store.
-
Register your new JSP files in the Struts configuration file:
Any new JSP files must be registered in the Struts config file to be recognized by WebSphere Commerce. Modifying the Struts configuration associates a new view with the actual JSP file.
-
Determine your store ID, if you do not already know it. If you do not know your store ID, run
the following SQL query to determine the ID:
-
In the Enterprise Explorer view, expand .
-
Open the struts-config-ext.xml file.
-
Add a <forward> entry in the global forward section, which is found at the beginning of the
file. For example:
<forward className="com.ibm.commerce.struts.ECActionForward" name="RecipeSection/10001" path="/ShoppingArea/RecipeSection/RecipeSection.jsp"/>
The
name is the name of your JSP file without the extension, concatenated with / and your store ID. For
example, RecipeSection.jsp in store ID 10001 would be registered as
name="RecipeSection/10001".
The path is the relative path to your new file, from the following
location in your development environment: .
-
Add an <action> entry in the action mappings section, which is found at the end of the file.
Continuing our example, replace
RecipeSection
with the name of your JSP file,
without the file extension.
Replace the value 10001 with your own store ID.
<action path="/RecipeSection" type="com.ibm.commerce.struts.BaseAction">
<set-property property="https" value="10001:1"/>
</action>
Note:
- For extended sites, use the storeent_id of the Asset Store to which these JSP
files are registered. Individual extended sites stores inherit these commands from the asset store
because created stores have no JSP files of their own.
-
Create access control policies for the new JSP file.
By default, only site administrators can access new views. Create access control policies
for each new JSP file to allow general access.
-
Stop the WebSphere Commerce server, if it is running.
-
Create a file called JSPNameCommand.xml under the
directory WC_eardir\xml\policies\xml.
-
Paste the following into the JSPNameCommand.xml file,
and save it.
In the following example, JSPName is RecipeSection, as in our other
examples.
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE Policies SYSTEM "../dtd/accesscontrolpolicies.dtd">
<Policies>
<Action Name="RecipeSection" CommandName="RecipeSection">
</Action>
<ActionGroup Name="AllSiteUsersViews" OwnerID="RootOrganization">
<ActionGroupAction Name="RecipeSection"/>
</ActionGroup>
</Policies>
-
At the command prompt, navigate to WCDE_installdir\bin.
-
Run the following command:
acpload JSPNameCommand.xml

acpload db_name
db_user
db_password
JSPNameCommand.xml db_schema