You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Col <ri...@yahoo.com> on 2003/07/31 22:02:14 UTC

Is it possible to capture selected values on jsp page?

Hi,

I have two drop down lists. Once a user selects once
item for every list, she will press on submit button.
The two lists are collections. I am trying to capture
these two values after the user submission. Is there
an easy way to do that?

regards,

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Is it possible to capture selected values on jsp page?

Posted by Rick Col <ri...@yahoo.com>.
Thanks, very helpful...

Still one thing unclear: do I need to put my action
form
in classpath to be imported in my jsp page? Is there a
better way to do it? This sounds messy, but I will try
it out if it works.

regards,


--- Michael Ruppin <mr...@yahoo.com> wrote:
> Well, ultimately jsp IS Java....  You can always do
> this:
> 
> <%
> String
>
foo="http://myweb.com/mypage?companyid="+id+"&ssn="+ssn;
> %>
> <mytag:sample name="persons" uri="<%=foo%>" />
> 
> However, use of scriptlet is discouraged here.  If
> you
> switch to JSTL tags, and put foo into an ActionForm
> property populated in your Action, you could:
> 
> <JSTLtag:sample name="persons" uri="${myForm.foo}"
> />
> 
> m
> 
> --- Rick Col <ri...@yahoo.com> wrote:
> > Thanks, 
> > 
> > I will try that out. What I try to do is to
> capture
> > form variables as strings, and concatenate them
> with
> > 
> > a html address as request parameters. I am not
> sure
> > how to 
> > concatenate them with the link in JSP page, and
> add
> > the 
> > whole address to a taglib parameter like the
> > following:
> > 
> > <mytag:sample name="persons"
> >
>
uri="http://myweb.com/mypage?companyid="+id+"&ssn="+ssn>
> > 
> > In Java, we can concatenate strings like that, in
> > Jsp,
> > can we do that? Or there is another way?
> > 
> > regards,
> > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Is it possible to capture selected values on jsp page?

Posted by Michael Ruppin <mr...@yahoo.com>.
Well, ultimately jsp IS Java....  You can always do
this:

<%
String
foo="http://myweb.com/mypage?companyid="+id+"&ssn="+ssn;
%>
<mytag:sample name="persons" uri="<%=foo%>" />

However, use of scriptlet is discouraged here.  If you
switch to JSTL tags, and put foo into an ActionForm
property populated in your Action, you could:

<JSTLtag:sample name="persons" uri="${myForm.foo}" />

m

--- Rick Col <ri...@yahoo.com> wrote:
> Thanks, 
> 
> I will try that out. What I try to do is to capture
> form variables as strings, and concatenate them with
> 
> a html address as request parameters. I am not sure
> how to 
> concatenate them with the link in JSP page, and add
> the 
> whole address to a taglib parameter like the
> following:
> 
> <mytag:sample name="persons"
>
uri="http://myweb.com/mypage?companyid="+id+"&ssn="+ssn>
> 
> In Java, we can concatenate strings like that, in
> Jsp,
> can we do that? Or there is another way?
> 
> regards,
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Is it possible to capture selected values on jsp page?

Posted by Rick Col <ri...@yahoo.com>.
Thanks, 

I will try that out. What I try to do is to capture
form variables as strings, and concatenate them with 
a html address as request parameters. I am not sure
how to 
concatenate them with the link in JSP page, and add
the 
whole address to a taglib parameter like the
following:

<mytag:sample name="persons"
uri="http://myweb.com/mypage?companyid="+id+"&ssn="+ssn>

In Java, we can concatenate strings like that, in Jsp,
can we do that? Or there is another way?

regards,



__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Is it possible to capture selected values on jsp page?

Posted by Michael Ruppin <mr...@yahoo.com>.
Well, I don't use that taglib, so I'm not sure.  In
your situation, I believe the ActionForm is available
to you, even outside the <html:form> tags.  When the
<html:form> code executes, it creates an ActionForm
instance, iff one does not exist (see
http://jakarta.apache.org/struts/struts-html.html#form).
 However, in your case, the ActionForm you want access
to was created and populated when processing the
request.  I don't know what you wanted to do with the
selection, but it should be available using
name="myForm" and property="theSelection" in most
Struts tags. You might need to include logic not to
use them, when the ActionForm has not yet been
created.

HTH

m

--- Rick Col <ri...@yahoo.com> wrote:
> Thanks, Michael:
> 
> I actually want to capture them outside
> <html:form>...<.html:form>. I know these values
> will be in my action form, should I use
> <jsp:usebean>
> to
> get their string values?
> 
> regards,
> 
> 
> --- Michael Ruppin <mr...@yahoo.com> wrote:
> > So long as both <select>s are in the same <form>
> as
> > the <input type="submit">, they will both be in
> the
> > request.
> > 
> > m
> > 
> > --- Rick Col <ri...@yahoo.com> wrote:
> > > Hi,
> > > 
> > > I have two drop down lists. Once a user selects
> > once
> > > item for every list, she will press on submit
> > > button.
> > > The two lists are collections. I am trying to
> > > capture
> > > these two values after the user submission. Is
> > there
> > > an easy way to do that?
> > > 
> > > regards,
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > http://sbc.yahoo.com
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > struts-user-help@jakarta.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> > design software
> > http://sitebuilder.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Is it possible to capture selected values on jsp page?

Posted by Rick Col <ri...@yahoo.com>.
Thanks, Michael:

I actually want to capture them outside
<html:form>...<.html:form>. I know these values
will be in my action form, should I use <jsp:usebean>
to
get their string values?

regards,


--- Michael Ruppin <mr...@yahoo.com> wrote:
> So long as both <select>s are in the same <form> as
> the <input type="submit">, they will both be in the
> request.
> 
> m
> 
> --- Rick Col <ri...@yahoo.com> wrote:
> > Hi,
> > 
> > I have two drop down lists. Once a user selects
> once
> > item for every list, she will press on submit
> > button.
> > The two lists are collections. I am trying to
> > capture
> > these two values after the user submission. Is
> there
> > an easy way to do that?
> > 
> > regards,
> > 
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Is it possible to capture selected values on jsp page?

Posted by Michael Ruppin <mr...@yahoo.com>.
So long as both <select>s are in the same <form> as
the <input type="submit">, they will both be in the
request.

m

--- Rick Col <ri...@yahoo.com> wrote:
> Hi,
> 
> I have two drop down lists. Once a user selects once
> item for every list, she will press on submit
> button.
> The two lists are collections. I am trying to
> capture
> these two values after the user submission. Is there
> an easy way to do that?
> 
> regards,
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org