cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to compile a servlet in SAP NWDS

Former Member
0 Kudos

Hi,

I have developed a J2EE project in SAP NWDS 7.0 SP4.

I have developed the project in J2EE Prespecrtive.

The JSP files are running fine.

But I am failing to compile the Servlet files.

According to my knowledge, there is a default Ant plugin installed

with SAP NWDS. Now, I need to check whether that Ant Pugin is enabled

or not; but I am not able to compile the Servlet file Second.java to

Second.class when I am building the .war file.

What is the step needed to be done?

Regards

Neha Singh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Neha,

The NWDS automatically compiles the servlet files. When you save them and there are no errors in them the files are also compiled.

Regards,

Ventsi Tsachev

Former Member
0 Kudos

Hi,

I have written a JSP when the user clicks the submit button it would go to

the servlet file.

My JSP File is:

<%@ page language="java" %>

<html>

<head>

<title>

Logon Verification Form

</title>

</head>

<body>

<form action="/TestPro/Checkdetails" method="post">

First name:

<input type="text" name="firstname" />

<br />

Last name:

<input type="text" name="lastname" />

</br>

<input type="button" value="Submit"/>

</form>

</body>

</html>

My Servlet File is:

package testpackage;

import java.io.IOException;

import java.io.PrintWriter;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

public class Checkdetails extends HttpServlet {

protected void doPost(

HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException {

String fname = request.getParameter("firstname");

String lname = request.getParameter("lastname");

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("<html>");

out.println("<title>");

out.println("The name details");

out.println("</title>");

out.println("<body>");

out.println("<p> Your name is " + fname + "and your title is" + lname);

out.println("</br>");

out.println("<input type=" + "button" +"value=" + "Submit" +"/>");

out.println("</body>");

doGet(request,response);

//TODO : Implement

}

}

The Web.xml is:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<display-name>WEB APP</display-name>

<description>WEB APP description</description>

<servlet>

<servlet-name>Logonver.jsp</servlet-name>

<jsp-file>/Logonver.jsp</jsp-file>

</servlet>

<servlet>

<servlet-name>Checkdetails</servlet-name>

<servlet-class>testpackage.Checkdetails</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>Checkdetails</servlet-name>

<url-pattern>

/TestPro/Checkdetails

</url-pattern>

</servlet-mapping>

</web-app>

I am building the Web Archive.

Adding this Web Archive to an Enterprise Archive.

Building the Enterprise Archive and Deploying it.

The JSP is running fine.

But whenever, I give some inputs to the JSP and click the

Submit button, it is not going to the Servlet.

Infact nothing is happening.

Regards

Neha Singh

Answers (0)