aspose file tools*
The moose likes Struts and the fly likes struts beginner question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts beginner question" Watch "struts beginner question" New topic
Author

struts beginner question

ali okur
Greenhorn

Joined: Mar 08, 2010
Posts: 11
Hi everyone i'm new at struts i'm using struts 1.2.9 .i have an arrayList called bookList and it has elements i retrieving from database.But i guess its empty cause when i run the application my jsp page is empty i can't see arraylist elements on the screen help please

Book.JAVA




BookForm.JAVA



BookAction.Java

[/code]

and here is my jsp code



struts_config


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

"bookList" isn't in scope, it's in the form.

By the way, when JSTL functionality overlaps with Struts tag functionality, JSTL should be used. See here.

If you're starting with Struts, why are you starting with such an ancient version?
ali okur
Greenhorn

Joined: Mar 08, 2010
Posts: 11
thanks for reply..
i cant understand how can i put bookList to the scope ??
which version of struts i must use??
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You can use whatever version you want--but unless you have a good reason to learn Struts 1, I wouldn't.

You put it into scope by using request.setAttribute or session.setAttribute; you might want to look at some basic Java web application tutorials to understand some of the more common mechanisms used in Java web apps.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 645
To add to what David has said, I think it's really hard to learn Struts - which is built on top of Servlets and JSP - without first learning Servlets and JSPs. There is a free version of the book Core Servlets and JavaServer Pages available as PDF download here: http://pdf.coreservlets.com, along with some very helpful tutorials, etc.

And yes, unless you have a specific need to learn Struts 1, you should begin with the current Struts 2. It's more than just a newer version - it's a different architecture.

ali okur
Greenhorn

Joined: Mar 08, 2010
Posts: 11
thanks for reply everyone.
It's just my homework doing a basic web applications with java frameworks.I finished jsf.. now i must do it with struts.But it doesnt matter version struts 1 or struts 2 i just wanna use which struts is more effective and more easy to learn.Do you think which one i use??struts1 or struts2
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You know JSF but you don't know how to put an object into a scope usable by a JSP page?

You are going about the learning process completely backwards. Basics first. *Then* frameworks. Much easier and faster.

Struts 1 is a relic, does not follow modern development practices, and should not be used (in my opinion) for any new development.
Alex Serna
Ranch Hand

Joined: Sep 18, 2009
Posts: 58
I've been recommended to learn struts 1.x, because there are more jobs offered with this technology in Spain. I've looked through the job offerings, but they don't specify the version. I don't trust the person who gave me this recommendation very much. He also said that Struts 2 is not having much success.

I would like to know how this works worldwide...Struts 1.x or Struts 2.0? Could someone with the knowledge give me another opinion please?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Struts 2 will never have the success Struts 1 had--there are too many other equally-compelling choices. When Struts 1 came out there *were* no other good choices, and by the time there were, Struts 1 was pretty well entrenched.

Anybody doing *new* development work with Struts 1 should have their head examined; it's a ridiculous idea. There are thousands, probably tens of thousands, of deployed Struts 1 apps: if you're happy working on old, difficult-to-test, difficult-to-use technology, then by all means--learn Struts 1.
Alex Serna
Ranch Hand

Joined: Sep 18, 2009
Posts: 58
Thank you David!

Since I'm starting from "scratch"(about to get the SCWCD), I think I will go for the new stuff. My next question is: what's the most recommended framework? Struts 2?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I have no idea. Spring MVC is pretty popular, I know a bunch of places using Struts 2, I know a few places using Tapestry. JSF is the "official" Sun web solution (I'm not a fan except under certain circumstances, but people use it). There are a few others around that are used, but not as much as the others I mentioned.
ali okur
Greenhorn

Joined: Mar 08, 2010
Posts: 11
i'm not expert at jsf but i did some examples with it and i didn't use request.setattribute code.And its easier than struts.
I think struts is hard but i must do this basic example for my homework.
i added request.settattribute to my code but my page is still empty


i changed my code like tihs


data jsp


struts_config


i'm new please help i'm losing my mind for 2 days thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts beginner question