You need to sign in to do that
Don't have an account?

How to display
My Controller :
public class clsmap{
public String s{public get;public set;}
public clsmap()
{
Map<String,String> strmap=new Map<String,String>{'a'=>'apple','c'=>'cat'};
strmap.put('p','pen');
strmap.get('b');
System.debug(strmap.get('a'));
for(String s:strmap.keyset()){
if(s=='b'){
s+='cil';
system.debug(s);
}
}
}
}
My Page:
<apex:page controller="clsmap">
<apex:form >
Values:
<br/>
<apex:outputtext value="{!s}"/><br/>
</apex:form>
</apex:page>
here i want to display a value of a string s.can any one help me pls?
Thanks
public class clsmap{
public String s{public get;public set;}
public clsmap()
{
Map<String,String> strmap=new Map<String,String>{'a'=>'apple','c'=>'cat'};
strmap.put('p','pen');
strmap.get('b');
System.debug(strmap.get('a'));
for(String s:strmap.keyset()){
if(s=='b'){
s+='cil';
system.debug(s);
}
}
}
}
My Page:
<apex:page controller="clsmap">
<apex:form >
Values:
<br/>
<apex:outputtext value="{!s}"/><br/>
</apex:form>
</apex:page>
here i want to display a value of a string s.can any one help me pls?
Thanks
<pre>
public class clsmap{
public String s{public get;public set;}
public clsmap() {
Map<String,String> strmap=new Map<String,String>{'a'=>'apple','c'=>'cat'};
strmap.put('p','pen');
strmap.get('b');
System.debug(strmap.get('a'));
for(String s:strmap.keyset()){
if(s=='b'){
s+='cil';
system.debug(s);
}
}
}
}
<apex:page controller="clsmap">
<apex:form >
Values:
<br/>
<apex:outputtext value="{!s}"/><br/>
</apex:form>
</apex:page>
</pre>
In the VF page, {!s} refers to the controller property s via its getter (line 2). Yet this is never set to anything other than its default null. Within your for loop, you declare a loop variable s that is completely different that the controller variable s in line 2.