Neel Taylor

Greenhorn
+ Follow
since Sep 05, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Neel Taylor

If I have it so the value I want prints out here:

<bean:write name="contact" property="firstName" />

how would I go about, one line later, putting that value where I marked HERE

<html:hidden property="person.firstName" value= HERE/>

Is there a way? Or is this, too more a Struts question?
I've looked at PageContext.getAttribute(), but even if I cast the attribute value into an appropriate type I set up inside of a scriplet, and use the right getter of that type to assign the value I want into a reference, can I then put that reference variable into an HTML field somehow?

Just point me in the right direction, if you can... Thanks!
12 years ago

Originally posted by Neel Taylor:


So if I need to have a data entry page, and a confirmation page that either does something with the information if it is accepted, or returns to the data entry page if it is not, would session-scoping be appropriate?



or could I rebuild the form-bean on the confirmation page and send the new one on? All the information is displayed there, so I have to think the data is there to work with.

Meanwhile, I am reading your suggested items. Thanks!
12 years ago

Originally posted by Bear Bibeault:

No can do. The "current" request goes out of scope as soon as the page is sent to the browser. There's no hope of hooking back up to it because it's long dead and gone before the user ever sees the button.

If you need to maintain a value across multiple requests you can either maintain it in a hidden parameter on the page (only suitable for text or simple values), or in the session.



So if I need to have a data entry page, and a confirmation page that either does something with the information if it is accepted, or returns to the data entry page if it is not, would session-scoping be appropriate?
12 years ago

Originally posted by Bear Bibeault:
P.S. Is there a reason that you are adopting Struts prior to understanding Servlets and JSP? Unless it's forced upon you, it's best to learn the underlying technologies before adopting a framework.



Very, very much forced upon me- it's a test to see how quickly I can learn things I haven't done before.
12 years ago
First, forgive me for asking a newb question at JSP- I started on it (and Struts) less than two days ago, and I have a project I need to get going, very badly.

If I have a jsp, and I want to have an action tied to a command button, and I want to maintain the current request (and a certain attribute of that request) while passing it on, I know I need to keep forwarding the request.

So, instead of saying in my jsp something like:
<html:form action="/emailContactInfo">
(where /emailContactInfo is one of my mapped actions in struts-config.xml)
I suspect I need to forward somehow to that same mapped action, to avoid losing the current request.

First, am I right? Second, can you point me at something that can very clearly explain how I would tie something like a <jsp:forward etc /> to a command button ( well an <html:submit etc />)?

I've no objection to reading- but I have to know it will pay off; I am rather short on time (one day left). Any help would be MUCH appreciated!
Actual examples of something similar would be great. I am hunting through all my newly purchased Struts books with no luck. I should have gotten JSP books too, but I didn't know at the time.
12 years ago
I would very definitely love to see your final version. Thanks for sharing this- I am a beginner myself and this is exactly the kind of thing I want to be able to do. Your code is a wonderful example.
13 years ago