package myfirstmodule.actions; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; public class ADD_STRING_JA extends CustomJavaAction<java.lang.String> { private java.lang.String Student_Name; private java.lang.String Student_Mail; public ADD_STRING_JA(IContext context, java.lang.String Student_Name, java.lang.String Student_Mail) { super(context); this.Student_Name = Student_Name; this.Student_Mail = Student_Mail; } @java.lang.Override public java.lang.String executeAction() throws Exception { // BEGIN USER CODE throw new com.mendix.systemwideinterfaces.MendixRuntimeException("Java action was not implemented"); /** * Returns a string representation of this action * @return a string representation of this action */ @java.lang.Override public java.lang.String toString() { String Name=Student_Name; String Mail=Student_Mail; String add=Student_Name.concat(Student_Mail); System.out.println(add); return "ADD_STRING_JA"; // END USER } // BEGIN EXTRA CODE // END EXTRA CODE } // END USER CODE } /** * Returns a string representation of this action * @return a string representation of this action */ @java.lang.Override public java.lang.String toString() { return "ADD_STRING_JA"; } // BEGIN EXTRA CODE // END EXTRA CODE this is my code Buildfile: C:\Users\vignesh\Documents\Mendix\sample-main\deployment\build_core.xml compile: [javac] Compiling 63 source files to C:\Users\vignesh\Documents\Mendix\sample-main\deployment\run\bin [javac] C:\Users\vignesh\Documents\Mendix\sample-main\javasource\myfirstmodule\actions\ADD_STRING_JA.java:37: error: ';' expected [javac] public java.lang.String toString() [javac] ^ [javac] C:\Users\vignesh\Documents\Mendix\sample-main\javasource\myfirstmodule\actions\ADD_STRING_JA.java:59: error: class, interface, or enum expected [javac] public java.lang.String toString() [javac] ^ [javac] C:\Users\vignesh\Documents\Mendix\sample-main\javasource\myfirstmodule\actions\ADD_STRING_JA.java:62: error: class, interface, or enum expected [javac] } [javac] ^ [javac] 3 errors BUILD FAILED C:\Users\vignesh\Documents\Mendix\sample-main\deployment\build_core.xml:30: Compile failed; see the compiler error output for details. Total time: 1 second these are the errors………….can anyone say where is the exact error is?
asked
VIGNESH R
3 answers
5
Hi Vignesh,
You are trying to add extra code if you are using extra code inside // BEGIN USER CODE
// END USER CODE the command line
Thanks
Hari
answered
Hariharan Lakshmipathi Raj
2
Replace everything between \\BEGIN USERCODE and \\END USERCODE with
And in Studio Pro in the java-action itself set the Return-type to String:
answered
Tim v Steenbergen
1
You are trying to add another method in your executeAction. Try changing it to this…
public java.lang.String executeAction() throws Exception
{
// BEGIN USER CODE
String Name = Student_Name;
String add = Name.concat(Student_Mail);
return add;
// END USER
}
This will return the concatenated Strings which I think is what you wanted.