You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kushan Jayathilake <ku...@gmail.com> on 2011/02/28 09:24:21 UTC

Re: double select tag

You can do something like this, this the manual way.

1. Refresh  the page after an item get selected from the first drop down,

submit the selected value to backend and get the required list of values to
populate as the second drop down, then generate a java script array with
that. iterate through the javascript array and build up the second drop
down.

2. If you dont want to refresh the page, then you can do AJAX submit and
generate the javascipt as mentioned above, and generate the drop down.


This is the code to generate the drop down,

*        for(var counter = 0; counter < familyArray.length; counter++) {

            if(familyArray[counter][0] == engineType) {
                engineFamily.options[0] = new Option('Select..','0');
                engineFamily.options[c] = new Option(familyArray[counter][1]
,familyArray[counter][1]);
                c++;
            }

        }*

*familyArray* is the one your generated javascript array.

On Fri, Feb 25, 2011 at 7:42 PM, Kerry, Michael P. <
michael_kerry@harvard.edu> wrote:

> Hi,
>
> If you're using struts2, have you tried out the JQuery plugin:
>
>  http://code.google.com/p/struts2-jquery/
>  showcase: http://www.weinfreund.de/struts2-jquery-showcase/index.action)?
>
> It has support for double select, among many others. So far so good for me
> - although perhaps there are issues that others have experienced. I would
> love to hear others weigh in on it.
>
> Michael
>
> -----Original Message-----
> From: Jerson John [mailto:jerson@cprvision.com]
> Sent: Wednesday, February 23, 2011 12:09 AM
> To: 'Struts Users Mailing List'
> Subject: double select tag
>
> Hi,
>  Can some one help me on double select tag with Hibernate...I am having two
> classes AssetCat,AssetSubCat and My first list should be assetcat list and
> according to the Assetcat selection I need to populate the second list which
> is assetsubcat list....Please advice me on this...I try to google it but
> Only could find hardcoded string array stuff...Please advice me on this..
>
> Thanks in advance
>
> Many Thanks and Regards,
>
> Jerson
>
> Many Thanks and Regards,
>
> Jerson
>
>
> -----Original Message-----
> From: Brian Thompson [mailto:elephantium@gmail.com]
> Sent: Wednesday, February 23, 2011 12:49 PM
> To: Struts Users Mailing List
> Cc: @rju
> Subject: Re: sending the report directly to the printer
>
> In 'UserWiseSaledPayinSlipReport.jsp' ...
>
> Replace <head> with:
>
>  <head>
>    <base href="<%=basePath%>">
>
>    <title>My JSP 'UserWiseSalesPayinSlipReport.jsp' starting page</title>
>
>    <meta http-equiv="pragma" content="no-cache">
>    <meta http-equiv="cache-control" content="no-cache">
>    <meta http-equiv="expires" content="0">
>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
>    <meta http-equiv="description" content="This is my page">
>    <!--
>    <link rel="stylesheet" type="text/css" href="styles.css">
>    -->
>    <script type="text/javascript">
>        window.onload = function() {
>            //I'm using the simple window.onload here, but you might want to
> use a jQuery ready() call or an addLoadEvent approach instead
>            window.print();
>        }
>    </script>
>
>  </head>
>
>
>
> On Tue, Feb 22, 2011 at 9:55 PM, @rju <na...@gmail.com> wrote:
>
> >
> >
> > i am sending files UserWiseSalesPayInSlipReportRequest.java,
> > UserWiseSalesPayInSlipReportAction.java, UserWiseSalesReport.jsp ,
> > UserWiseSalesPayinSlipReport.jsp, code in struts.xml files
> >
> >
> > payInSlip in  UserWiseSalesReport.jsp button will result
> > UserWiseSalesPayinSlipReport.jsp.
> > in that netAmount and the total textfield will be there. after matching
> of
> > these two values will enable the ok button in
> > UserWiseSalesPayinSlipReport.jsp. This ok button will call the action
> > "UserWiseSalesPayInSlipReport". now i need print out unlike a report
> coming
> > in the output
> >
> >
> > http://old.nabble.com/file/p30991984/UserWiseSalesReportPOJO.java
> > UserWiseSalesReportPOJO.java
> >
> >
> >
> >
> http://old.nabble.com/file/p30991984/UserWiseSalesPayInSlipReportRequest.java
> > UserWiseSalesPayInSlipReportRequest.java
> >
> >
> >
> >
> http://old.nabble.com/file/p30991984/UserWiseSalesPayInSlipReportAction.java
> > UserWiseSalesPayInSlipReportAction.java
> >
> >
> > http://old.nabble.com/file/p30991984/UserWiseSalesPayinSlipReport.jsp
> > UserWiseSalesPayinSlipReport.jsp
> >
> >
> > http://old.nabble.com/file/p30991984/UserWiseSalesReport.jsp
> > UserWiseSalesReport.jsp
> >
> >
> > http://old.nabble.com/file/p30991984/UserWiseSalesReport.js
> > UserWiseSalesReport.js
> >
> >
> > In these files for your convenience i have placed the sentence "check
> here
> > Mr.Brian Thompson-5" to make your search easy..
> >
> >
> > please help me sir.....
> >
> >
> >
> >
> > Brian Thompson-5 wrote:
> > >
> > > Could you post your code for your report?
> > >
> > > -Brian
> > >
> > >
> > >
> > > On Tue, Feb 22, 2011 at 5:15 AM, @rju <na...@gmail.com>
> > wrote:
> > >
> > >>
> > >> sir
> > >>  u said "Can't you just put it in your jsp for the report action?"
> > >> please elaborate this sir. i am not getting your point.
> > >> please sir
> > >>
> > >>
> > >> Brian Thompson-5 wrote:
> > >> >
> > >> > Can't you just put it in your jsp for the report action?
> > >> >
> > >> > -Brian
> > >> >
> > >> > On Mon, Feb 21, 2011 at 2:24 AM, @rju <na...@gmail.com>
> > >> wrote:
> > >> >
> > >> >>
> > >> >> here urlx is nothing but an action
> > >> >> in that action i have a code as follows
> > >> >>  <action
> > >> >>                name="myaction"
> > >> >>                method="getItemsNotInPackageReport"
> > >> >>
> > >> >>
> > >>
> class="com.ae.school.web.action.sales.reports.ItemsNotInPackageAction">
> > >> >>
> > >> >>                <result name="myaction" type="jasper">
> > >> >>            /jasper/sales/ItemsNotInPackageReport.jasper
> > >> >>            itemNameList
> > >> >>            PDF
> > >> >>        </result>
> > >> >>        </action>
> > >> >>
> > >> >> so now what to do? how should i include that window.print()..
> > >> >> please tell me sir
> > >> >>
> > >> >>
> > >> >> Brian Thompson-5 wrote:
> > >> >> >
> > >> >> > Try putting the window.print() in the code for the page at urlx.
> > >> >> >
> > >> >> > -Brian
> > >> >> >
> > >> >> >
> > >> >> > On Sun, Feb 20, 2011 at 11:39 PM, @rju <
> nagarjunabattula@gmail.com
> > >
> > >> >> wrote:
> > >> >> >
> > >> >> >>
> > >> >> >> exactly i did
> > >> >> >> but the problem here is.. see my code
> > >> >> >>
> > >> >> >> var urlx="myaction.action";
> > >> >> >> var x= window.open(urlx);
> > >> >> >> x.window.print();
> > >> >> >>
> > >> >> >> here it is invoking printer
> > >> >> >> but empty page is printing because the action is taking time to
> > >> load.
> > >> >> >> thats y am getting empty page so any alternative?????
> > >> >> >>
> > >> >> >>
> > >> >> >> Brian Thompson-5 wrote:
> > >> >> >> >
> > >> >> >> > Then no, there's no way to do this.
> > >> >> >> >
> > >> >> >> > What you *can* do is:
> > >> >> >> >
> > >> >> >> > User clicks HTML button --> Struts action/Jasper report
> displays
> > >> -->
> > >> >> >> some
> > >> >> >> > javascript on the report calls window.print(); --> user clicks
> > >> "OK"
> > >> >> on
> > >> >> >> the
> > >> >> >> > Print dialog.
> > >> >> >> >
> > >> >> >> > -Brian
> > >> >> >> >
> > >> >> >> >
> > >> >> >> >
> > >> >> >> > On Sun, Feb 20, 2011 at 10:27 PM, @rju
> > >> <nagarjunabattula@gmail.com
> > >> >
> > >> >> >> wrote:
> > >> >> >> >
> > >> >> >> >>
> > >> >> >> >> yes user is clicking html/jsp button only
> > >> >> >> >>
> > >> >> >> >> Brian Thompson-5 wrote:
> > >> >> >> >> >
> > >> >> >> >> > Where is the user clicking "ok"?  Do you mean an HTML
> button?
> > >>  Or
> > >> >> >> the
> > >> >> >> >> > browser's print dialog box?
> > >> >> >> >> >
> > >> >> >> >> > At the very least, the user will see the print
> > >> dialog...there's
> > >> >> no
> > >> >> >> way
> > >> >> >> >> > around that for a web page (which, ultimately, is what
> Struts
> > >> is
> > >> >> >> >> sending
> > >> >> >> >> > to
> > >> >> >> >> > the user).
> > >> >> >> >> >
> > >> >> >> >> > -Brian
> > >> >> >> >> >
> > >> >> >> >> >
> > >> >> >> >> >
> > >> >> >> >> > On Sun, Feb 20, 2011 at 9:46 PM, @rju
> > >> >> <na...@gmail.com>
> > >> >> >> >> wrote:
> > >> >> >> >> >
> > >> >> >> >> >>
> > >> >> >> >> >> no sir.
> > >> >> >> >> >> no. user interaction means he will press ok button.
> > >> >> >> >> >> there "no user interaction" means after clicking "ok",
> some
> > >> guys
> > >> >> >> >> >> suggested
> > >> >> >> >> >> me that use onLoad () then write one listener for print.
> so
> > >> here
> > >> >> no
> > >> >> >> >> user
> > >> >> >> >> >> interaction means after pressing ok button.
> > >> >> >> >> >>
> > >> >> >> >> >> user will interact only by pressing ok button. after that
> ok
> > >> >> button
> > >> >> >> >> will
> > >> >> >> >> >> call the struts action.
> > >> >> >> >> >> so here now without any user interaction i need the print
> > out
> > >> >> after
> > >> >> >> >> >> calling
> > >> >> >> >> >> action unlike a report pdf.
> > >> >> >> >> >> hope u got my point
> > >> >> >> >> >>
> > >> >> >> >> >>
> > >> >> >> >> >> Dave Newton-6 wrote:
> > >> >> >> >> >> >
> > >> >> >> >> >> > I have no idea. Personally, I'd be a little surprised if
> > it
> > >> >> was
> > >> >> >> >> >> > possible to print from a website with *no* user
> > interaction
> > >> >> >> without
> > >> >> >> >> >> > using something like ActiveX, an applet, or *something*.
> > >> >> >> >> >> >
> > >> >> >> >> >> > Dave
> > >> >> >> >> >> >
> > >> >> >> >> >> > On Sun, Feb 20, 2011 at 11:06 AM, @rju
> > >> >> >> <nagarjunabattula@gmail.com
> > >> >> >> >
> > >> >> >> >> >> wrote:
> > >> >> >> >> >> >>
> > >> >> >> >> >> >> sir please help me
> > >> >> >> >> >> >> i ve already told my requirement as follows
> > >> >> >> >> >> >> am using struts2-jasper plugin am calling my action
> > >> through
> > >> >> >> jquery.
> > >> >> >> >> >> >> nw i need to print the report directly from printer
> when
> > i
> > >> ve
> > >> >> >> >> pressed
> > >> >> >> >> >> ok
> > >> >> >> >> >> >> button.
> > >> >> >> >> >> >> ok button will call the action.
> > >> >> >> >> >> >> please help me ragarding this.Its very urgent for me
> and
> > >> it
> > >> >> is
> > >> >> >> the
> > >> >> >> >> >> main
> > >> >> >> >> >> >> requirement for this project...
> > >> >> >> >> >> >>
> > >> >> >> >> >> >>
> > >> >> >> >> >> >>
> > >> >> >> >> >> >> Dave Newton-6 wrote:
> > >> >> >> >> >> >>>
> > >> >> >> >> >> >>> He's saying "Hit Ctrl-P from inside a PDF reader.
> > >> >> >> >> >> >>>
> > >> >> >> >> >> >>> On Wednesday, February 16, 2011, @rju <
> > >> >> >> nagarjunabattula@gmail.com>
> > >> >> >> >> >> >>> wrote:
> > >> >> >> >> >> >>>>
> > >> >> >> >> >> >>>> if dont mind can you tell in detailed manner
> > >> >> >> >> >> >>>> --
> > >> >> >> >> >> >>>> View this message in context:
> > >> >> >> >> >> >>>>
> > >> >> >> >> >>
> > >> >> >> >>
> > >> >> >>
> > >> >>
> > >>
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30946620.html
> > >> >> >> >> >> >>>> Sent from the Struts - User mailing list archive at
> > >> >> >> Nabble.com.
> > >> >> >> >> >> >>>>
> > >> >> >> >> >> >>>>
> > >> >> >> >> >> >>>>
> > >> >> >> >> >>
> > >> >> >>
> > >> ---------------------------------------------------------------------
> > >> >> >> >> >> >>>> To unsubscribe, e-mail:
> > >> user-unsubscribe@struts.apache.org
> > >> >> >> >> >> >>>> For additional commands, e-mail:
> > >> >> user-help@struts.apache.org
> > >> >> >> >> >> >>>>
> > >> >> >> >> >> >>>>
> > >> >> >> >> >> >>>
> > >> >> >> >> >> >>>
> > >> >> >> >>
> > >> >>
> ---------------------------------------------------------------------
> > >> >> >> >> >> >>> To unsubscribe, e-mail:
> > >> user-unsubscribe@struts.apache.org
> > >> >> >> >> >> >>> For additional commands, e-mail:
> > >> user-help@struts.apache.org
> > >> >> >> >> >> >>>
> > >> >> >> >> >> >>>
> > >> >> >> >> >> >>>
> > >> >> >> >> >> >>
> > >> >> >> >> >> >> --
> > >> >> >> >> >> >> View this message in context:
> > >> >> >> >> >> >>
> > >> >> >> >> >>
> > >> >> >> >>
> > >> >> >>
> > >> >>
> > >>
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30971331.html
> > >> >> >> >> >> >> Sent from the Struts - User mailing list archive at
> > >> >> Nabble.com.
> > >> >> >> >> >> >>
> > >> >> >> >> >> >>
> > >> >> >> >> >> >>
> > >> >> >> >>
> > >> >>
> ---------------------------------------------------------------------
> > >> >> >> >> >> >> To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > >> >> >> >> >> >> For additional commands, e-mail:
> > >> user-help@struts.apache.org
> > >> >> >> >> >> >>
> > >> >> >> >> >> >>
> > >> >> >> >> >> >
> > >> >> >> >> >> >
> > >> >> >> >>
> > >> >>
> ---------------------------------------------------------------------
> > >> >> >> >> >> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > >> >> >> >> >> > For additional commands, e-mail:
> > >> user-help@struts.apache.org
> > >> >> >> >> >> >
> > >> >> >> >> >> >
> > >> >> >> >> >> >
> > >> >> >> >> >>
> > >> >> >> >> >> --
> > >> >> >> >> >> View this message in context:
> > >> >> >> >> >>
> > >> >> >> >>
> > >> >> >>
> > >> >>
> > >>
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30974347.html
> > >> >> >> >> >> Sent from the Struts - User mailing list archive at
> > >> Nabble.com.
> > >> >> >> >> >>
> > >> >> >> >> >>
> > >> >> >> >> >>
> > >> >> >>
> > >> ---------------------------------------------------------------------
> > >> >> >> >> >> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > >> >> >> >> >> For additional commands, e-mail:
> > user-help@struts.apache.org
> > >> >> >> >> >>
> > >> >> >> >> >>
> > >> >> >> >> >
> > >> >> >> >> >
> > >> >> >> >>
> > >> >> >> >> --
> > >> >> >> >> View this message in context:
> > >> >> >> >>
> > >> >> >>
> > >> >>
> > >>
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30974450.html
> > >> >> >> >> Sent from the Struts - User mailing list archive at
> Nabble.com.
> > >> >> >> >>
> > >> >> >> >>
> > >> >> >> >>
> > >> >>
> ---------------------------------------------------------------------
> > >> >> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> >> >> >> For additional commands, e-mail: user-help@struts.apache.org
> > >> >> >> >>
> > >> >> >> >>
> > >> >> >> >
> > >> >> >> >
> > >> >> >>
> > >> >> >> --
> > >> >> >> View this message in context:
> > >> >> >>
> > >> >>
> > >>
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30974618.html
> > >> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
> > >> >> >>
> > >> >> >>
> > >> >> >>
> > >> ---------------------------------------------------------------------
> > >> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> >> >> For additional commands, e-mail: user-help@struts.apache.org
> > >> >> >>
> > >> >> >>
> > >> >> >
> > >> >> >
> > >> >>
> > >> >> --
> > >> >> View this message in context:
> > >> >>
> > >>
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30975200.html
> > >> >> Sent from the Struts - User mailing list archive at Nabble.com.
> > >> >>
> > >> >>
> > >> >>
> ---------------------------------------------------------------------
> > >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> >> For additional commands, e-mail: user-help@struts.apache.org
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30984858.html
> > >> Sent from the Struts - User mailing list archive at Nabble.com.
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> For additional commands, e-mail: user-help@struts.apache.org
> > >>
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30991984.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
>


-- 
Regards
Kushan Jayathilake