You need to sign in to do that
Don't have an account?
Kunal Purohit 4
Error is in expression '{!Show}' in component <apex:commandButton> in page journalpage1: Class.JournalPage1.Show: line 85, column
Below is the code and couldn't figure out what exactly is the reason, Any Suggestions??
VF code
<apex:page controller="JournalPage1" docType="html-5.0">
<apex:form >
<apex:pageBlock title="Journal Information">
<apex:pageBlockButtons location="Bottom" >
<apex:OutputPanel >
<apex:commandButton value="|<-First" action="{!firstPage}" />
<apex:commandButton value="<-Previous" action="{!previousPage}"/>
<apex:commandButton value="Next ->" action="{!nextPage}"/>
<apex:commandButton value="Last ->|" action="{!lastPage}"/>
<apex:commandbutton value="Show Details" action="{!Showdetails}"/>
</apex:OutputPanel>
</apex:pageBlockButtons>
<apex:pageBlockSection >
From Date: <apex:input type="date" value="{!startDate}" required="true" />
To Date: <apex:input type="date" value="{!endDate}" required="true" />
<apex:commandButton value="Show" action="{!Show}"/> <br/><br/>
<apex:outputPanel id="dt">
Total No of Papers:<apex:outputText value="{!count}"></apex:outputText>
<apex:actionPoller action="{!updated}" interval="300" reRender="dt"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockTable value="{!Wraplist}" var="rp" rendered="{!(Research.size!=0)}" >
<apex:column >
<apex:facet name="header"> Select CheckBox</apex:facet>
<apex:inputCheckbox value="{!rp.flagWrap}" />
</apex:column>
<apex:column headerValue="Paper Id">
<apex:outputField value="{!rp.rcWrap.id}"/>
</apex:column>
<apex:column headerValue="Paper Title">
<apex:outputField value="{!rp.rcWrap.Paper_Title__c}"/>
</apex:column>
<apex:column headerValue="Primary Author">
<apex:outputField value="{!rp.rcWrap.Name_of_Primary_Author__c}"/>
</apex:column>
<apex:column headerValue="Status">
<apex:outputField value="{!rp.rcWrap.Status__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock id="Table2" rendered="{!Showdetailsflag}" >
<apex:pageblockSection title="List of Authors">
<apex:pageBlockTable value="{!AuthList}" var="a">
<apex:column value="{!a.Research_Paper__r.Name}"/>
<apex:column value="{!a.Research_Paper__r.Paper_Title__c}"/>
<apex:column value="{!a.Author__r.Name}"/>
<apex:column value="{!a.Research_Paper__r.Status__c}"/>
<apex:column value="{!a.Research_Paper__r.Submission_Date__c}"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Controller
public with sharing class JournalPage1 {
public Date endDate { get; set; }
//public List<Research_Paper__C> Research{get;set;}
public Date startDate { get; set; }
public List<Author_Research_Paper__c> AuthList { get; set; }
public boolean Showdetailsflag { get; set; }
public List<wrapJournalPage1> WrapList { get; set; }
public PageReference lastPage() {
return null;
}
public PageReference nextPage() {
return null;
}
public PageReference previousPage() {
return null;
}
public PageReference firstPage() {
return null;
}
public void Showdetails() {
List<Id> rpID = new List<Id>();
for(wrapJournalPage1 wp : wrapList)
{
if(wp.flagWrap==true)
{
rpID.add(wp.rcWrap.Id);
}
}
for(Id i : rpID)
{
AuthList=[Select Id, Research_Paper__r.Name, Research_Paper__r.Paper_Title__c, Author__r.Name,
Research_Paper__r.Status__c, Research_Paper__r.Submission_Date__c
From Author_Research_Paper__c
Where Research_Paper__c =: i];
}
Showdetailsflag=true;
}
// public Boolean selectionflag { get; set; }
public void updated() {
Research=[Select id from Research_Paper__c];
count=Research.size();
}
public Integer count { get; set; }
public List<Research_Paper__c> Research { get; set; }
public JournalPage1()
{
Research=new list<Research_Paper__c>();
}
public PageReference Show() {
Research=[Select Id,Paper_Title__c,Name_of_Primary_Author__c,Status__c,Publication_Date__c from Research_Paper__c where Publication_Date__c>=:startDate AND
Publication_Date__c<=:endDate];
// count=Research.size();
for(Research_Paper__c rc:Research)
{
wrapJournalPage1 obj=new wrapJournalPage1(rc);
Wraplist.add(obj);
}
return null;
}
Public class wrapJournalPage1{
Public Research_Paper__c rcWrap{get; set;}
public boolean flagWrap{get;set;}
public wrapJournalPage1(Research_Paper__c rc){
this.rcWrap=rc;
this.flagWrap=false;
}
}
}
VF code
<apex:page controller="JournalPage1" docType="html-5.0">
<apex:form >
<apex:pageBlock title="Journal Information">
<apex:pageBlockButtons location="Bottom" >
<apex:OutputPanel >
<apex:commandButton value="|<-First" action="{!firstPage}" />
<apex:commandButton value="<-Previous" action="{!previousPage}"/>
<apex:commandButton value="Next ->" action="{!nextPage}"/>
<apex:commandButton value="Last ->|" action="{!lastPage}"/>
<apex:commandbutton value="Show Details" action="{!Showdetails}"/>
</apex:OutputPanel>
</apex:pageBlockButtons>
<apex:pageBlockSection >
From Date: <apex:input type="date" value="{!startDate}" required="true" />
To Date: <apex:input type="date" value="{!endDate}" required="true" />
<apex:commandButton value="Show" action="{!Show}"/> <br/><br/>
<apex:outputPanel id="dt">
Total No of Papers:<apex:outputText value="{!count}"></apex:outputText>
<apex:actionPoller action="{!updated}" interval="300" reRender="dt"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockTable value="{!Wraplist}" var="rp" rendered="{!(Research.size!=0)}" >
<apex:column >
<apex:facet name="header"> Select CheckBox</apex:facet>
<apex:inputCheckbox value="{!rp.flagWrap}" />
</apex:column>
<apex:column headerValue="Paper Id">
<apex:outputField value="{!rp.rcWrap.id}"/>
</apex:column>
<apex:column headerValue="Paper Title">
<apex:outputField value="{!rp.rcWrap.Paper_Title__c}"/>
</apex:column>
<apex:column headerValue="Primary Author">
<apex:outputField value="{!rp.rcWrap.Name_of_Primary_Author__c}"/>
</apex:column>
<apex:column headerValue="Status">
<apex:outputField value="{!rp.rcWrap.Status__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock id="Table2" rendered="{!Showdetailsflag}" >
<apex:pageblockSection title="List of Authors">
<apex:pageBlockTable value="{!AuthList}" var="a">
<apex:column value="{!a.Research_Paper__r.Name}"/>
<apex:column value="{!a.Research_Paper__r.Paper_Title__c}"/>
<apex:column value="{!a.Author__r.Name}"/>
<apex:column value="{!a.Research_Paper__r.Status__c}"/>
<apex:column value="{!a.Research_Paper__r.Submission_Date__c}"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Controller
public with sharing class JournalPage1 {
public Date endDate { get; set; }
//public List<Research_Paper__C> Research{get;set;}
public Date startDate { get; set; }
public List<Author_Research_Paper__c> AuthList { get; set; }
public boolean Showdetailsflag { get; set; }
public List<wrapJournalPage1> WrapList { get; set; }
public PageReference lastPage() {
return null;
}
public PageReference nextPage() {
return null;
}
public PageReference previousPage() {
return null;
}
public PageReference firstPage() {
return null;
}
public void Showdetails() {
List<Id> rpID = new List<Id>();
for(wrapJournalPage1 wp : wrapList)
{
if(wp.flagWrap==true)
{
rpID.add(wp.rcWrap.Id);
}
}
for(Id i : rpID)
{
AuthList=[Select Id, Research_Paper__r.Name, Research_Paper__r.Paper_Title__c, Author__r.Name,
Research_Paper__r.Status__c, Research_Paper__r.Submission_Date__c
From Author_Research_Paper__c
Where Research_Paper__c =: i];
}
Showdetailsflag=true;
}
// public Boolean selectionflag { get; set; }
public void updated() {
Research=[Select id from Research_Paper__c];
count=Research.size();
}
public Integer count { get; set; }
public List<Research_Paper__c> Research { get; set; }
public JournalPage1()
{
Research=new list<Research_Paper__c>();
}
public PageReference Show() {
Research=[Select Id,Paper_Title__c,Name_of_Primary_Author__c,Status__c,Publication_Date__c from Research_Paper__c where Publication_Date__c>=:startDate AND
Publication_Date__c<=:endDate];
// count=Research.size();
for(Research_Paper__c rc:Research)
{
wrapJournalPage1 obj=new wrapJournalPage1(rc);
Wraplist.add(obj);
}
return null;
}
Public class wrapJournalPage1{
Public Research_Paper__c rcWrap{get; set;}
public boolean flagWrap{get;set;}
public wrapJournalPage1(Research_Paper__c rc){
this.rcWrap=rc;
this.flagWrap=false;
}
}
}
Were you able to save the class? I can see error coming in both VF page and Class, please save the class first and see if throws any error.
Thanks,
Abhishek Bansal.