would this code function correctly..that if pdfValue==1 it will display an
iframe containing a pdf generated from jasperreports else a strut div will
be displayed containing an html format report?

            <s:if test="pdfValue==1">
                    <iframe id="reportPreview" name="reportPreview"
src="%{getReportNumber()}.action?reportId=%{getReportId()}"
                        width="800" height="600"/>                  
            </s:if>            
            <s:else>           
                <s:div theme="ajax" id="reportPreview"
href="%{getReportNumber()}.action?reportId=%{getReportId()}"
cssStyle="componentHolder"
                       loadingText="Loading report... Please wait."
                       errorText="Unable to load report."
                       listenTopics="load_report_preview"
                       executeScripts="true">
                    Loading report... Please wait.
                </s:div>                        
            </s:else>  

thanks again.


jignesh(india) wrote:
> 
> It's simple dude use s:if and s:else like mentioned below
> <s:if test="pdfValue!=0">
>   if part
> </s:if>
> <s:else>
>   else part
> </s:else>
> 
> hope it will help u.........!
> Regards,
> Jignesh
> 
> 
> 
> 
> carmi_cd wrote:
>> 
>> hi i'm new in struts 2..my question is how can i get a value from  a
>> member variable of my action class and
>> evaluate it in my if-else-if statemet?
>> 
>> i try to code it but it doesn't evaluate properly..here is my exisiting
>> code.
>> 
>>             <s:if test='"%{getPdfValue()}" == "0"'>
>>                 <s:div theme="ajax" id="reportPreview"
>> href="%{getReportNumber()}.action?reportId=%{getReportId()}" 
>>                    cssStyle="componentHolder"
>>                        loadingText="Loading report... Please wait."
>>                        errorText="Unable to load report."
>>                        listenTopics="load_report_preview"
>>                        executeScripts="true">
>>                     Loading report... Please wait.
>>                 </s:div>
>>             </s:if>            
>>             <s:else>
>>                 <s:div theme="ajax" id="reportPreview"
>> cssStyle="componentHolder"
>>                        loadingText="Loading PDF"
>>                        errorText="Unable to load report."
>>                        listenTopics="load_report_preview"
>>                        executeScripts="true">
>>                     <iframe id="pdf_container" name="pdf_container"
>> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
>>                         width="800" height="600"/>
>>                 </s:div>               
>>             </s:else>   
>> 
>> it supposed to display the genereated pdf inside the iframe if the
>> getPdfValue() method return
>> are not equal to 0. please help me its not evaluating properly..thanks in
>> advance.
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13382105
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to