简体   繁体   English

如何为我的jsp页面赋予动态性质?

[英]how to give dynamic nature to my jsp pages?

Question is pretty lame I know. 我知道问题很la脚。 And the answer is pretty simple - AJAX (I think, I'm not sure). 答案很简单-AJAX(我想,我不确定)。 But before proceeding further, I would like to know if there's a better way. 但是在继续之前,我想知道是否有更好的方法。

My problem: 我的问题:

I have a web application, that takes in one statement from the user, and then in response to it,sends back another statement. 我有一个Web应用程序,该应用程序从用户那里接收一条语句,然后响应它,发送回另一条语句。 The whole process goes on like this. 整个过程是这样的。 So how can I give a dynamic nature to my JSP then? 那么,如何才能赋予JSP动态的本性呢? If I keep reloading the JSP, my old responses will get deleted. 如果我继续重新加载JSP,我的旧响应将被删除。 So, that's not how it works. 因此,这不是它的工作方式。

I could use RequestDispatcher 's include() method. 我可以使用RequestDispatcherinclude()方法。 I find that as one solution. 我发现这是一种解决方案。 So, I can keep including the new pages onto my old JSPs. 因此,我可以继续将新页面包含到旧的JSP中。 But again, I think this will have a limitation. 但是,我再次认为这会有局限性。 Haven't tested it yet though. 尚未测试过。

Is there a better way around? 有更好的方法吗?

Thanks for your help. 谢谢你的帮助。 :-) :-)

I'm in love with AJAX consuming Restful Webservices so that is what I would suggest. 我爱上了使用AJAX的Restful Web服务,这就是我的建议。 In addition, if I understand you correctly, I don't think include() will help you in this scenario unless you manage to keep streamming your responses in 1 open connection which isn't really ideal in most Web page scenarios. 另外,如果我对您的理解正确,我认为在这种情况下include()不会对您有所帮助,除非您设法在1个打开的连接中保持流式传输响应,这在大多数Web场景中并不理想。

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

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