我正在学习Spring MVC
和Spring Security
。
当de lallow linha返回false
时,如何在页面上进行重定向?
dentro de um @Controller
?
@PostAuthorize(" hasRole('page')")
如果上面的行返回true
则没有问题。
如果上面的linha返回false
页面仍然呈现!但是所有变量都是空的,例如:显示一个带头且没有任何行的简单表。
问:@PostAuthorize
返回false
时如何重定向?
答案 0 :(得分:0)
处理控制器建议中的AccessDeniedException异常
self.category_tree = QTreeWidget(self.framemain)
self.category_tree.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.category_tree.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.category_tree.setGeometry(QRect(630, 90, 161, 381))
self.category_tree.setLayoutDirection(Qt.RightToLeft)
self.category_tree.setLocale(QLocale(QLocale.Persian, QLocale.Iran))
self.category_tree.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.category_tree.setUniformRowHeights(False)
self.category_tree.setColumnCount(1)
self.category_tree.setObjectName("category_tree")
self.category_tree.headerItem().setText(0, "1")
self.category_tree.setFrameShape(QFrame.NoFrame)
self.category_tree.header().setVisible(False)
self.category_tree.header().setSortIndicatorShown(False)
self.category_tree.setFocusPolicy(Qt.NoFocus)
self.category_tree.verticalScrollBar().setSingleStep(25)
def checkscroll(self,startx,endx):
if (startx - endx) >= 25:
#swipe from right to left
self.category_tree.verticalScrollBar().setSliderPosition(self.category_tree.verticalScrollBar().sliderPosition()+(25))
elif (startx - endx) <= -25:
self.category_tree.verticalScrollBar().setSliderPosition(self.category_tree.verticalScrollBar().sliderPosition()-abs(25))