struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bhaarat Sharma <bhaara...@gmail.com>
Subject Re: equivalent of request.getParameter();
Date Tue, 04 Aug 2009 18:18:58 GMT
I know its not the best case scenario.  If i can do this then I will not
have to change major piece of the code.
I'll try to explain the scenario: basically one jsp page is used to show
results. this jsp page has pagination so each time 50 results are shown. But
the page has a printer friendly version.  when printer friendly link is
clicked this same jsp page is loaded again but this time around we want to
print everything not just 50 records. so in my action class there is a
method which returns sublist. but in this case i want it to return the whole
list.

So in the jsp i know when printerfriendly is taking place because it is
being passed a parameter called ?print=true

so i thought that in jsp i could check if print=true then set action class
Printer method to true. ....kind of confusing i bet it sounds..

On Tue, Aug 4, 2009 at 2:14 PM, Wes Wannemacher <wesw@wantii.com> wrote:

> On Tue, Aug 4, 2009 at 2:09 PM, Bhaarat Sharma<bhaarat.s@gmail.com> wrote:
> > Thanks.
> > I have another question, which might be a little off topic.
> >
> > if I have a method like this in my Action class
> >
> >    public void setPrinter(String print)
> >    {
> >        this.printer = print;
> >    }
> >
> > how can I call this setter with some value from my jsp page using
> struts2?
> >
> > I know this can be set if I submit a form with hidden value and stuff but
> I
> > dont want to submit a form. I just want to set the value from the jsp
> page.
> > ..
> >
>
> At which point will that value be used? If you need to know the value
> of the 'print' variable within the execute method of your action, then
> it should be part of the form submission... In fact, I am having
> trouble thinking of a scenario where you would want to call that sort
> of method from a JSP that doesn't involve form submission (except
> javascript, but still, just calling a setter alone doesn't really have
> any effect unless you are calling another action method afterwards
> that has an interest in that variable's value).
>
> -Wes
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message