我有这样一个业务逻辑:现在做了一个网站,有一些网页时需要登录后才可以浏览,现在有这样一个要求,在浏览某些特定网页,跳转到登录页面,登录后,怎么样才能返回原页面?

2014-4-4 9:03:58 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\software\MyEclipse8.5\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;E:\tomcat6\bin
2014-4-4 9:03:59 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2014-4-4 9:03:59 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 333 ms
2014-4-4 9:03:59 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2014-4-4 9:03:59 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.36
2014-4-4 9:03:59 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor cms31.xml
FSM3.1-INFO: Job execution threads will use class loader of thread: main (org.quartz.simpl.SimpleThreadPool) [2014-04-04 09:04:00,171]
FSM3.1-INFO: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl (org.quartz.core.SchedulerSignalerImpl) [2014-04-04 09:04:00,216]
FSM3.1-INFO: Quartz Scheduler v.1.8.4 created. (org.quartz.core.QuartzScheduler) [2014-04-04 09:04:00,217]
FSM3.1-INFO: RAMJobStore initialized. (org.quartz.simpl.RAMJobStore) [2014-04-04 09:04:00,221]
FSM3.1-INFO: Scheduler meta-data: Quartz Scheduler (v1.8.4) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
  (org.quartz.core.QuartzScheduler) [2014-04-04 09:04:00,223]
