Hi,
The
struts documentation says that "The property name of this image tag. The parameter names for the request will appear as "property.x" and "property.y", the x and y representing the coordinates of the mouse click for the image. A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank
string (property="")."
My
JSP page uses the image tag in the following manner
<html:image src='<%= map.getMap() %>' property=""/>
In the MapForm page I use the following
public class MapForm extends ActionForm {
private String x;
private String y;
public String getX() {
return x;
}
public String getY() {
return y;
}
public void setX(String string) {
x = string;
}
public void setY(String string) {
y = string;
}
}
The MapAction form has the following code
if (form != null) {
x = ((MapForm)form).getX();
y = ((MapForm)form).getY();
logger.info("The coords are :: " + x + " " + y);
}
My image displays OK. But when I click on the image I get the following error message. I am using
Tomcat 4.1.24.
java.lang.NullPointerException
at com.psgs.action.MapAction.execute(MapAction.java:61)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
Please help.