Soory恶心你。其实我英文很差。我正在使用谷歌应用程序engige开发一个春天的应用程序。 1.如果服务器处于运行模式,首先尝试登录到应用程序。首先它应该导航到登录页面 。 2.如果任何用户想要通过给页面名称来访问应用程序中的aby页面,例如(在我的应用程序中,如果我有ABC.jsp页面,如果用户通过给127.0.0.0:8888/访问该文件ABC.jsp),它应该导航到包含一些消息的某个默认页面,然后单击此处导航到主页。 现在你可以请告诉我如何在我的应用程序中做到这一点。 可以请您通过使用Spring MVC,Objectify ORM和Google应用引擎来逐步实现这一目标。用户第一次访问,导航到默认页
0
A
回答
1
还是不太明白你的问题是什么。
添加到您的web.xml
:
<welcome-file-list>
<welcome-file>/login</welcome-file>
</welcome-file-list>
</web-app>
这样,即使用户只类型http://server:port
她被重定向到http://server:port/login
。
现在如果你想让用户也被重定向到登录,如果她键入http://server:port/foobar.html
,你称之为“随机页面”,它不存在,那么你需要一个HTTP状态代码映射。
<error-page>
<error-code>404</error-code>
<location>/login</location>
</error-page>
如果你想用户必须先进行身份验证(即经过/login
)第一之前显示任何现有的页面,你可以使用Spring Security了点。简单的基本身份验证示例:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.3.xsd">
<!-- HTTP basic authentication in Spring Security -->
<http>
<intercept-url pattern="/*" access="ROLE_USER" />
<http-basic />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="password" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
0
你可以使用弹簧安全来做到这一点。看看 this链接。 http标签应该允许这样做。它将为用户指导未经身份验证的用户的登录页面。示例上下文将如下所示。
<beans:bean id="loginUrlAuthenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
<beans:property name="loginFormUrl" value="/jsp/login.jsp" />
</beans:bean>
<http auto-config="false" use-expressions="true" entry-point-ref="loginUrlAuthenticationEntryPoint">
<intercept-url pattern="/protected" access="hasRole('ROLE_protected')" />
<intercept-url pattern="/jsp/login.jsp*" filters="none"/>
<logout logout-success-url="/jsp/login.jsp" invalidate-session="true" />
<session-management invalid-session-url="/jsp/login.jsp?timeout=true" />
</http>
+0
请看清楚的主要问题线程。由于评论限制我不能在这里给你澄清。我在那里编辑了我的主要问题。谢谢 – Ratna
相关问题
- 1. 导航到的onResume默认页面()
- 2. 错误而访问导航属性在EF代码第一次
- 3. 突出默认页面的导航条
- 4. JQuery的在首页第一次访问
- 5. 的PhoneGap:导航回到第一页
- 6. 默认导航栏颜色
- 7. Javascript switch语句 - 默认第一次OK?
- 8. 导航到材料 - 用户界面表格中的第一页和分页
- 9. 我第一次安装jenkins,我如何找到默认用户名
- 10. 第一次访问Struts2 IllegalStateException
- 11. 确认后,导航到向导的第一个选项卡
- 12. 移动WordPress的网站:主题选项重置为默认第一次访问
- 13. 第一次导航至右侧
- 14. 允许匿名访问默认页面
- 15. 如何在请求的用户登录/注册到网站后导航到上次访问的页面/部分?
- 16. 使用默认导航栏文本
- 17. 导航第二次点击后第一次工作
- 18. Internet Explorer 8:导航到用户主页
- 19. 使用GIT第一次:允许其他用户访问项目
- 20. 如何访问我导航的页面?
- 21. Rails应用程序只指向默认导航索引页面
- 22. 在第一页的访问
- 23. 如何使用经典asp第一次登录时将新用户导航到不同页面
- 24. JavaScript LightWindow代替用户第一次访问页面时弹出窗口
- 25. 导航到第n个页面
- 26. onClick JavaScript在第一次访问时不起作用(页面访问)
- 27. 导航到另一页OnNavigatedTo?
- 28. Nativescript导航到同一页
- 29. 注册用户第一次访问网站显示flash讯息
- 30. 要检查用户第一次访问或不与Servlet的
是的,这是可能的。但问题很模糊,告诉我们你有什么问题,我们会尽力帮忙。 –
感谢您的回复。在这里,我正在使用spring开发一个java应用程序。现在,如果我给与IP:端口(本地主机:8080)相关的浏览器中的任何网址,它应该去登录页面。但是,如果我想限制用户输入随机网址,我应该限制他,并应该导航到登录页面。我不想让用户输入所需的页面名称来查看权限。如果他进入这样我嘘他的导航到默认或登录页面。 – Ratna
你应该知道弹簧安全是什么。 – Sreekanth