- When you look at the html code, check if the result value (ok) is passed correctly. Otherwise it does not work.
- <javascript:window.open("", "myWindow", 'toolbar,width=450,height=500') ??? Here you have to figure out how to open the JSP page with javascript. Javascript documentation eg. selfhtml will help. Koni >-------- Original Message -------- >Subject: RE: Pop-up a window on Submit >Date: Tue, 12 Aug 2003 10:39:42 -0400 >From: Au-Yeung, Stella H <[EMAIL PROTECTED]> >Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> >To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> > >Hi Koni: >I must have misunderstood what you adviced me to do because I couldn't get >it working on what you suggested. This is what I did: > >I added the logic tag in my jsp: ><logic:equal name="SearchFormBean" property="result" scope="request" >value="ok"> ><javascript:window.open("", "myWindow", 'toolbar,width=450,height=500') ></logic:equal> >===> the rest of this jsp file is just a table to display my data. > > >I added a new property "result" into my formBean and also its getter and >setter. >private String result; > > >Then in my Action class I added the following call to the setter when my >data are retrieved successfully: >if (formBean.isMainReportAction()) >{ > this.validateAction(formBean, request, errors); // validate search >filters > if(errors.empty()) > { > retrieve data for main report and display main report > formBean.setResult("ok"); // IF EVERYTHIANG IS OK, SET result="ok" >so jsp will pop up new wdw > } > else > displayed error message in the original window >} > >But when I ran this, no window is pop-up. The data is still displaying in >the original window. >Did I miss something that you tried to tell me? Thx... > >Pat > > > >-----Original Message----- >From: Koni [mailto:[EMAIL PROTECTED] >Sent: Tuesday, August 12, 2003 7:00 AM >To: [EMAIL PROTECTED] >Subject: Re: Pop-up a window on Submit > > >Hi Pat > >I solved the validation problem (your question 2) as described in many >examples: > >In struts-config.xml, add 'input' to your action mapping. >... ><action path="/app/report/Search" > type="com.test.action.report.ReportAction" > name="SearchFormBean > scope="request" > validate="false" > input="/thePage.jsp"> // <---- !! >... > >MyAction.java: >... > ActionErrors errors = new ActionErrors(); > if ( ! formBean.isMainReportAction() ) > { > errors.add(ActionErrors.GLOBAL_ERROR, > new ActionError("error.my.error.message")); > } > // Report any errors we have discovered back to the original form > if (!errors.isEmpty()) > { > saveErrors(request, errors); > // go back to the input page > return new ActionForward(mapping.getInput()); > } >... > > >thePage.jsp: >Example of displaying errors in .jsp >... > <logic:messagesPresent> > <UL> > <html:messages id="errors"> > <LI><bean:write name="errors"/></li> > </html:messages> > </ul> > </logic:messagesPresent> >... > >You could solve your pop-up problem with <logic:equal> in your .jsp! > ><logic:equal name="myForm" property="result" scope="request" value="ok"> > <javascript:open.your.pop.up.some.how> ></logic:equal> > >Hope it helps. >Koni > > >>Au-Yeung, Stella H wrote: >> Hi: >> The bottom of my Search.jsp has two buttons. They are for displaying >> different report (a Main report and a Procedure Summary): >> >> <html:submit property="mainReport"><bean:message >> key="button.mainReport"/></html:submit> >> <html:submit property="procedureSummary"><bean:message >> key="button.procedureSummary"/></html:submit> >> >> In my Struts Action class ReportAction I do the following: >> if (formBean.isMainReportAction()) >> { >> this.validateAction(formBean, request, errors); // validate search >> filters >> if(errors.empty()) >> retrieve data for main report and display main report >> else >> displayed error message >> } >> else if (formBean.isProcedureSummaryAction()) >> { >> this.validateAction(formBean, request, errors); // validate search >> filters >> if(errors.empty()) >> retrieve data for procedure summary report >> << forward to the template "ProcSummTemplate" >> else >> displayed error message >> } >> >> My struts-config file sort of like this: >> <global-forwards> >> <forward name="ProcSummTemplate" >> path="/app/report/ProcedureSummary.jsp"/> >> </global-forwards> >> >> <action path="/app/report/Search" >> type="com.test.action.report.ReportAction" >> name="SearchFormBean" >> scope="request" >> validate="false"> >> <forward name="Content" path="/app/report/MainReport.jsp"/> >> <forward name="ContentError" path="/app/report/Search.jsp"/> >> </action> >> >> All the above works fine, but now I need to enhance it to do these: >> - If there are no validation errors, pop-up a new window to display the >> selected report (MainReport.jsp or ProcedureSummary.jsp) >> - If there are validation errors, stay on the same window to display >> validation messages in Search.jsp so user can reenter search filters. >> My questions are: >> 1) How do I pop up a new window with the <html:submit> tag? Since I >cannot >> do onSubmit()="return popUpAWindow()" inside the <html:submit> tags >> 2) How do I force Struts to stay in the same window if there are >validation >> errors, otherwise do the pop-up? My validation method is in the Action >class >> and not a javascript function. >> >> Thanks in advance..... >> Pat >> > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > >-- >Koni Roth, > - http://www.rothweb.ch > - http://www.rothconsulting.com > - Jump and the earth will rise to meet you! > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]