A detailed introduction to the return value of the method of the @Controller class in the SpringMVC framework

Table of contents

foreword

1. The return value type is ModelAndView

2. The return value is String (view)

3. The return value is void

4. The return value is Object

5. The return value is List<>

 6. The return value is String (data)


foreword

In the SpringMVC framework, our most common is the @Controller annotation. It can be said that as long as you see the @Controller annotation, it can indicate that the current project uses the SpringMVC framework. So in the class that uses the @Controller annotation, is there anything else that needs to be paid attention to? The answer is yes.

The SpringMVC framework stipulates that after the @Controller annotation is used, the return value type of the method in the class where the @Controller annotation is located also has corresponding rules. The return value type is as follows:

Next, we will carefully introduce what each return value type means.

1. The return value type is ModelAndView

2. The return value is String (view)

3. The return value is void

 4. The return value is Object

5. The return value is List<>

 6. The return value is String (data)




! ! Notice! !

Brothers, the following is what I must recite every day. If you don’t like it, you don’t have to read a word.

Three Character Classic

                                                                                Wang Yinglin of the Southern Song Dynasty

At the beginning of human beings, nature is good. Sex is similar, but habits are far away.

If you don't teach, your sex will change. The way of teaching is expensive.

Former Mengmu, choose a neighbor. If you don't learn, you will die.

Dou Yanshan has a righteous prescription. Teach five sons, all famous.

It is the fault of the father whether to raise or not to teach. If the teaching is not strict, the teacher is lazy.

If you don't learn, it's not appropriate. If you don't learn when you are young, why should you be old?

Jade is not cut, not a device. If people don't learn, they don't know righteousness.

As a son of man, Fang Shaoshi. Dear teachers and friends, learn etiquette.

Fragrant Jiuling, able to warm seats. Filial piety to relatives, what should be done.

Rong is four years old and can make pears. Younger brother Yu Chang should be a prophet.

The first is filial piety, the second is knowledge. Know a certain number, know a certain text.

One becomes ten, ten becomes hundreds. Hundreds and thousands, thousands and thousands.

Three talents, heaven, earth and man. The three lights, the sun, the moon and the stars.

The three key principles are the righteousness of the monarch and his ministers. Father and son, husband and wife Shun.

It is called spring and summer, and it is called autumn and winter. At this four o'clock, luck is endless.

Said North and South, said West and East. These four directions should be in the middle.

It is called water and fire, wood, gold and soil. These five elements are basically numbers.

The ten dry ones range from Jia to Gui. Twelve branches, son to Hai.

It is called the ecliptic, where the sun turns. Said the equator, the middle right.

Below the equator, it's extremely warm. I am Chinese, in the northeast.

It's called Jianghe, and it's called Huaiji. These four desecrations are the discipline of water.

Said Daihua, Song Hengheng. The Five Sacred Mountains are the name of the mountain.

It's called scholars and farmers, and it's called industry and commerce. These four peoples are the good of the country.

It is called benevolence and righteousness, propriety, wisdom and trustworthiness. These five constants are not to be disturbed.

Born of the ground, there are plants and trees. This plant is everywhere in land and water.

There are insects and fish, and there are birds and beasts. This animal can fly away.

Rice sorghum, wheat millet. These six grains are what people eat.

Horses, cattle and sheep, chickens, dogs and hogs. These six animals are fed by people.

Said joy and anger, said sorrow and fear. Love, evil desire, seven emotions.

Blue, red, yellow, and black and white. These five colors are recognized by the eyes.

Sour, bitter, sweet, and salty. These five flavors are contained in the mouth.

The smell of mutton is burnt, and fishy and rotten. These five odors are smelled by the nose.

Pao soil leather, wood stone gold. Silk and bamboo are octaves.

It is said to go up, and it is said to enter. These four tones should be tuned and coordinated.

Great-great-grandfather, born of father. The body is the son, the son is the grandson.

From descendants to Xuan Zeng. It is the nine clans, the relationship between people.

Father and son grace, couple from. Brothers are friends, and younger brothers are respectful.

Senior and Young Preface, Friends and Friends. The king is respectful, and the minister is loyal.

These ten righteousnesses are shared by everyone. Be a teacher, don't violate it.

Cutting all down, big and small. To flax, five servings end.

Ritual and music shooting, number of imperial books. The ancient six arts are not available today.

But calligraphy, everyone obeys. Both literacy and speaking.

There are ancient characters, big and small seal characters. Li Caoji, not chaos.

If you study extensively, be afraid of its complexity. But in a nutshell, you can know the original.

All training must be paid attention to. Detailed exegesis, clear sentence reading.

As a scholar, there must be a beginning. At the end of elementary school, to the four books.

The Analects of Confucius, twenty articles. Group of disciples, remember good words.

For Mencius, stop at seven chapters. Talk about morality and benevolence.

For the mean, Zisi pen. It is not easy to be neutral.

It was Zeng Zi who became a university. Self-study Qi, to Pingzhi.

Good at filial piety, familiar with four books. Such as the Six Classics, only readable.

Poems and books are easy, and the ceremony is Spring and Autumn. The six classics should be emphasized.

There are Lianshan and Guizang. There are Zhouyi and Sanyi in detail.

There is Dianmo, and there is Xungao. There is an oath, the mystery of the book.

I am the Duke of Zhou, for Zhou Li. With the six officials, save the governance body.

The size is worn, and the book of rites is noted. Tell the holy words, and prepare for ritual and music.

It's called Guofeng, and it's called Yasong. The fourth poem should be satirical.

Poetry is dead, and it is written in Spring and Autumn. Contain praise and criticism, don't be good or evil.

The third passer has a ram. There is Zuo Shi and Gu Liang.

After it is clear, Fang reads the child. Summarize the essentials and remember the facts.

Among the five sons, there is Xun Yang. Wen Zhongzi, and Lao Zhuang.

Jing Zitong, read various histories. Test lineage, know the beginning and end.

From Xi Nong to Huangdi. The title of the Three Emperors is in the last world.

Tang Youyu, known as the Second Emperor. They are inferior to each other, and they are called prosperous times.

Xia has Yu, and Shang has Tang. King Wu of Zhou, known as the Three Kings.

Xia Chuanzi, who belongs to the world. For four hundred years, moved to Xiashe.

Tang Faxia, a national merchant. Six hundred years, until the death of Zhou.

King Wu of Zhou began to punish Zhou. Eight hundred years, the longest.

Zhou Zhedong, Wang Gangzhui. If you want to fight, you are still lobbying.

It began in the Spring and Autumn Period and ended in the Warring States Period. The five tyrants are strong, and the seven heroes come out.

Ying Qin's family began to annex. Biography II, Chu and Han struggle.

Gao Zuxing, Han Yejian. To Xiaoping, Wang Mang usurped.

Guangwu Xing, for the Eastern Han Dynasty. Four hundred years, finally dedicated.

Wei, Shu and Wu competed for the Han Ding. No. Three Kingdoms, until the Jin Dynasty.

Song Qiji, Liang Chencheng. For the Southern Dynasties, the capital is Jinling.

In the Northern Yuan and Wei Dynasties, East and West were divided. Yuwen Zhou, and Gao Qi.

From the Sui Dynasty to the Sui Dynasty, there was a land of earth. No longer passed on, lost the thread.

Tang Gaozu, the uprising teacher. Eliminate the chaos of the Sui Dynasty and create the foundation of the country.

Twenty biography, three hundred years. When Liang was destroyed, the country was changed.

Liang, Tang, Jin, and Han and Zhou dynasties. It is called the Five Dynasties for a reason.

Yan Song Xing, subject to Zhou Zen. The eighteenth biography, a mix of north and south.

Both Liao and Jin were called emperors. The Yuan destroyed the gold, and the Song Dynasty.

Wide map, ahead of the generation. In ninety years, Guozuo was abolished.

Taizu Xing, Guo Daming. The name is Hongwu, and the capital is Jinling.

He became the ancestor and moved to Yanjing. Sixteenth, to Chongzhen.

Quan eunuchs, Kou Rulin. Li broke out, and the artifact burned.

The ancestor of the Qing Dynasty was appointed by Jingming. Jing Sifang, Ke Dading.

From Kangyong to Qianjia. The people are safe and prosperous, and the achievements of governance are praised.

Between Dao and Xian, chaos arose. The beginning of Britain and France, bothering are contemptible.

After Tongguang, Xuantong was weak. It is said that the Nine Emperors died in the Qing Dynasty.

The revolution prospers and the monarchy is abolished. Establish a constitution and establish the Republic of China.

The history of ancient and modern times is all here. Contain chaos, know the rise and fall.

Although the history is complicated, I read it once. Records of the Historian one, Book of Han two.

Later Han three, Guozhi four. It also serves as a reference to the classics and references.

Those who read history, examine the record. Through the past and the present, it is like seeing one's own eyes.

Recite by mouth, but by heart. The dynasty is here, and the evening is here.

Xi Zhongni, teacher Xiang Lian. The ancient sages are still diligent in learning.

Zhao Zhongling, read Lu Lun. He is both an official and a diligent student.

Weaving with cattail and cutting bamboo slips. He has no books, and he knows how to encourage him.

The head is suspended from the beam, and the cone stabs the strands. If he doesn't teach, he works hard.

Such as capsule firefly, such as Yingxue. Although the family is poor, he never stops studying.

Such as negative salary, such as hanging angle. Although the body is tired, it is still bitter.

Su Laoquan, twenty-seven. Began to get angry and read books.

Since he is old, it is too late to regret. Er Xiaosheng, you should think early.

Ruo Liang Hao, eighty-two. For the Great Court, Quedos.

He is accomplished, and everyone calls it different. Er Xiaosheng, should be determined.

Ying is eight years old and can sing poems. Bi is seven years old and can play chess.

Bi Yingwu is amazing. If you are young, you should follow suit.

Cai Wenji can distinguish the piano. Xie Daoyun, who can chant.

That woman is smart. Er man, be a policeman.

Tang Liuyan, Fang was seven years old. Raise child prodigies and make orthographic characters.

Although Yan was young, he was already an official. Promising person, also if.

Dogs keep vigil at night, chickens watch the morning. If you don't learn, you will be a human being.

Silkworms weave silk, bees make honey. People do not learn, not as good as things.

Learn when you are young, and act when you are strong. From the top to the king, from the bottom to Zemin.

Raise your name and show your parents. More light than the front, more than the back.

The leftover son, Jin Manying. I teach my son, the only scripture.

Diligence is meritorious, but drama is useless. Take precautions, try your best.

Guess you like

Origin blog.csdn.net/weixin_44362089/article/details/127463948