我是一个新奇,试图利用一个网络应用样本;
MySQL Java Tomcat JSP & Servlet
我使用的是MyEclipse Blue Edition。
持久性和服务层面已经实现。 然而,在网络内部,我有麻烦地展示指数。
- I have associated the project with tomcat 6, each time I run the project service is stopped and restarted the final line in log is INFO: Server startup in x ms
- I have created the web layer by selecting new web project from which an example index.jsp was already genereated in web root folder, I also checked that in web.xml ( I suppose this is going to be used by tomcat ) there is a tag called welcome-list indicating the first jsp that should be opened when the application starts. index.jsp is on that list.
- I have used a tutorial on how to use Servlets and extended HTTPServlet within a class at web layer, presently it does very little things, namely within index.jsp there is a button, upon clicking that button this class should forward request and responses and open up another jsp file, this I couldn t test yet.
让我们谈谈我的新的问题: 每当我管理项目服务器时,就没有发生。 我期望MyEclipse开始在自己的浏览器上展示指数,我可以从中复制/将尿素复制到一个固定浏览器。 我期望这艘游艇像当地幽灵:8080/index.jsp(在808080港使用我的计算机)。
服务器似乎在运行,我尝试了不同的组合,但我似乎无法显示指数。
* E/CN.6/2009/1。
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
</web-app>
这里是我的守法:(我迄今没有接受过测试,我的主要问题在此没有。)
public class CRMServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
System.out.println("ACTION : " + action);
if(action.equals("LoginRequest"))
{
request.setAttribute("bilgi", "cem");
request.getRequestDispatcher("Login.jsp").forward(request, response);
}
}
}