Sowmya Vinay

Greenhorn
+ Follow
since Feb 01, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sowmya Vinay

How do I indicate throwing exceptions by methods in UML class diagrams(In other words how do I model "public void somemethod throws java.io.IOException") ?? Is anybody aware of any special notations to represent a method throwing exceptions?? Any help is appreciated.
What version of JRun are you using? Only JRun 3.0 supports EJBs. We used JRun 3.0 (Enterprise Edition) in our company and the process of making EJBS run on JRun was quite painful and difficult. Nevertheless, after scratching our heads, we could finally deploy and use EJBs. Please refer to the documentation that comes along with it. If you are unsuccessful, I can mail you a document of steps that we undertook to deploy EJBs(Right now, I don't have it). Good Luck !! (Trust me. You need this a lot).

Originally posted by Vishakha Ahuja:
Hi,
I've installed JRUN on my home PC (Windows 98).
JRun supports EJB. I want to try out EJB examples in JRun.
Can anyone tell me how do I do that ? Has anyone tried it in
JRun with success ?


What version of JRun are you using? Only JRun 3.0 supports EJBs. We used JRun 3.0 (Enterprise Edition) in our company and the process of making EJBS run on JRun was quite painful and difficult. Nevertheless, after scratching our heads, we could finally deploy and use EJBs. Please refer to the documentation that comes along with it. If you are unsuccessful, I can mail you a document of steps that we undertook to deploy EJBs(Right now, I don't have it). Good Luck !! (Trust me. You need this a lot).

Originally posted by Vishakha Ahuja:
Hi,
Now, I do understand the difference b/w form's GET and POST methods, but when it comes to servlets, I've seen doPost() just calls the doGet() (the book is Marty Hall's Core Servlets and JSP). If that is the case, why have 2 diff. methods ? I mean shouldn't they have different purposes?



The book you mentioned"Core servlets and JSP" by Marty Hall has clearly described the 2 methods and their relevance. Please go through the JSP section once again to get a clear understanding.
24 years ago

Originally posted by Goldie Hawn:
Hi,
I want to use some of the bean properties I set thru a jsp page in a servlet. Can someone guide how do i do that....
Thanks


If the bean which you have used in the jsp page has its scope set as "session", then in the servlet, extract the same from the session by a session.getValue() or session.getAttribute() whichever holds good. Please note that the bean is created(first time it is accessed in the jsp) and stored in the session with its name being the name attribute you set in the "jsp:usebean" tag.
Lets say that you are using a bean named "Book" and set the name attribute of usebean tag as "book1".
i.e
<jsp:usebean name="book1" class="Book.class" scope="session">
then within the session, this bean is stored with name as "book1". So in order to extract it from session,
Book otherbook = (Book)session.getValue("book1");
Now, you get the bean object from session and can access its properties .
I hope I have answered your question!
24 years ago
I have started reading "Java Design Patterns" by James Cooper. But it looks as though I would be in the need of a couple of good books to get a thorough understanding of design patterns.

Originally posted by kaffo lekan:

Hello Pawar,
i still dont understand the operation, please break down the explanation futher.
Thanks
kaffo



1.System.out.println(i++ + i++);
2.System.out.println(((i++) + (i++)));
3.System.out.println((i++) + (i++));

initial value of i=1;
Consider step 1:
Let me write i++ + i++ as a + b where a=i++ before the binary + operator and b=i++ after the binary + operator.
Since a post increment is being done,the value of a is 1, value of i is i+1 i.e 2. Now the current value of i is 2, so the value of b is i which is 2 and the value of i is incremented to 3.
So final result after step 1 is:
a=1, b=2, i=3
So the results is printed as (a+b)=(1+2)=3
Write the expression in step 2, again in terms of a and b. Then
the expression would be (a+b).
Again by appliying the same procdeure as above, the value of a is current value of i which is 3 , the value of i after this post increment is 4, the value of b is current value of i, which is 4 and the value of i after this increment is 5.
So the final values are a=3,b=4 and i=5, giing a result of a+b=3+4=7.
Similarly, by applying the same procedure to 3,value of a is current value of i which is 5, i is incremented to 6, value of b is current value of i which is 6, i is incremented to 7.
Final result is a+b=5+6 = 11.
So, the algorithm can be summarised as:
1)Let a=i++ and b=i++
2) The evaluation goes as follows, a=i, i=i+1, b=i, i=i+1,a+b(from left to right).Note that the paranthesis is steps 2, and 3 are redundant and are of no significance in this case!
Hope this helps!

Suddenly this thread became alive thanks to book giveaway(or should I say vouchers giveaway). I have over an year of professional java experience , but I am yet to get over with coding!! Since I have not fully experienced all the pitfalls of professional coding(java) life, I am leaning towards SCJD path . According to me, one has to have a good amount of professional coding experience(Please note:for me experience doesn't directly relate to number of years. I consider an experienced programmer as one who is capable of writing a good, scalable,reusable program for any requirement, given the specifications, and one who is at ease, while learning any language.Sorry for digressing!! ), before one decides to take a leap on becoming an architect. This is how I feel about this issue and anyone is welcome to correct me if I am wrong!
However, this doesn't stop me from getting a voucher!

[This message has been edited by Sowmya Vinay (edited February 20, 2001).]

Originally posted by Bala Krishniah:

MyClassObject method()
{
MyClassObject myObject = new MyClassObject();
:
:
return myobject;
}

In my main, can I assign this return type to new object like this...
(1)MyClassObject myOtherObject1 = method();
(2)MyClassObject myOtherObject2 = new MyClassObject();
myOtherObject1 = method();
Which one is correct?


In the first case, you are invoking a method which initialises the object myOtherObject1 . In the second case, you are creating a new object and assigning it to myOtherObject2
Then you are assigning it to a different object via method() method. So now, your reference myotherObject1 points to a different object created by method() and the object , it initially referred, is now dangling(assuming that without any active reference to it, it would be garbage collected).
The approach suggested in case 1 is better than case 2 since it involves a lower number of object creation.So the bottom line is, it is not a rule that you should explicitly use new keyword to create and initialise an object, as long as your object reference points to the initialised object(which can be assigned to its reference type). This can either be done by a new keyword or through any other approach which assigns the object reference to an already created/initialised object.

[This message has been edited by Sowmya Vinay (edited February 19, 2001).]
jsp
To access the form parameters, you will have to use getParameter method of "request" object. "request"(instance of HttpServletRequest) is an implicitly available object for any JSP. If you have named your text field as "text1", then to extract its value use: String t1 = request.getParameter("text1");
24 years ago
<jsp:useBean id="counter" class="CounterBean" >
By using the "useBean" tag you are already doing something like this:
CounterBean counter = new CounterBean();
when it jsp is invoked for the first time(Later on , the same object may be used, depending on the scope setting).
So there is no need to initialise counter object again!
Remove the line counter = new CounterBean() from the scriptlet, and it should give the desired functionality.

[This message has been edited by Sowmya Vinay (edited February 13, 2001).]
[This message has been edited by Sowmya Vinay (edited February 13, 2001).]
24 years ago
GoTo : http://www.servlets.com/resources/com.oreilly.servlet/index.html to download the jar/zip file.
Online documentation for the api is available at: http://www.servlets.com/resources/com.oreilly.servlet/MultipartRequest.html

[This message has been edited by Sowmya Vinay (edited February 13, 2001).]
24 years ago