java always pass reference (pointer) of objects to functions
when you pass string to function, the function receives pointer of the
string
but when you assign new value in function body to function argument, it only
affect the local pointer, not the original object
consider this in C:
void f1(char * s) {
s = "1234"; // you don't modify the original "hello" string
// but
strcpy(s, "1234"); // you modify the original "hello" string
}
void main() {
char * s = "hello";
f1(s);
}
in java:
target = "showForm";
is equal to : target = new String("showForm"); // you assign new object
reference, not modifying original object
you can solve your problem with:
public String _function( String target ) {
return "showForm";
}
//or if you need more than one outputs
public Object[] _function( String target ) {
return new Object[] { "showForm", "str2", "str3" };
}
public void _function( StringBuffer target ) {
// cannot use String as JVM treat String like basic type
target.setLength(0);
target.append("showForm");
}