Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Java modifies and deletes the method of returning the current page

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

The main content of this article is to explain "the method of java modification and deletion to return to the current page". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "java modification, deletion and return to the current page of the method" it!

Here, look at the code in the background

This is backstage struts.xml.

Listinfo

When the user clicks delete or update, the first page will naturally be redirected to the first page if the parameter defaults to page=1, so we can imagine for ourselves that if a parameter is given after the parameter, the page will naturally be redirected to the number of pages on which the page is located, for example:

Listinfo?page=$ {current_page}

Here, if the type is type= "redirectAction", the following listinfo does not need to add action, if it is type= "redirect", then the following listinfo needs to add action. The specific method also has about the usage of such parameters. If you are interested, you can find it yourself.

So, how is this parameter passed in? this is the key to solving this problem. Here, the way to implement it is as follows:

① gives a hidden form on the page where the page is the number of pages on your current page

When ② returns to DeleteOrderInfoAction, remember that it must be in the JavaBean of DeleteOrderInfoAction introduced by your parameters. This class must have the setter and getter methods of page. Then, when the delete operation is completed, the current parameter page attribute will be passed to the page parameter to be redirected to a page.

Here is to give some of the code in DeleteOrderInfoAction

/ / here is the page obtained from the page operated by the current user

Private int page

/ / here is the page redirected to the page operated by the current user

Private int current_page

Public int getPage () {

Return page

}

Public void setPage (int page) {

This.page=page

}

Public int getCurrent_page () {

Return current_page

}

Public void setCurrent_page (int currentPage) {

Current_page=currentPage

}

Public String execute () throws DAOException {

/ / transfer the number of pages operated by the current user to the current_page parameter to which the page is redirected

/ / here is your delete operation

Current_page=page

Return "success"

}

Note: to give redirect parameters, there must be page getter and setter methods in the JavaBean component that you modify or delete

At this point, I believe you have a deeper understanding of the "java modification and deletion method to return to the current page". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report