Creating and registering new storefront JavaServer Pages files
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 Stores > WebContent > StoreName.
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 New > JSP File.
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 HCL 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 HCL 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:
select * from storeent;
In the Enterprise Explorer view, expand Stores > Struts > <default module>.
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: Stores > WebContent > StoreName.
e. Add an <action> entry in custom struts configuration file.
In the action mappings section, which is found at the end of the file, replace
RecipeSection with the name of your JSP file, without the file extension
Add an action to the Struts package 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.
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.
Create a file called JSPNameCommand.xml under the
directory workspace_dir\WC\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.