Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!

Suja Mudunuri

Greenhorn
+ Follow
since Jul 28, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Suja Mudunuri

Yes, that is what I have done. I corrected it and it is working fine.
Thank You.
I am looking for some samples to review all my basics. If you have any samples can you please give me?

Regards,
16 years ago
This is my method and in this method I am doing different mathematical operations. I am calling this method by passing an int.
Compiler gives me the following errors. I don't understand why. Can somebody help me?

int x = 2;
Vnumbers(x);

public void Vnumbers(int a){
int b = a;
System.out.println("Value of b is : " + b);
}


C:\Sujatha\MyProjects\java\Hellow.java:39: invalid method declaration; return type required
Vnumbers(x);
^
C:\Sujatha\MyProjects\java\Hellow.java:39: <identifier> expected
Vnumbers(x);
^
C:\Sujatha\MyProjects\java\Hellow.java:39: ')' expected
Vnumbers(x);
^
3 errors


int x = 2;
Vnumbers(x);

public void Vnumbers(int a){
int b = a;
System.out.println("Value of b is : " + b);
}
16 years ago
Congrats prasanna. That is a very good score.
I am also preparing for this usinf HFS and JSP. Did U go thru the API's at all?. Did U have any prior experience in servlets and JSP?. This info will help me get a better idea for my preparation.

ThankYou,
Sujatha
Thank You Nikhil for the immediate response. I am able to compile now.
16 years ago
what do I need to have in my classpath?
Do I need to put my package path? C:\Sujatha\MyProjects\beerV1\classes\com\example\model
16 years ago
I have 2 classes as below from book HFS and JSP page 84.

package com.example.model;
import java.util.*;

public class BeerExpert{
public List getBrands(String color){
List brands = new ArrayList();
if(color.equals("amber")){
brands.add("Jack Amber");
brands.add("Red Moose");
}else{
brands.add("Jail Pale Ale");
brands.add("Gout Stout");
}
return(brands);
}
}
This class compiles fine
I Am importing the above class in the following Servlet class

package com.example.web;

import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class BeerSelect extends HttpServlet{
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Beer selection Advice<br>");
String c = request.getParameter("color");

BeerExpert be = new BeerExpert();
List result = be.getBrands(c);
Iterator it = result.iterator();
while(it.hasNext()){
out.print("<br>try: " + it.next());
}
}
}
I keep getting the following error
src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:17: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src/com/example/web/BeerSelect.java:17: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
3 errors

I do have a class in this path C:\Sujatha\MyProjects\beerV1\classes\com\example\model

Can somebody please help be with what I am doing wrong?
16 years ago
Ernest,
Thank You very much for the clarification. I was not able to figureout what the problem was. compiled without warning with 1.4. Thanks again for a quick response.

Sujatha.
16 years ago
I keep getting error with Array List. I am not able to understand what the problem is. Below is my code Can somebody please help me?

package com.example.model;
import java.util.*;
public class BeerExpert{
public List getBrands(String color){
List brands = new ArrayList();
if(color.equals("amber")){
brands.add("Jack Amber");
}
return(brands);
}
}

I am getting the following errors
Note: BeerExpert.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

when I compile with -Xlint, i get the following errors
BeerExpert.java:8: warning: [unchecked] unchecked call to add(E) as a member of
the raw type java.util.List
brands.add("Jack Amber");
^
1 warning
16 years ago
I am also having the same problem. I am stuck on Page 81 on HFS and JSP book. Somebody please help me go forward.
Prasad,
I had a typo for dopost() instead of doPost()
Now I am getting this error. It is not able to see the class file. The actual path of the class file is C:\jakarta-tomcat-5.5.5\webapps\Beer-v1\WEB-INF\classes\com\example\web

HTTP Status 404 - /Beer-v1/com/example/web/BeerSelect

type Status report

message /Beer-v1/com/example/web/BeerSelect

description The requested resource (/Beer-v1/com/example/web/BeerSelect) is not available.


This is my web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
</web-app>

I am not able to see what I am doing wrong. Please help.
[ January 28, 2005: Message edited by: Suja Mudunuri ]
Hi, I have one more problem can U Please help me. This is the same exercise on page 81. I have my class file, HTML and web.xml in place. I am trying to run the app. I am able to see the form.html but when I click on submit query, I get this error(HTTP Status 405-HTTP method POST is not supported by this URL. I am not able to understand what I did wrong.
http://localhost:8080/Beer-v1/SelectBeer.do

type Status report

message HTTP method POST is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).
ThankYou, I added servlet-api.jar in the CLASSPATH and it worked.

Regards
[ January 27, 2005: Message edited by: Suja Mudunuri ]
Hello,
I am reading HF Servlets & JSP book. I am on the exercise at page 81. I am unable to compile the servlet. Compiler is unable to find javax.servlet.* package. I also set the CLASSPATH in environment variables(C:\jakarta-tomcat-5.5.5\common\lib . Can someone help me. What do I need to do to resolve this error?

Regards.
Hello,
I am new to XML. I need to know how to validate an xml file using DTD and Transform the validated XML to another XML using XSLT
read the Transformed xml using a java file, using xml and ejb, display results in jsp.
Can any body help me please, I have to prepare for some important meeting and also should show how to do it. I read Sun J2ee book it talks about SAX parser I could not get much from it. Can any body give me a sample XML, DTD and slt. I need it ASAP.

Thak You.