简体   繁体   English

从其余Web服务重定向HTML页面

[英]Redirect html page from rest web service

I am new to all html and rest web service. 我是所有HTML和Rest Web服务的新手。

I have use html form in index.jsp file which accepts the username and the password. 我在index.jsp文件中使用了html形式,该文件接受用户名和密码。 This form call rest web service using action attribute. 此表单使用动作属性调用其余的Web服务。

Web service authenticate the user from the username and the password provided. Web服务通过提供的用户名和密码对用户进行身份验证。 Now depending upon the authentication done by web service, I have to send various pages to client's browser again. 现在,根据Web服务进行的身份验证,我必须再次将各种页面发送到客户端的浏览器。 Like for manager, employee, admin, there will different pages for each one of these. 像经理,员工,管理员一样,每个页面都有不同的页面。 Depending on the authentication, designation is fetched from the database in web service. 根据身份验证,从Web服务中的数据库中获取指定。

I have tried with doing Response.TemporaryRedirect(uri); 我已经尝试做Response.TemporaryRedirect(uri); and Response.seeOther(uri); Response.seeOther(uri); But it didn't work for me. 但这对我没有用。

Is there any other way to redirect page from rest web service? 还有其他方法可以从其余Web服务重定向页面吗? Thank you. 谢谢。

如果您使用的是JSP,并且后面有REST,则仍然可以使用Servlet过滤器,因为您正在谈论Web应用程序。

Solved, I need to write the code for redirection using Response.TemporaryRedirect(uri) in the finnaly block. 解决了,我需要在finnaly块中使用Response.TemporaryRedirect(uri)编写用于重定向的代码。 It works for me. 这个对我有用。

正如我前面提到的那样,正如您所说的那样,HTML和REST服务位于同一位置,最好查看Servlet过滤器...它们主要在访问应用程序REST URL时调用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM