doGet and doPost in Servlets

I've developed an HTML page that sends information to a Servlet. In the Servlet, I am using the methods doGet() and doPost() : public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String id = req.getParameter("realname"); String password = req.getParameter("mypassword"); } public void doPost(HttpServletRequest req, HttpServle

Servlet中的doGet和doPost

我开发了一个将信息发送给Servlet的HTML页面。 在Servlet中,我使用了doGet()和doPost() : public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String id = req.getParameter("realname"); String password = req.getParameter("mypassword"); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOExc

What is the difference between servlet and jsp?

Possible Duplicates: What is the difference between JSF, Servlet and JSP? JSP Servlet and Web Programming When it comes to the open-source Java Platform, Enterprise Edition (Java EE) application server, how would you characterize the difference between: JSP Servlet While both are able to generate dynamic Web content, I am unsure about how they differ and/or how on pertain to the other

servlet和jsp有什么区别?

可能重复: JSF,Servlet和JSP有什么区别? JSP Servlet和Web编程 谈到开源Java平台企业版(Java EE)应用程序服务器时,您如何描述以下区别: JSP Servlet的 尽管两者都能够生成动态网页内容,但我不确定它们之间的差异和/或与另一方的关系。 JSP是Java Servlet Pages,通常用于呈现HTML / XHTML页面。 对我来说,这是一个PHP克隆。 最终JSP将被翻译并编译为Servlet类。 另一方面,Servlet是一个符合Servlet

Places where JavaBeans are used?

What is a JavaBean and why do I need it? Since I can create all apps with the class and interface structure? Why do I need beans? And can you give me some examples where beans are essential instead of classes and interfaces? Please explain the essentiality of a bean in the below context: Wep apps Standalone apps They often just represents real world data. Here's a simple example o

使用JavaBeans的地方?

什么是JavaBean,为什么我需要它? 因为我可以用类和接口结构创建所有应用程序? 为什么我需要豆子? 你能给我一些例子,说明bean是必不可少的,而不是类和接口? 请在下面的上下文中解释一下bean的本质: Wep应用程序 独立的应用程序 它们通常只代表真实世界的数据。 这里是一个Javabean的简单例子: public class User implements java.io.Serializable { // Properties. private Long id; private S

How do servlets work? Instantiation, sessions, shared variables and multithreading

Suppose, I have a webserver which holds numerous servlets. For information passing among those servlets I am setting session and instance variables. Now, if 2 or more users send request to this server then what happens to the session variables? Will they all be common for all the users or they will be different for each user. If they are different, then how was the server able to differentia

servlets如何工作? 实例化,会话,共享变量和多线程

假设,我有一个拥有众多servlet的web服务器。 对于在这些servlet之间传递的信息,我设置了会话和实例变量。 现在,如果有2个或更多用户向该服务器发送请求,那么会话变量会发生什么变化? 它们对于所有的用户都是共同的吗?或者对于每个用户来说它们都会有所不同。 如果它们不同,那么服务器如何能够区分不同的用户? 还有一个类似的问题,如果有n用户访问特定的servlet,那么这个servlet仅在第一次用户访问它时实例化,

stream Java alternative to ASP.NET / PHP

I've heard something and seen some examples of web application built using ASP.NET / PHP and I'm wondering what would be the equivalent way of doing similar things in Java world. Looking on the Wikipedia I have found a lot of frameworks and I'm kind of confused which one is the best. The Java equivalent of PHP and "Classic" ASP would be JSP (JavaServer Pages) with scriptl

流Java替代ASP.NET / PHP

我听说过一些东西,并且看到了使用ASP.NET / PHP构建的Web应用程序的一些示例,我想知道在Java世界中做类似事情的等效方式是什么。 在维基百科上看,我发现了很多框架,我很困惑哪一个是最好的。 PHP和“经典”ASP的Java相当于带有scriptlet(嵌入式原始Java代码)的JSP(JavaServer Pages)。 在Java Web开发世界中,Scriptlets被认为是不好的做法。 Taglib和EL(表达式语言)应该优先于scriptlet。 ASP.NET(MVC)的Java等

How include servlet output to jsp file

In my web application I have a main page that contain some information. This page is created by servlet and corresponding jsp file. Almost all other pages in my web application must contain the same information as main page plus some addition information. I don't want dublicate code, so I want to use output of main servlet in other jsp files. Below is a simple example of what I try to acc

如何将servlet输出包含到jsp文件中

在我的Web应用程序中,我有一个包含一些信息的主页面。 该页面由servlet和相应的jsp文件创建。 我的Web应用程序中的几乎所有其他页面都必须包含与主页面相同的信息以及一些附加信息。 我不需要dublicate代码,所以我想在其他jsp文件中使用主servlet的输出。 以下是我尝试完成的一个简单示例。 这是web.xml文件: <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml

How to access only Servlet2 if path is /Servlet1/Servlet2

Suppose I want to have path look like this /Servlet1?id=34/Servlet2 I want to access Servlet2 depending on the id parameter received in Servlet1, but when I try to do so system access service methods of Servlet1 only and do not go to Servlet2 I just want to skip the code for Servlet1 and move to Servlet2 when my path is /Servlet1?id=34/Servlet2 otherwise run code in Servlet 1 when path is /Se

如果路径是/ Servlet1 / Servlet2,如何仅访问Servlet2

假设我想让路径看起来像这样/ Servlet1?id = 34 / Servlet2 我想根据在Servlet1中接收到的id参数来访问Servlet2,但是当我尝试仅使用Servlet1的系统访问服务方法并且不去Servlet2 当我的路径是/ Servlet1时,我只想跳过Servlet1的代码并转移到Servlet2 ?id = 34 / Servlet2否则,当路径是/ Servlet1时运行Servlet1中的代码?id = 34 我不确定什么时候使用这种方法,在哪里访问一个Servlet,它就像是另一个Servlet的后代

What components are MVC in JSF MVC framework?

在Model,View和Controller的JSF MVC框架中? This depends on the point of view (pun intented). In the big architectural picture, your own JSF code is the V : M - Business domain/Service layer (eg EJB/JPA/DAO) V - Your JSF code C - FacesServlet In the developer picture, the architectural V is in turn dividable as below: M - Entity V - Facelets/JSP page C - Managed bean In the small

JSF MVC框架中的MVC是什么组件?

在Model,View和Controller的JSF MVC框架中? 这取决于观点(双关语)。 在大型架构图中,您自己的JSF代码是V : M - 业务域/服务层(例如EJB / JPA / DAO) V - 您的JSF代码 C - FacesServlet 在开发人员的照片中,体系结构V又可以如下划分: M - 实体 V - Facelets / JSP页面 C - 托管bean 在较小的客户图片中,开发者V又可以如下划分: M - JSF组件树 V - 渲染的HTML输出 C - 客户端(网页浏览器

Show JDBC ResultSet in HTML in JSP page using MVC and DAO pattern

I'm implementing MVC using JSP and JDBC. I have imported a database class file to my JSP file and I would like to show the data of a DB table. I don't know how I should return the ResultSet from the Java class to the JSP page and embed it in HTML. How can I achieve this? In a well designed MVC approach, the JSP file should not contain any line of Java code and the servlet class shou

使用MVC和DAO模式在JSP页面中的HTML中显示JDBC ResultSet

我正在使用JSP和JDBC实现MVC。 我已经将数据库类文件导入到我的JSP文件,并且想要显示数据库表的数据。 我不知道应该如何将ResultSet从Java类返回到JSP页面并将其嵌入到HTML中。 我怎样才能做到这一点? 在设计良好的MVC方法中,JSP文件不应包含任何Java代码行,并且该servlet类不应包含任何JDBC代码行。 假设您想要在网上商店中显示产品列表,需要创建以下代码。 代表Product真实世界实体的Product类,它应该只是一个

Retrieving servlet context, session and request in a POJO outside container

Is there any way to retrieve a session from a POJO? Or ultimately to retrieve a bean from a POJO. To clarify: Basically I am creating a bean from a servlet and I need to access the properties of that bean from outside of the web container (from a POJO). I cannot pass the request to the pojo; and the request is needed to retrieve the session. More specifically I have a web application tha

在容器外的POJO中检索servlet上下文,会话和请求

有没有办法从POJO中检索会话? 或者最终从POJO中获取一个bean。 澄清: 基本上我是从一个servlet创建一个bean,我需要从web容器外(从一个POJO)访问该bean的属性。 我无法将请求传递给pojo; 并且需要该请求来检索会话。 更具体地说,我有一个Web应用程序,它使用Cactus框架从Web界面运行JUnit测试。 然而,调用JUnit测试运行器的servlet是在jar中编译的; 我添加了额外的下拉菜单来更改JUnit测试将从中读取的设置以在