x,y coordinate location
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(RequestProces sor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) Please help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with tags
Hi, The following JSP page results in error in Tomcat 4.1.24. Error - Generated servlet error: [javac] Since fork is true, ignoring compiler setting. [javac] Compiling 1 source file [javac] Since fork is true, ignoring compiler setting. [javac] C:\ApacheGroup\Tomcat4.1\webapps\struts-ims\work\org\apache\jsp\mappage_jsp. java:142: cannot resolve symbol [javac] symbol : variable mapurl [javac] location: class org.apache.jsp.mappage_jsp [javac] out.println (mapurl); [javac] ^ [javac] 1 error mappage.jsp --- %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % %@ page import=com.psgs.MapBean % html:html locale=true head titlebean:message key=mainmenu.title //title html:base/ /head body logic:present name='STORED_MAP' bean:define id='map' name='STORED_MAP' scope='session' toScope='page' type='MapBean' / bean:include id='mapurl' page='%= map.getMap() %' / /logic:present % out.println (mapurl); % bean:message key=mainmenu.presentation / html:form action=/mappage method=post /html:form /body /html:html When I change logic:present name='STORED_MAP'/logic:present portion with the following, mappage.jsp works fine. Any idea? % MapBean map = (MapBean)session.getAttribute(STORED_MAP); if (map != null ) mapurl = map.getMap(); % Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
image property
Hi, The struts documentation of attribute property for image tag 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=) The image tag does not have a name or id attribute. If I have more than one image tag in a form how do I differentiate one getX() from another? For example, let consider that I have two image tags in my form. The ActionForm has the following lines public class MyForm extends ActionForm { private String x; public String getX(){ return(this.x); } .. Following the documentation how do I get the value of x in my JSP page? And how do I differentiate x values for the two image tags? Thanks in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Failing to get an answer,can it be done?
Thanks Mike. It is working now. -Original Message- From: Mike Jasnowski [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 5:37 PM To: Struts Users Mailing List Subject: RE: Failing to get an answer,can it be done? Are you sure the value isn't getting reset before it gets to your page? I assume no exceptions are being thrown which prevent the field from initializing, I saw earlier you're initializing this value in the constructor. What happens if you just leave the value assigned from the private instance var and have the accessor retrive that w/o the stuff in the constructor? html:image src='%= MapForm.mapSource() %' property= / From your example, I also assume you retrieved the MapForm object from the session in the proper scope? -Original Message- From: Das, Amar [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 4:37 PM To: 'Struts Users Mailing List' Subject: RE: Failing to get an answer,can it be done? Thanks. But it is not working. In my form bean (MapForm) I am setting the following variable public class MapForm extends ActionForm { /* Map Source*/ private String mapSource=http://geo.tpmc.com/output/dqs_GEO2056217212.jpg;; . public MapForm(){ try { mapSource = map.getMapOutput().getURL(); . Then on my jsp page I am using the following html:image src='%= MapForm.mapSource() %' property= / Any suggestion? -Original Message- From: Mike Jasnowski [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 3:16 PM To: Struts Users Mailing List Subject: RE: Failing to get an answer,can it be done? Sure, html:image src='%= formBean.url %'/ or wi html-el html:image src=${formBean.url}'/ I haven't used the html-el lib so I'm guessing on that last one -Original Message- From: Das, Amar [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Failing to get an answer,can it be done? Hi, Is it possible to set the src URL of an input image tag in the action form? For example, how can I assign a URL dynamically to the src attribute of an input tag of type image? html:form .. html:image src=??? / /html:form Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: image property
Is there any example of using these utility tags? Amar -Original Message- From: Peter Smith [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 10:09 AM To: Struts Users Mailing List Subject: Re: image property You might try using an ImageButtonBean. A lot of the work you are doing is done in this bean. Here is the documentation: http://jakarta.apache.org/struts/api/org/apache/struts/util/ImageButtonBean. html HTH, Peter -- Peter Smith Software Engineer InfoNow Corporation From: Das, Amar [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 8 Sep 2003 09:53:22 -0400 To: [EMAIL PROTECTED] Subject: image property Hi, The struts documentation of attribute property for image tag 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=) The image tag does not have a name or id attribute. If I have more than one image tag in a form how do I differentiate one getX() from another? For example, let consider that I have two image tags in my form. The ActionForm has the following lines public class MyForm extends ActionForm { private String x; public String getX(){ return(this.x); } .. Following the documentation how do I get the value of x in my JSP page? And how do I differentiate x values for the two image tags? Thanks in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
populating input tag of type image
Hi, I am using the following input tag in my html:form. html:input type=image src=mapSource property= / How can I populate this input image in the associated Action Form? I am using the following method, but it is not working. public void setMapSource() { this.mapSource = map.getMapOutput().getURL(); } Thank you, Amar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Failing to get an answer,can it be done?
Hi, Is it possible to set the src URL of an input image tag in the action form? For example, how can I assign a URL dynamically to the src attribute of an input tag of type image? html:form .. html:image src=??? / /html:form Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Failing to get an answer,can it be done?
Thanks. But it is not working. In my form bean (MapForm) I am setting the following variable public class MapForm extends ActionForm { /* Map Source*/ private String mapSource=http://geo.tpmc.com/output/dqs_GEO2056217212.jpg;; . public MapForm(){ try { mapSource = map.getMapOutput().getURL(); . Then on my jsp page I am using the following html:image src='%= MapForm.mapSource() %' property= / Any suggestion? -Original Message- From: Mike Jasnowski [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 3:16 PM To: Struts Users Mailing List Subject: RE: Failing to get an answer,can it be done? Sure, html:image src='%= formBean.url %'/ or wi html-el html:image src=${formBean.url}'/ I haven't used the html-el lib so I'm guessing on that last one -Original Message- From: Das, Amar [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Failing to get an answer,can it be done? Hi, Is it possible to set the src URL of an input image tag in the action form? For example, how can I assign a URL dynamically to the src attribute of an input tag of type image? html:form .. html:image src=??? / /html:form Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: WELCOME to struts-user@jakarta.apache.org
Hi, I am using the following image tag in my JSP page (map.jsp) inside a form. html:input type=image src=mapSource property= / When I invoke the JSP page in a browser, the src should be populated with an URL for map image (http://../map1.jpg). But it does not. Please help. The form bean and action class and their mapping are shown below. MapForm Class = import org.apache.struts.action.ActionForm ; import com.esri.aims.mtier.io.ConnectionProxy; import com.esri.aims.mtier.model.map.Map; /** * @author adas * * To change the template for this generated type comment go to * WindowPreferencesJavaCode GenerationCode and Comments */ public class MapForm extends ActionForm { /* Map Source*/ private String mapSource; private Map map; public MapForm(){ try { ConnectionProxy mcp = new ConnectionProxy(); mcp.setConnectionType(ConnectionProxy.HTTP); mcp.setService(nmfs); mcp.setHost(geo); map = new Map(); map.initMap( mcp, 0, false,false, false, false); map.setBackground(220,165,63); } catch (Exception e){ } } public String getMapSource() { return (this.mapSource); } public void setMapSource() { this.mapSource = map.getMapOutput().getURL(); } } MapAction Class == import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author adas * * To change the template for this generated type comment go to * WindowPreferencesJavaCode GenerationCode and Comments */ public class MapAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { MapForm f = (MapForm) form; // get the form bean // and take the last name value String mapSource = f.getMapSource(); // Forward control to the specified success target return (mapping.findForward(success)); } } struts-config = struts-config !-- == Form Bean Definitions === -- form-beans form-bean name=mapForm type=com.PSGS.MapForm/ /form-beans !-- == Action Mapping Definitions == -- action-mappings action path=/map type=com.PSGS.MapAction name=mapForm input=/map.jsp scope=request forward name=success path=/map.jsp/ forward name=failure path=/map.jsp/ /action /action-mappings /struts-config - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]