You could always use html:image or html:button instead of c:url. That would allow you to generate a regular form input based submit image. Try thinking about how you would implement your form in HTML if you weren't using Struts, then look for the tags that support that design.

L.

Caroline Jen wrote:
Thank all of you for support.

Now, it it an off-topic question.
I am able to pass the fixed values using the
<html-el:hidden ....> tag.  But, what is the
Javascript like to submit value of a text field in the
Struts context when a link is clicked.

It is difficult for me to get around the problem
because my link is an image.

<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}" /> '>
<html-el:img page="/images/upArrow.gif" border="0"
alt="ascending" />
</A>

-- Caroline

--- Michael Jouravlev <[EMAIL PROTECTED]> wrote:

I suggest you rereading my very first answer. I can
add the following to it:

* Clicking on a link, even if this link is defined
inside HTML form,
does not submit the form unless you write some
Javascript code to do
this.
* Even if your form were submitted with a link, the
link paramter
won't be populated with code like yours, because JSP
TAGS ARE
EVALUATED ON SERVER.

If you want to submit a form with a link, you need
to write some
Javascript to do so. Or you can use a regular submit
button rendered
as a link (use CSS for that) and submit the form
with GET method.

On 7/19/06, Caroline Jen <[EMAIL PROTECTED]>
wrote:
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
=== message truncated ===


__________________________________________________
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]

Reply via email to