Announcement Announcement Module
Collapse
No announcement yet.
String Literals?? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • String Literals??

    What am I doing wrong with the following: do i need to handle the String literals returned by my service method in some special way?

    I have the service method below called on a transition. Everything works fine unless the service method returns a String (although for example, returning 'success' works). I have another upload Action (where the service does not return a String) working perfectly.

    When I return a String (other than e.g. 'success') or null, or some other object everything works as expected however the app fails to transition to the next view (it remains on the file upload page).

    The fact 'success' works suggests Strings need to handled in some way???

    Service Method

    Code:
    @Service(value = "uploadLetterTemplateService")
    public class UploadLetterTemplateService
    {
    	public String processLetterTemplate(FileUpload file) throws IOException
    	{
    		//validate template
    		
    		//return "success";//works
    		//return null;//works
    		//return new AnotherObject(); //works
    		//return "success_"; fails
    		//return //(new String(file.getData().getBytes())); //fails
    	}
    }
    Code:
    	<view-state id="uploadLetterTemplate" view="uploadLetterTemplate"
    		model="fileUpload">
    		<var name="fileUpload" class="com.jpmorganchase.cam.domain.FileUpload" />
    		<transition to="summaryReport">
    			<evaluate 
    				expression="uploadLetterTemplateService.processLetterTemplate(fileUpload)" />
    		</transition>
    	</view-state>
    Last edited by alanhay; Apr 17th, 2012, 11:52 AM.

  • #2
    It depends on the return type. As explained in the reference guide. Returning 'success' means a successful invocation in this case else you can use it to drive a transition (i.e. the returned string is interpreted as the next transition). If you want to use it assign it to a variable.

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      If you want to use it assign it to a variable.
      Although I have omitted the result="x" assignment in my post, that is what I am trying to do. I simply want to return a String and store it.

      The assignment does happen but the view does not transition to the next flow.

      Code:
      <evaluate expression="uploadLetterTemplateService.processLetterTemplate(fileUpload)" result="x.y"/>
      The setter on x is called but there is no transition to the next view.

      I am obviously missing something here.

      Comment

      Working...
      X