I have heard that at one time the Blessed One was staying in Savatthi at Jeta's Grove, Anathapindika's monastery. There he addressed the monks, saying, "Monks."
"Yes, lord," the monks responded to him.
The Blessed One said, "Monks, Sariputta is wise, of great discernment, deep discernment, wide... joyous... rapid... quick... penetrating discernment. For half a month, Sariputta clearly saw insight [1] into mental qualities one after another. This is what occurred to Sariputta through insight into mental qualities one after another:
"There was the case where Sariputta — quite secluded from sensuality, secluded from unskillful qualities — entered & remained in the first jhana: rapture & pleasure born of seclusion, accompanied by directed thought & evaluation. Whatever qualities there are in the first jhana — directed thought, evaluation, rapture, pleasure, singleness of mind, contact, feeling, perception, intention, consciousness, [2] desire, decision, persistence, mindfulness, equanimity, & attention — he ferreted them out one after another. Known to him they arose, known to him they remained, known to him they subsided. He discerned, 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is a further escape,' and pursuing it there really was for him.
"Furthermore, with the stilling of directed thoughts & evaluations, Sariputta entered & remained in the second jhana: rapture & pleasure born of composure, unification of awareness free from directed thought & evaluation — internal assurance. Whatever qualities there are in the second jhana — internal assurance, rapture, pleasure, singleness of mind, contact, feeling, perception, intention, consciousness, desire, decision, persistence, mindfulness, equanimity, & attention — he ferreted them out one after another. Known to him they arose, known to him they remained, known to him they subsided. He discerned, 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is a further escape,' and pursuing it there really was for him.
"Furthermore, with the fading of rapture, Sariputta — remaining in equanimity, mindful & alert, and physically sensitive to pleasure — entered & remained in the third jhana, of which the noble ones declare, 'Equanimous & mindful, he has a pleasant abiding.' Whatever qualities there are in the third jhana — equanimity-pleasure, singleness of mind, contact, feeling, perception, intention, consciousness, desire, decision, persistence, mindfulness, equanimity, & attention — he ferreted them out one after another. Known to him they arose, known to him they remained, known to him they subsided. He discerned, 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He understood, He discerned that 'There is a further escape,' and pursuing it there really was for him.
"Furthermore, with the abandoning of pleasure & stress — as with the earlier disappearance of elation & distress — Sariputta entered & remained in the fourth jhana: purity of equanimity & mindfulness, neither-pleasure-nor-pain. Whatever qualities there are in the fourth jhana — a feeling of equanimity, neither pleasure nor pain; an unconcern due to serenity of awareness; [3] singleness of mind, contact, feeling, perception, intention, consciousness, desire, decision, persistence, mindfulness, equanimity, & attention — he ferreted them out one after another. Known to him they arose, known to him they remained, known to him they subsided. He discerned, 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is a further escape,' and pursuing it there really was for him.
"Furthermore, with the complete transcending of perceptions of [physical] form, with the disappearance of perceptions of resistance, and not heeding perceptions of diversity, [perceiving,] 'Infinite space,' Sariputta entered & remained in the dimension of the infinitude of space. Whatever qualities there are in the dimension of the infinitude of space — the perception of the dimension of the infinitude of space, singleness of mind, contact, feeling, perception, intention, consciousness, desire, decision, persistence, mindfulness, equanimity, & attention — he ferreted them out one after another. Known to him they arose, known to him they remained, known to him they subsided. He discerned, 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is a further escape,' and pursuing it there really was for him.
"Furthermore, with the complete transcending of the dimension of the infinitude of space, [perceiving,] 'Infinite consciousness,' Sariputta entered & remained in the dimension of the infinitude of consciousness. Whatever qualities there are in the dimension of the infinitude of consciousness — the perception of the dimension of the infinitude of consciousness, singleness of mind, contact, feeling, perception, intention, consciousness, desire, decision, persistence, mindfulness, equanimity, & attention — he ferreted them out one after another. Known to him they arose, known to him they remained, known to him they subsided. He discerned, 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is a further escape,' and pursuing it there really was for him.
"Furthermore, with the complete transcending of the dimension of the infinitude of consciousness, [perceiving,] 'There is nothing,' Sariputta entered & remained in the dimension of nothingness. Whatever qualities there are in the dimension of nothingness — the perception of the dimension of nothingness, singleness of mind, contact, feeling, perception, intention, consciousness, desire, decision, persistence, mindfulness, equanimity, & attention — he ferreted them out one after another. Known to him they arose, known to him they remained, known to him they subsided. He discerned, 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is a further escape,' and pursuing it there really was for him.
"Furthermore, with the complete transcending of the dimension of nothingness, Sariputta entered & remained in the dimension of neither perception nor non-perception. He emerged mindfully from that attainment. On emerging mindfully from that attainment, he regarded the past qualities that had ceased & changed: 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is a further escape,' and pursuing it there really was for him. [4]
"Furthermore, with the complete transcending of the dimension of neither perception nor non-perception, Sariputta entered & remained in the cessation of feeling & perception. Seeing with discernment, his fermentations were totally ended. He emerged mindfully from that attainment. On emerging mindfully from that attainment, he regarded the past qualities that had ceased & changed: 'So this is how these qualities, not having been, come into play. Having been, they vanish.' He remained unattracted & unrepelled with regard to those qualities, independent, detached, released, dissociated, with an awareness rid of barriers. He discerned that 'There is no further escape,' and pursuing it there really wasn't for him.
"If a person, rightly saying it of anyone, were to say, 'He has attained mastery & perfection in noble virtue... noble concentration... noble discernment... noble release,' he would be rightly saying it of Sariputta if he were to say: 'He has attained mastery & perfection in noble virtue... noble concentration... noble discernment... noble release.'
"If a person, rightly saying it of anyone, were to say, 'He is the Blessed One's son, his offspring — born of his mouth, born of the Dhamma, created by the Dhamma, his heir in the Dhamma, not his heir in material things,' he would be rightly saying it of Sariputta if he were to say: 'He is the Blessed One's son, his offspring — born of his mouth, born of the Dhamma, created by the Dhamma, his heir in the Dhamma, not his heir in material things.' Sariputta, monks, takes the unexcelled wheel of Dhamma set rolling by the Tathagata, and keeps it rolling rightly."
That is what the Blessed One said. Gratified, the monks delighted in the Blessed One's words.
For a discussion of how insight can be developed in the context of jhana, see The Wings to Awakening , IIIF .