INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

display form data in jsp after forward action (struts)

display form data in jsp after forward action (struts)

(OP)
Hi people

Not sure if this is the right forum as its a struts\jsp question.

I am new to Java web development. I know Java quite well (applets and command-line apps) but never used it for web tech. I am more used to developing in PHP. Moving over to Struts\JSP is proving harder than I thought. Anyway, here is my problem.

I have a simple form which asks for username and password. Upon submission of said form an Action is called which validates the form input and then forwards to a confirmation page (via the struts-config.xml). One page is used for a successful login and another for an unsuccessful login. All this works well and if the user inputs the username and password I have hard-coded into the Action they get redirected to another JSP page.

FORM --> ACTION --> FINAL JSP

What I need to know is how do I access the information that was entered into the form from the final JSP page? I simply want to display the name the user in-putted on the form.

In PHP I would do something like this

FORM -->
VALIDATE SCRIPT (set up session object to hold input) -->
FINAL PAGE (display info I want from session object)

As I understand it, the info I want my JSP page to access is already in a ActionForm (JavaBean) but I've no idea how to reference it from anything other than my Action object.

I searched around and could only find an example that uses the 'bean:write' tag. Eclipse tells me this is not a recognised tag and nothing is displayed.

I find all of this very unintuitive given that my background is in PHP. Maybe there is a nice tutorial someone knows of that will explain passing data around Struts\JSP web apps?

Thank you very much for your time :)
Andrew

RE: display form data in jsp after forward action (struts)

Are you including the tag?

CODE

<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

Cheers,
Dian

RE: display form data in jsp after forward action (struts)

(OP)
Hi Dian

I figured that out now. I had lots more problems which I have now solved. My dev environment was set up wrong, missing includes, missing knowledge...mostly missing knowledge lol.

Once I've figured it all out I might write a tutorial for people moving over from PHP to Java. Its just all so different. And with so many different containers, IDEs and frame works out there its really hard to find simple concrete tutorials. Still I guess that's half the fun of a new job :)

Thanks for your reply
Andrew

RE: display form data in jsp after forward action (struts)

For sure it will help others, but I think you can find some good tutorials with all steps like this

Cheers,
Dian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close