Javascript 获取从控制器到可视力组件的字符串值

Javascript 获取从控制器到可视力组件的字符串值,javascript,salesforce,apex,Javascript,Salesforce,Apex,我想从使用JavaScript的组件中的控制器获得一个值,但我对这个还不熟悉,所以我不知道如何实现它。这是我的控制器类: public with sharing class DragAndDropMultipleDirect { Public string orgID {get;set;} Public string userID {get;set;} Public string s3path {get;set;} public DragAndDropMultip

我想从使用JavaScript的组件中的控制器获得一个值,但我对这个还不熟悉,所以我不知道如何实现它。这是我的控制器类:

public with sharing class DragAndDropMultipleDirect
{
    Public string orgID {get;set;}
    Public string userID {get;set;}
    Public string s3path {get;set;}
    public DragAndDropMultipleDirect()
    {

    }

    public String path()
    {
        String orgID = UserInfo.getOrganizationId() ;
        String userID =UserInfo.getUserId();
        String s3path ='string/'+orgID+'/'+userID;
        system.debug('orgID ==== ???  '+s3path);
        return s3path;
    }
我想要组件脚本中s3path的值

<apex:component Controller="DragAndDropMultipleDirect">
    <apex:attribute name="parentId" type="String" description="Parent record"/>
    <Script>
        function readfiles(files) {
            var path = **Here I want the value of s3Path**
            ----- code----
        }
    </Script>
</apex:component>

函数readfiles(文件){
var path=**这里我想要s3Path的值**
-----代码----
}

问题在于s3Path应该保存该值。以下是修改后的控制器和组件:

public class DragAndDropMultipleDirect
{
    public string orgID {get;set;}
    public string userID {get;set;}
    public string s3path {get;set;}

    public DragAndDropMultipleDirect()
    {
        s3path = 'string/' + UserInfo.getOrganizationId() + '/' + UserInfo.getUserId();
    }
}
<apex:component Controller="DragAndDropMultipleDirect">
    <apex:attribute name="parentId" type="String" description="Parent record"/>

    <Script>
        function readfiles(files) {
            var path = '**Here I want the value of {!s3path}**';
        }
    </Script>
</apex:component>
和视觉力组件:

public class DragAndDropMultipleDirect
{
    public string orgID {get;set;}
    public string userID {get;set;}
    public string s3path {get;set;}

    public DragAndDropMultipleDirect()
    {
        s3path = 'string/' + UserInfo.getOrganizationId() + '/' + UserInfo.getUserId();
    }
}
<apex:component Controller="DragAndDropMultipleDirect">
    <apex:attribute name="parentId" type="String" description="Parent record"/>

    <Script>
        function readfiles(files) {
            var path = '**Here I want the value of {!s3path}**';
        }
    </Script>
</apex:component>

函数readfiles(文件){
var path='**这里我想要{!s3path}**'的值;
}