?
Solved

Storing values from a text field

Posted on 2003-03-21
4
Medium Priority
?
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 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

Independent Software Vendors: 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

If you're a modern-day technology professional, you may be wondering if certifications are really necessary. They are. Here's why.
I originally wrote this article to compare SARDU and YUMI, but have now added Easy2Boot, since that is the one I currently use and find the easiest to create and alter.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 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