• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

struts beginner question

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for reply..
i cant understand how can i put bookList to the scope ??
which version of struts i must use??
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic