?
Solved

Storing values from a text field

Posted on 2003-03-21
4
Medium Priority
?
200 Views
Last Modified: 2010-04-01
I have a JSP page in which I have:

o One drop down box (Uses SELECT) - Called WorkType
o One Text Field. - Called Description


I also have a JavaBean in which I have instance variables for both WorkType and Description.

Every Time I change the worktype, the page refreshes. The problem I am facing is that I am not able to store what is entered into the description box so that after I refresh, the same description turns up again.

So, if i choose worktype1 and enter in the description: haha
Then if i change the worktype to worktype2, the page refreshes with
worktype = worktype2
description = blank

For every refresh I am able to store what worktype i have, in the bean. This is made much easier by the fact that it uses the SELECT keyword.


<OPTION SELECTED VALUE="<%= workTypes[x][0] %>" > <%= workTypes[x][1] %> </OPTION>
<% sb.setWorkType( workTypes[x][0] ); %>
<% } else { %>
<OPTION VALUE="<%= workTypes[x][0] %>"> <%= workTypes[x][1] %> </OPTION>

the setWorkType does the saving for me.

My problem is that I cannot do the same for description, so that the page remembers what the user wrote, EVEN IF they didnt hit submit. If they had hit submit, i would easily have used request.getParameter and got the description. But here the problem is the user never saves the description at all.

Here's the description line i have so far:

<TD class="main1"><b>Description</b><br><TEXTAREA ROWS=1 COLS=30 NAME="description" ><%= sb.stripTilde(loadDescription) %></TEXTAREA></TD>
<% } %>

I need to be able to somehow say, sb.setDescription like i did for worktype. But I cant pull out whats entered in the box.


Any suggestions???


Thanks!!!!!!
0
Comment
Question by:keinloffel
3 Comments
 
LVL 14

Accepted Solution

by:
kennethxu earned 480 total points
ID: 8184180
use
sb.setDescription(request.getParameter("description") );

or
<jsp:setProperty name="sb" property="description"/>
0
 
LVL 7

Expert Comment

by:damonf
ID: 8197093
what client side code to you run onchange of WorkType?  There's no reason you can't do a form submission on behalf of the user.  After all, you ARE making a round trip to the server anyway.  Might as well make it an HTTP POST instead of a GET.  Then you can easily obtain request.getParameter.
0
 
LVL 35

Expert Comment

by:girionis
ID: 10060243
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to kennethxu

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
A simple method to resolve a "keyboard not working" problem by modifying the Windows registry. This issue can often be encountered after using the VMware vCenter Converter Standalone Agent to perform a Physical-to-Virtual (P2V) conversion process.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question