This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.

Anuj Singh

Ranch Hand
+ Follow
since May 04, 2007
Merit badge: grant badges
For More
Bangalore
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Anuj Singh

Hi Friends,
I was really wondering about the current market scenario in USA&India..I mean are the openings really coming up in the market?Is the recession really over?Is it feasable to look out for a change now?

Thanks
Anuj
15 years ago
[Rudeness in the face of a volunteer who is trying to help you is not becoming, nor is it constructive. I've removed the post to give you a chance to try again.]
15 years ago

David Newton wrote:I'm not really sure what you're asking.

Have you looked at the source code? It's the easiest and quickest way to understand how it works.



Hi David,
Thanks for your reply.Here is my doubt again:
When a request comes in,,action servlet looks for the matching action mapping in the config file?Correspondingly,it gets the action and the form bean for this particular request?So after finding the appropriate action class and form bean,the action servlet creates objects of those classes.HOW?I hope its clear now?

Thanks
Anuj
15 years ago
Hi Friends,
As the question is crystal clear,I would like to know that HOW does the action servlet create an object of an action class or action form,once a request comes in&the matching action mapping is found in the struts-config file?I mean what is the mechnism behind the scenes?
15 years ago

krishna bala wrote:in scope object it will store the form object, with key/value pair



Hi Krishna,
Thanks for the answer.Can you please tell me in WHICH kind of map does it store as key/value pair?i mean is it hashMap or hashtable?
15 years ago
Hi,
As we all know,when ever a request comes in,the request processor creates an action form IF it does not already exist in session or request scope.But if the form bean or action DOES exist already,then WHERE EXACTLY does it store the form bean&action class??I mean does request processor maintain any kind of map or any kind of data struture where it stores the already existing bean or action class??

Thanks
Anuj
15 years ago
public class TestThread {
public void a() {
System.out.println("Enter in A");
for (int i = 0; i < 10; i++) {
System.out.println("Thread Name " + Thread.currentThread());
try {
Thread.sleep(100);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void main(String... args) throws InterruptedException {
TestThread t = new TestThread();
Thread tr = new Thread(new Thre(t), "MyThreads");
tr.start();
System.out.println("Going in Syn block");
t.a();
}
}
class Thre implements Runnable {
TestThread t;
Thre(TestThread t) {
this.t = t;
}
@Override
public void run() {
t.a();
}
It had the output as:


Going in Syn block
Enter in A
Enter in A
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]
Thread Name Thread[MyThreads,5,main]
Thread Name Thread[main,5,main]

Even though we got the lock on t,the main thread is getting executed in parallel with tr.Who owns the lock??How??

Hi..any body having any updates regarding current job market scenario in Java in India?Are the openings really coming up?Any idea?A I am planning to look out for a change.


Thanks
Anuj
15 years ago
Hi Antany,
A lovely explanation!Thanks a ton!!
15 years ago
Why cant we override static methods?
15 years ago
Hey guys.I am using 1.1.In my jsp somewhere I have written <html:link action="regn">SignUp</html:link>.Also in the struts-config I have my action mapping as:
<action path="/regn"
type="org.apache.struts.actions.ForwardAction"
parameter="/regnform.jsp">
</action>
On clicking on the hyperlink SignUp,its not going to the regnform.jsp as on clicking on the hyperlink,the URL is coming as http://localhost:8080/JavaBondCom/regn.
It should come as regn.do.But the suffix .do is not getting attached on the URL generation.
Moreover in one of the book,its written "When you use the action attribute instead of the page attribute in
<html:link>, you need not specify the “.do” explicitly.".
P.S:If in the URL bar,if I add the ".do" explicitly,it works fine!!THe regn.jsp is displayed.

So now how to resolve this problem?How will I add the suffix do in the generated URL after clicking the hyperlink??

Thanks
Anuj
15 years ago
Hi Varun,
You can start with struts survival guide 1.1.Later on you can easaily move to struts 2.Once you are done with survival guide,you can refer profesional jakarta struts by wrox.

Thanks
Anuj
15 years ago
How the framework decides whether to Instantiate a new Action class or action form class or to use a already existing Action or form object ?
15 years ago
Hi,
I am using ANT build tool for the first time.Just now I downloaded the binaries of ant &extracted the zip&updated my path&classpth respectively.Now when on running command file(after setting up everything)I am getting an error as"Unable to locate tools.jar.Expected to find it in C:\ProgramFiles\Java\jre1.5\lib".Now,I wanna create my build.xml file just to test my ant for learning purpose.Where shall I create it in my system?

Thanks
Anuj
15 years ago

Sagar Rohankar wrote:.do is struts default extension which maps with the ActionServlets,
Source:
http://struts.apache.org/1.3.10/faqs/works.html

Note the extension .do in this URL. The extension causes your container (i.e. Tomcat) to call the ActionServlet, which sees the word "login" as the thing you want to do. The configuration is referenced, and your LoginAction is executed.



now you can't remove this .do but using some tricks (eg url rewrite) you can move around with .do extension.

Here is the master link for that:
http://www.lunatech-research.com/archives/2005/07/29/struts-urls
[Note: This things are suggested for the Struts perfectionist, so if you're thinking it for practice no problem]



In the struts.apache link,its mentioned" In the web.xml file, you configure the framework ActionServlet as the servlet that will handle all requests for a given mapping (usually the extension .do is used)."....its nowhere mentioned that .do is struts' default extension??
15 years ago