FSM3.1-INFO: Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' (org.quartz.impl.StdSchedulerFactory) [2014-04-04 09:04:00,225]
FSM3.1-INFO: Quartz scheduler version: 1.8.4 (org.quartz.impl.StdSchedulerFactory) [2014-04-04 09:04:00,226]
FSM3.1-INFO: ------- 作业调度初始化完毕。 -------- (com.fsm.task.SchedulerService) [2014-04-04 09:04:00,226]
FSM3.1-INFO: ------- 开始设置作业列表 ---------------- (com.fsm.task.SchedulerService) [2014-04-04 09:04:00,226]
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
FSM3.1-INFO: 任务表调度器中没有作业信息! (com.fsm.task.SchedulerService) [2014-04-04 09:04:01,444]
FSM3.1-INFO: Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. (org.quartz.core.QuartzScheduler) [2014-04-04 09:04:01,445]
FSM3.1-INFO: ------- 作业调度启动完毕。 ----------------- (com.fsm.task.SchedulerService) [2014-04-04 09:04:01,445]
2014-4-4 9:04:01 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
2014-4-4 9:04:01 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2014-4-4 9:04:01 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory blog0.1
2014-4-4 9:04:01 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(E:\tomcat6\webapps\blog0.1\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2014-4-4 9:04:01 org.apache.catalina.core.ApplicationContext log
信息: Loading Spring root WebApplicationContext
2014-4-4 9:04:05 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2014-4-4 9:04:05 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2014-4-4 9:04:05 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2014-4-4 9:04:05 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2014-4-4 9:04:05 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2014-4-4 9:04:05 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2014-4-4 9:04:05 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2014-4-4 9:04:05 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/18  config=null
2014-4-4 9:04:05 org.apache.catalina.startup.Catalina start
信息: Server startup in 6411 ms
Hibernate: select count(*) as col_0_0_ from article article0_ order by article0_.id desc
pageIndex=1
start=0
Hibernate: select article0_.id as id1_, article0_.articles_id as articles2_1_, article0_.Title as Title1_, article0_.Content as Content1_, article0_.Article_Type as Article5_1_, article0_.InfoFlag as InfoFlag1_, article0_.OriginalFlag as Original7_1_, article0_.IsHasImg as IsHasImg1_, article0_.AuthorIP as AuthorIP1_, article0_.AuthorId as AuthorId1_, article0_.AuthorName as AuthorName1_, article0_.RecordTime as RecordTime1_, article0_.DotNumber as DotNumber1_, article0_.RevertNumber as RevertN14_1_, article0_.RevertTime as RevertTime1_, article0_.ArticleState as Article16_1_, article0_.TopID as TopID1_ from article article0_ order by article0_.id asc limit ?
ip=0:0:0:0:0:0:0:1
Hibernate: select article0_.id as id1_, article0_.articles_id as articles2_1_, article0_.Title as Title1_, article0_.Content as Content1_, article0_.Article_Type as Article5_1_, article0_.InfoFlag as InfoFlag1_, article0_.OriginalFlag as Original7_1_, article0_.IsHasImg as IsHasImg1_, article0_.AuthorIP as AuthorIP1_, article0_.AuthorId as AuthorId1_, article0_.AuthorName as AuthorName1_, article0_.RecordTime as RecordTime1_, article0_.DotNumber as DotNumber1_, article0_.RevertNumber as RevertN14_1_, article0_.RevertTime as RevertTime1_, article0_.ArticleState as Article16_1_, article0_.TopID as TopID1_ from article article0_ where article0_.id='11'
Hibernate: update article set articles_id=?, Title=?, Content=?, Article_Type=?, InfoFlag=?, OriginalFlag=?, IsHasImg=?, AuthorIP=?, AuthorId=?, AuthorName=?, RecordTime=?, DotNumber=?, RevertNumber=?, RevertTime=?, ArticleState=?, TopID=? where id=?
Hibernate: select revert0_.id as id2_, revert0_.articles_id as articles2_2_, revert0_.revertContent as revertCo3_2_, revert0_.revertIP as revertIP2_, revert0_.revertID as revertID2_, revert0_.revertName as revertName2_, revert0_.recordTime as recordTime2_ from revert revert0_ where revert0_.articles_id=11
[com.ssh.domain.Revert@164952d]
获取之前页面----http://localhost:8080/blog0.1/article!lookArticle.action?id=11
addr===0:0:0:0:0:0:0:1
host===0:0:0:0:0:0:0:1
port===51620
remotUser===null
----ip===http://localhost:8080/blog0.1/login!loginUI.action
uri==/blog0.1/login!loginUI.action
LoginInterceptor---url==http://localhost:8080/blog0.1/login!loginUI.action
null您还没有登录!
获取之前页面----http://localhost:8080/blog0.1/login!loginUI.action
addr===0:0:0:0:0:0:0:1
host===0:0:0:0:0:0:0:1
port===51655
remotUser===null
----ip===http://localhost:8080/blog0.1/login!login.action
uri==/blog0.1/login!login.action
LoginInterceptor---url==http://localhost:8080/blog0.1/login!login.action
null您还没有登录!
未加密的密码:tfy
Hibernate: select user0_.id as id0_, user0_.username as username0_, user0_.password as password0_, user0_.email as email0_ from user user0_ where user0_.username=? limit ?

成功




  • AJAX也是一种方法,另外就是利用拦截器,把没有登录请求都拦截掉,记住当前页面URL,强制调到登录页,等登录验证完毕再跳回去嘛.
    0
  • wj2699
    可以参考下SSO
    0
  • Mr_Qi

    貌似很多都是在登陆链接做文章,加上对应页面的url作为参数如:

    https://www.oschina.net/home/login?goto_page=http%3A%2F%2Fwww.oschina.net%2F

    不过我使用springsecurity,配置权限什么的记住cookie等等都可以

    0
  • Singer
    我会告诉很多都是 把returnURL传进去的吗 登陆以后在  redirect 过去吗?!
    0
  • cxshun
    在参数里面记录之前的页面,作为参数returnUrl,这样不管什么特殊字符,登录完成后直接redirect或者其他方式返回就OK了。
    0
  • 不是小白

    获取之前页面:

    1 String  url = request.getHeader("referer");

    0
  • 風一樣的男子
    ajax登录啊
    --- 共有 1 条评论 ---
    • boyTise能讲详细点吗?弹出一个对话框那样吗? (11个月前)  
    0
  • helloming
    request.getHeader("referer") 
    0
  • JustForFly

    在进入登录之前,将当前页面的URL记录住,然后传到登录页面。

    登录成功后,直接跳转到之前记录的URL。

    0
  • 1哥

    请求到需要登陆的页面,通过

    1 StringBuffer url = request.getRequestURL();
    2  
    3         String query = request.getQueryString();
    4  
    5         if (StringUtils.isNotBlank(query)) {
    6             url.append("?").append(query);
    7         }

    将上面的url作为一个参数,传到登陆页面,登陆的时候,将上面的url通过表单提交后台,然后跳转到上面的url就行了


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值