I have recently started learning Java and my question might be stupid, but still:
I'm working on a small project, now it's just a simple web-service, working on Google App Engine. We use JSP like this.
View - jsp file
& lt; Jsp: useBean id = "bean" class = "my.package.web.SpecificBean" /> & Lt; Jsp: setProperty name = "Bean" property = "request" value = "& lt;% = request%>" / & Gt; Controller - Java Bean.
public class specific bean {public zero set request (HTTPSAlert request) {/ * Preparation of data for authorization page} / --- Added --- The first time it was hidden
& lt; The method call set to set jsp: setProperty , it creates data for the page, and I am using JSTL to keep this data in the required data. Admin domain & amp; Etc., but it's not what I'm talking about. When I add authorization, I decide not to redirect people, but they have to give login page at this address. I wrote Smth like this: --- / ADDED ---
& lt; Jsp: useBean id = "bean" category = "my.package.web.SpecificBean" /> & Lt; Jsp: setProperty name = "Bean" property = "request" value = "& lt;% = request%>" / & Gt; & Lt; C: Select & gt; & Lt; C: When test = "$ {! Bean.userAuth.loggedIn}" & gt; & Lt; Html & gt; & Lt; Head & gt; & Lt; Title & gt; Please login & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; ... & lt; / Body & gt; & Lt; / Html & gt; & Lt; / C: When & gt; & Lt; C: when test = "$ {! Bean.userAuth.userValid}" & gt; & Lt; Html & gt; & Lt; Head & gt; & Lt; Title & gt; You are not allowed & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; ... & lt; / Body & gt; & Lt; / Html & gt; & Lt; / C: When & gt; & Lt; C: otherwise & gt; & Lt; Html & gt; & Lt; Head & gt; & Lt; Title & gt; The page has been requested to you & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; ... & lt; / Body & gt; & Lt; / Html & gt; & Lt; / C: otherwise & gt; & Lt; / C: Select & gt; Yes, it looks heavy, I know! In each .jsp I will have to copy-paste a large piece of code. Of course I did some corrections, like "please log in" html in different .jsp and File included in & lt;% @ = ""% " But anyway there is a decent piece of code that wraps every page. There are only 3 pages, but ... I can use two and lt;% @ include file = ""%> for "head" and "bottom", but I'm not sure - Use the file included in
& lt;% @ = ""%> > >
- Redirect (but I think this is not my last problem of architecture)
- I've heard of Spring Web Flow, I think what I want.
- Your suggestions? Div>
Authentication Your page should not know anything or think about it.
Take this argument into that check authentication and redirection if necessary.
No comments:
Post a Comment