But, it does not work even I changed html-el to html. In my link, I did pass some fixed values. They are picked up. Let me explain: <c:url value="/admin/sortUsers.do" var="ascFirstName"> <c:param name="sortKey" value="firstName" /> <c:param name="orderKey" value="ASC" /> <c:param name="searchFirstName" value="${searchFirstName}" /> </c:url> <A href=' <c:out value="${ascFirstName}" /> '></A>
The fixed values "firstName" and "ASC" are picked up without problem. But the "${searchFirstName}" where searchFirstName is the property of a text field is not picked up. --- David Friedman <[EMAIL PROTECTED]> wrote: > Dear Caroline Jen, > > I thought people only used the "html-el" taglib > because their JSP container > didn't natively support EL? That would mean your > c:url and c:param tags > won't get the expressions ${searchFirstName} or > ${ascFirstName} parsed > because your JSP container doesn't do that. If your > container did parse > expression like that, you would be using the regular > "html" taglib, right? > If I am missing something please let me know. I > just cannot remember ever > hearing of any other reason to use the "html-el" > taglib - so this question > makes sense to me. > > Are you positive your final outputted html form > shows the url correctly > before you click on it? Because if it were blank > due to this EL non-parsing > issue it would explain why your > request.getParameter() method is returning > nothing. > > Regards, > David > > -----Original Message----- > From: Caroline Jen [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 19, 2006 12:51 PM > To: Struts Users Mailing List > Subject: Re: How to Pass a Textfield Value as a > c:param to a Link using > c:url? > > > My text field and the link are defined inside a HTML > form and I do have the html-el and the JSTL tag > libraries. Everything else worked fine except > passing > this text field value as a c:param via the c:url > link. > > When I submit the form, the browser address bar > shows > searchFirstName= > > a blank is sent. > > Let me post my code again. I tried to pass the > value > entered in a textfield: > > <html-el:text property="searchFirstName" /> > > > to a link this way: > > <c:url value="/admin/sortUsers.do" > var="ascFirstName"> > <c:param name="searchFirstName" > value="${searchFirstName}" /> > </c:url> > <A href=' <c:out value="${ascFirstName}" /> '></A> > > and in my action class, I have > > String firstName = request.getParameter( > "searchFirstName" ); > > > I tried to print out the firstName in my action > class > using System.out.println( firstName); I got a blank! > > > --- Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > > Make sure your text field is defined inside an > HTML > > form. Make sure > > you have proper taglib directives on top of your > JSP > > page, for > > example, for html-el tags. > > > > Get an HTTP sniffer and see what is sent from > > browser when you submit > > a form. If you use Firefox, get Live HTTP Header > > extension. > > > > On 7/19/06, Caroline Jen <[EMAIL PROTECTED]> > > wrote: > > > I am not talking about submit a JSP, perform > some > > > action, and return a JSP. > > > > > > I submit the textfield, and I used > > System.out.println > > > in my action class to write out the value > > submitted. > > > I got a blank. Therefore, something must go > > wrong. > > > > > > --- Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > > > > > > On 7/19/06, Caroline Jen > <[EMAIL PROTECTED]> > > > > wrote: > > > > > I must have done someting wrong. > > > > > > > > > > I tried to pass the value entered in a > > textfield: > > > > > <html-el:text property="searchFirstName" /> > > > > > > > > > > to a link this way: > > > > > <c:url value="/admin/sortUsers.do" > > > > var="ascFirstName"> > > > > > <c:param name="searchFirstName" > > > > > value="${searchFirstName}" /> > > > > > </c:url> > > > > > > > > > > and in my action class, I have > > > > > String firstName = request.getParameter( > > > > > "searchFirstName" ); > > > > > > > > > > I tried to print out the firstName, I got a > > blank! > > > > > > > > > > Please advise what went wrong. > > > > > > > > JSP tags are processed *on server*. For your > > setup > > > > to work you need to > > > > submit a pag with <html-el:text > > > > property="searchFirstName" /> to the > > > > server first, read value from request > parameter > > and > > > > stick it into > > > > appropriate scope under "searchFirstName" > name. > > > > > > > > Then, when you forward to JSP from your > action, > > > > JSP/servlet engine > > > > will process JSP tags, still *on server*. It > > will > > > > read > > > > "searchFirstName" from servlet scope and write > > out > > > > its value into > > > > generated HTML markup. Then resulting HTML > page > > will > > > > be sent to > > > > browser. > > > > > > > > If you want to do the whole thing on client, > use > > > > HTML form and submit > > > > it with GET method. This way form fields will > be > > > > appended to "action" > > > > URL, exactly as you wanted. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]