English 中文(简体)
MyEclipse,Java - 网上申请
原标题:MyEclipse,Java - Web Application Newbie

我是一个新奇,试图利用一个网络应用样本;

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);
}

}

}
最佳回答
  1. Go to the Window tab and select web browser. there you can define your favorite browser.
  2. For URL it should be like http://localhost:8080/{ProjectName}/index.jsp -- you can find the ProjectName with your IDE, with what name did u create the project
  3. for servlet URL s check the web.xml, and to the same URL you have to pass in the form action tag. so that button click will go to servlet doGet() method and use RequestDispatcher to forward to another jsp.

网址:xml

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

web.xml上删除,我认为如果你在源码上点击servlet,则不会通过在源码上点击servlet,则在web.xml<、servlet>、<、/servlet>、上贴有标签>的服务器上填入。

问题回答

你试图看到的道路是INCORRECT......

道路应当

<代码> 当地东道:8080/ProjectName/index.jsp或

。 是你正在做的项目的名称...... (可在 Projects下的Eclipse左边看到同样的情况)

请不要再问。

另外,是否清理和建造项目?





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...