• Welcome to KonaKart Community Forum. Please login or sign up.
 

images in Konakart with configuration record

Started by victorius, December 09, 2009, 09:20:37 pm

Previous topic - Next topic

victorius

We have changed the parms in the konakartadmin for the base url for the images and the image base path.
Now within the Konakartadmin we can connect to the directory where the images are stored.

On the website we don't see the images that where connected to the product.
It seems that in the .jsp there is no connection to the configuration record of the images directory.
In the .jsp we see the following coding:

<img src="images/<%=prod.getImage()%>" border="0" alt="<%=prod.getName()%>" title=" <%=prod.getName()%> " width="<%=kkEng.getSmallImageWidth()%>" height="<%=kkEng.getSmallImageHeight()%>" hspace="5" vspace="5">

Can anybody gives us how we can connect to the configuration record in th .jsp?

ReneA

You can add the lines marked in red to you jsp.
In the top of the jsp:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<bean:define id="kkEng" name="konakartKey" type="com.konakart.al.KKAppEng"/>

<%
  com.konakart.app.KKEng eng;
  com.konakart.app.KKConfiguration conf;

  //Instantiate an object to interface to the main engine
  eng = new com.konakart.app.KKEng();
 
  // Replace with the appropiate config key !!
  conf = eng.getConfiguration("IMAGE_BASE_URL");
  if (conf == null)
  { throw new com.konakart.app.KKException(
            "The Configuration record could not be found.");
  }
  String configValue = conf.getValue();
%>


You may use the config value as in:

<img src="<%=configValue%>images/<%=prod.getImage()%>" border="0" alt="<%=prod.getName()%>" title=" <%=prod.getName()%> " width="<%=kkEng.getSmallImageWidth()%>" height="<%=kkEng.getSmallImageHeight()%>" hspace="5" vspace="5">