preeti dengri

Ranch Hand
+ Follow
since Nov 30, 2000
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 preeti dengri

I am a SCJP2. I am good at
servlets,jsp,swing.I am familier with ejb & xml
if anyone had any idea about available position for
junior/middle level programmers in dallas/new york/new jersey area
please send me a mail at preeti_deng@hotmail.com or reply here.I will appreciate any help regarding Companies who hire in these areas.
Thank you
19 years ago
Hi,
I am Preeti,SCJP2 with a score of 80% and having around 6 months experience in java ( in india).I am on H4 visa status and is residing near dallas ,texas.Please refer sites for visa sponsor jobs and anybody looking for a programmer in that area.
preeti
19 years ago
Hi lim,
what i understood from ur reply is that we should mostly return Strings or array of Strings from the beans to be inserted into jsp.Is that the best way out?Did i get that right.Bcoz i also tried an example where the bean method is returning a String which contains a table tag to format the output.How can we retrieve info having several resultant Strings from a bean method(connecting to database and getting results) that are to be properly embedded into a jsp page?
Hope i am clear about my question.
appreciate any help
preeti
19 years ago
Hi,
I am not clear as to when we use
getServletConfig().getServletContext.getRequestDispatcher(String url).forward(req,res)
and
getServletContext.getRequestDispatcher(String url).forward(req,res)
what diff does getServletContext makes??? and when to use the two diff calls?
please help
preeti
19 years ago
Hello Carl,
Thanx that is a very basic thing i need to know.But even that didn't make my application running.
The jsp page, i am calling a bean from ,is not able to load the class file .It works fine if i put the BookFlights.jsp in the default dir under tomcat i.e (c:/tomcat/webapps/root/jsp) and calls the class file in this way i.e
<jsp:useBean id="customer" class="coreservlets.TravelCustomer" scope="session" />
but calling the class in the above way from http://localhost:8080/travel/BookFlights.jsp by putting BookFlights.jsp in c:/tomcat/webapps/travel is not working.
the path to coreservlets package is correctly placed in classpath and the classes are in the default dir.
Waiting for help.
preeti
19 years ago
hello,
I am stuck in the concept of forwarding a request from a servlet to a jsp page, which uses <jsp:useBean> tag,and is unable to load the class required.to simplify things here how it is
1.I have quick-search.html in c:\tomcat\webapps\travel
2.This submits the form to a servlet in c:\tomcat\webapps\webclient\servlets\coreservlets (and class in the default dir under c:\tomcat\webapps\root\web-inf\classes)by
<form name="form1" method="post" action="/servlet/coreservlets.Travel">
3.this servlet after checking the input forwards to a jsp page through a method gotoPage used for forwarding requests
gotoPage("/travel/BookFlights.jsp",request,response);
4.inside the above jsp we have
<jsp:useBean id="customer" class="coreservlets.TravelCustomer" scope="session" />
this particular jsp page is unable to laod the class TravelCustomer which is also at the same location as other servlets inside coreservlets package.
i am stuck as to when we have to use paths relative to servlet dir or to the document root and what is the best way to place all files (at places other than the default dirs under tomcat)
like inside <@ page import =" ----relative to what???"> and <jsp:useBean id="customer" class="---relative to what???">
appreciate any help
preeti
19 years ago
Hello,
i am getting the following error
C:\>javac
Error occurred during initialization of VM
Could not reserve enough space for object heap
please help in correcting it.
Preeti
19 years ago
Hi,
I am having a basic query regarding jsp and beans.when a request is made to a servlet from a jsp page and the sevlet calls respective jsp pages as responses.the individual jsp pages inturn ask a bean to open a database connection ,what is generally supposed to be a good design-- sending results from the bean directly as html(like as a table tag) or as a jsp page.
one more thing ,If several database queries are to be made is there any need to close the connection to that database??Can we use connection pooling inside beans??
please help with a sample code.
19 years ago
Hi all,
waiting for help
preeti
19 years ago
Hi Jen,
I have saved these files, SearchEngine.java and SearchSpec.java in the webclient/servlets under the webapps dir of tomcat and after compilation i saved the class files in webclient/web-inf/classes directory. this is how i have been working with the examples of the book and they were working fine.

the error i mentioned
searchengines.java:36: non-static method getName() cannot be referenced from a s
tatic context
System.out.println(searchspec.getName() +"hi");
^
is just for testing purposes i was using,but even when i removed this i got the second error that is
searchengines.java:40: non-static method makeURL(java.lang.String,java.lang.Stri
ng) cannot be referenced from a static context
String url= searchspec.makeURL(searchstring,numResults);

appreciate your help
preeti
19 years ago
Hi,
Acc to what i know is --most servers revert to url-rewriting when cookies are unsupported or are disabled.then what is the association or comminication between HttpSession objects and url rewriting??
and What if i add "back to java books catalog" and a "back to xml books catalog" links(a href) on an "Status Of Your Order" Page during a shopping cart session example,will it take care of the objects associated with the session by itself and is there any need of url rewriting in this particular case??
please help.I m stuck with these concepts.
preeti
19 years ago
Hi all,
i tried compiling the classes of the example --a front end to various search engines i.e listing 6.1 of Marty Hall's Core Servlets and JSP
and got these errors
searchengines.java:36: non-static method getName() cannot be referenced from a s
tatic context
System.out.println(searchspec.getName() +"hi");
^
searchengines.java:40: non-static method makeURL(java.lang.String,java.lang.Stri
ng) cannot be referenced from a static context
String url= searchspec.makeURL(searchstring,numResults);

where searchspec.java is a helper class to construct a search String for a particular search engine
i tried exactly the way it is given in the book but got the above errors.
What is considered to be a static context ---doGet() method???
I am unable to figure out the problem and please help me if somebody did go thru this example.
Thank You
Preeti
19 years ago
hi all,
this is an example from Marty Hall's core servlets and java server pages for restricted access to web pages(listing 4.3).there is a helper class for making a simple java properties file containing usernames and passwords
import java.util.*;
import java.io.*;
public class passwordbuilder
{
public static void main(String args[]) throws Exception
{
Properties passwords =new Properties();
passwords.put("marty","martypw");
passwords.put("bj","bjpw");

String passwordfile="c:\\javawebserver2.0\\data\\passwords.properties";
FileOutputStream out=new FileOutputStream(passwordfile);
passwords.save(out,"Passwords");
}
}
when i am using tomcat , i gave the String passwordfile to be
String passwordfile="c:\\tomcat\\webapps\\webclient\\passwords.txt";
i tried it with passwords.properties in the String ,but my servlet is not working
the steps i took is:
1) created passwordbuilder.java
2)made necessary changes to web.xml as follows
<web-app>
<servlet>
<servlet-name>
protectedpage
</servlet-name>
<servlet-class>
protectedpage
</servlet-class>
<init-param>
<param-name>passwordfile/param-name>
<param-value>passwords.txt</param-value>
</init-param>
</servlet>


</web-app>
2)created protectedpage.java which access the init parameter "passwordfile" from web.xml file.
public void init(ServletConfig config) throws ServletException
{
super.init(config);
try
{
passwordfile=config.getInitParameter("passwordfile");
passwords=new Properties();
passwords.load(new FileInputStream(passwordfile));
}
catch(IOException e){}
}
please suggest the changes to be made.
thank you
preeti
19 years ago
Thanx a bunch maha and peter for taking time to explain it so clearly and deeply.
Thanks again
preeti
19 years ago
Hi maha,
now the servlet(with the codegiven by you,rest commented) is working by typing http://localhost:8080/examples/servlet/ListManagerServlet
in the browser.i am usin Tomact as my servlet container
i added the following lines to the web.xml
[code]
<servlet>
<servlet-name>
ListManagerServlet
</servlet-name>
<servlet-class>
ListManagerServlet
</servlet-class>
<init-param>
<param-name>name</param-name>
<param-value>preethi</param-value>
</init-param>
<init-param>
<param-name>addressfile</param-name>
<param-value>address.txt</param-value>
</init-param>
<init-param>
<param-name>forum</param-name>
<param-value>ServletsAndJsp</param-value>
</init-param>
</servlet>
[code]
and the ouput is
Snoop Servlet
Servlet init parameters:
forum = ServletsAndJsp
name = preethi
addressfile = address.txt
there are few queries regarding this
1)why are parameters printed in a different sequence?
2)why are other servlets (not involving init parameters)are running successfully even when i am not touching the already existing web.xml(no new <servlet> tag added neither a <servlet-mapping> tag)?
3)the above code does not work if i omit giving a <servlet-name> tag or <servlet-mapping> i.e i tried it with just the init params in <servlet>(didn't work)??
4)where does the directory "servlets" under examples dir mapped for "servlet" in the path for any such servlet to be executed in case of tomcat??
Hope u read this all,i know it has gone a bit too lengthy.
regards
preeti
19 years ago