Re: [S2]All the methods with "get" prefix are invoked

2009-09-09 Thread Gábor Kovács
Hi Dennis,

You are right! Thank you very much!

Gábor


Re: [S2]All the methods with "get" prefix are invoked

2009-09-09 Thread Denis Cabasson

Hi,

The debug tag is "inspecting" the status of your action to build its 
HTML output, which include knowing the value of test1, and thus calling 
the corresponding getter.


Take out the debug tag, and everything should be back to normal.

Denis.

Gábor Kovács a écrit :

Hi everyone,

I'm confused, because I don't understand this problem:

I've made a simple Struts2 project. Here are the codes (they're short)

ACTION CLASS
---

package test.action;

import com.opensymphony.xwork2.ActionSupport;

public class TestAction extends ActionSupport{

public String getTest1(){
System.out.println("getTest1");
return SUCCESS;
}

}

STRUTS.XML





/test.jsp




WEB.XML
---
http://www.w3.org/2001/XMLSchema-instance"; xmlns="
http://java.sun.com/xml/ns/javaee"; xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; id="WebApp_ID"
version="2.5">
TEST


struts2

org.apache.struts2.dispatcher.FilterDispatcher




struts2
/*



test.jsp



TEST.JSP
--
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
.
.
.
.

 .errorMessage { color:red; }



TEST

 





When I click the link which calls the action named test, I expect that:
Struts can see the struts.xml, then calls the TestAction's execute method().
Yes, it does, but besides, it calls the TestAction's getTest1() method (it
writes "getTest1" to the console)...and if I write another method, which is
public and it's return type is String AND it has a GET prefix (getFOO)
it will be called, too.
I don't get it...Why?

Thanks in advance!

Gábor

  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



[S2]All the methods with "get" prefix are invoked

2009-09-09 Thread Gábor Kovács
Hi everyone,

I'm confused, because I don't understand this problem:

I've made a simple Struts2 project. Here are the codes (they're short)

ACTION CLASS
---

package test.action;

import com.opensymphony.xwork2.ActionSupport;

public class TestAction extends ActionSupport{

public String getTest1(){
System.out.println("getTest1");
return SUCCESS;
}

}

STRUTS.XML





/test.jsp




WEB.XML
---
http://www.w3.org/2001/XMLSchema-instance"; xmlns="
http://java.sun.com/xml/ns/javaee"; xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; id="WebApp_ID"
version="2.5">
TEST


struts2

org.apache.struts2.dispatcher.FilterDispatcher




struts2
/*



test.jsp



TEST.JSP
--
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
.
.
.
.

 .errorMessage { color:red; }



TEST

 





When I click the link which calls the action named test, I expect that:
Struts can see the struts.xml, then calls the TestAction's execute method().
Yes, it does, but besides, it calls the TestAction's getTest1() method (it
writes "getTest1" to the console)...and if I write another method, which is
public and it's return type is String AND it has a GET prefix (getFOO)
it will be called, too.
I don't get it...Why?

Thanks in advance!

Gábor