robidomadenik Posted June 14, 2011 Share Posted June 14, 2011 Hello all. I would be glad if someone could help me with some kind of JSP code example, howto call (and pass input parameters) IReport from that JSP page, which I can enter under "Controls&Resources" - > Optional JSP Location in JasperServer 4.0 Repository? P.S.: I've posted a similar question liek this A WEEK AGO, but I didn't get a SINGLE answer. Are there really NO ONE to know that or to have a problem like me ???? Thank you very much for every info I get.... Best regards,RobiPost Edited by robidomadenik at 06/14/2011 07:34 Link to comment Share on other sites More sharing options...
gustafsf Posted June 27, 2011 Share Posted June 27, 2011 Robi,If you only need to customize the parameters, start off by making a copy of the DefaultParametersForm.jsp. Make the changes as needed, rename the file (you don't want to overwrite the DefaultParametersForm because all other reports will use this!) then copy to the WEB-INF/modules/inputControls (or another folder you designate). Now you can reference it in the optional jsp field under the edit controls and resources page from the server.Here is a very basic example of the code that was changed in the copy of the jsp, in order to display masked input for a specified input control. Note that the input control to be changed is refered to by name (not ideal if you want to reuse the custom jsp for other reports) and there are only a few changes required, such as changing the input type='password' . Take a look at the original DefaultParametersForm.jsp and you'll be able to compare the differences.Good luck!Code:<%-- ########## SINGLE_VALUE - CUSTOM PARAMETER ########## --%> <c:when test="${inputName == 'pass'}"> <%-- Single value : InputControl.TYPE_SINGLE_VALUE --%> <li class="leaf" id="jsCtrl_pass"> <c:choose> <c:when test="${control.dataType.localResource.type == 3 or control.dataType.localResource.type == 4}"> <c:set var="controlClass" value="picker"/> </c:when> <c:otherwise> <c:set var="controlClass" value="text"/> </c:otherwise> </c:choose> <label class="control input password" for="pass" title="Filter value"> <span class="wrap"> <js:inputControlLabel control="${wrapper}" messageSource="${messageSource}"/>: </span> <input type="password" name="<c:out value="${inputName}"/>" id="<c:out value="${inputName}"/>" value="<c:out value="${wrapper.formattedValue}"/>" <c:if test="${readOnly}">disabled</c:if> onchange="fireCascade('${requestScope.reportUnitObject.URI}','${wrapper.resourceUriPrefix}','${inputName}', ${control.type}, ${readOnly});"/> <c:if test="${wrapper.errorMessage != null}"> <c:set var="hasValueError" value="true"/> </c:if> <div id="error_${inputName}"></div> <span class="message warning"><c:out value="${wrapper.errorMessage}"/></span> </label> </li> <c:set var="initAggregate_2"> initAggregate('${wrapper.resourceUriPrefix}' ,'${inputName}', ${control.type}, ${readOnly}, '<spring:escapeBody javaScriptEscape="true">${wrapper.formattedValue}</spring:escapeBody>'); </c:set> <script> ${initAggregate_2} </script> <textarea name="_evalScript" class="hidden" style="display:none"> ${initAggregate_2} </textarea> </c:when> <%-- end custom parameters --%> Link to comment Share on other sites More sharing options...
robidomadenik Posted June 28, 2011 Author Share Posted June 28, 2011 Hi.Thanks a lot for a sample code....i saw the difference between these two files. Thanks again :) Now I have another problem.....a have situation, when my custom input dialog box opens, I want to load some parameters from mySQL database into this input dialog box (textbox) and save them into mySQL, when parameters are changed or when OK button (submit) is clicked and then the report is shown. I received a message from Sherman (Jasper), that this could be the way:· catch the form submit event in Javascript· send the parameters to a separate JSP which would save them· continue doing the normal JasperServer submitbut its messy and I don't see nothing about submit in file DefaultparametersForm.jspAny suggestions??? Thanks,Robi Link to comment Share on other sites More sharing options...
gustafsf Posted June 28, 2011 Share Posted June 28, 2011 Check out these files ..apache-tomcat/webapps/jasperserver/WEB-INF/jsp/modules/viewReport/ViewReport.jsp (input controls on-page form section) ..apache-tomcat/webapps/jasperserver/scripts/controls.report.js (applyInputValues function) Link to comment Share on other sites More sharing options...
robidomadenik Posted July 6, 2011 Author Share Posted July 6, 2011 Hello again. I still didn't manage to solve all my issues regarding additional input parameters in JasperServer 4.0As I see in post above, there's a sample of modification in existing input parameter........I would like to know, how I can add "additional" parameter to this DefaultParametersForm.jsp file ?? Well, here's my case:In JasperServer I made 2 date parameters.... (from-to.....Single value , Type:Date)Now I'm wondering if I can make a custom two additional buttons, so i can modify these 2 dates BEFORE I run the report. So....if I have FROM: 01-04-2011 and TO: 30-04-2011 and then I press button "Before" the dates moves to FROM: 01-03-2011 and TO: 31-03-2011 and if I press "AFTER" the dates are FROM: 01-05-2011 and TO: 31-05-2011.But this have to happen when I enter my input parameters, so on-the-fly.......in the end I press Apply and I run the report. Can I do this somehow??? Maybe an example for adding a additional parameter to DefaultParametersForm.jsp ? Thanks a lot!Robi Link to comment Share on other sites More sharing options...
robidomadenik Posted July 11, 2011 Author Share Posted July 11, 2011 Hey. Thanks anyway.I've already solved it........... Robi Link to comment Share on other sites More sharing options...
hlta Posted November 24, 2011 Share Posted November 24, 2011 Hi All, I am trying to give my own inputs to the jasper ireport. I have some conditions , which are different from what jasper providing by default.I want to display my options in a tree structure to the user, By selecting them, the report has to be genarated.For this i created one jsp file and placed it in optional jsp location, then i can see the tree structure in the browser windwo but i am not able to get the report,and no error message tooo. Tell me the way (if possible sample code) to give our own values to the ireport . And which things to be consider when we are providing jsp file in optional jsp location.Thanks in advance. Link to comment Share on other sites More sharing options...
kcsekhar25 Posted May 8, 2012 Share Posted May 8, 2012 hi all i have a issue which is kiling me from many days. i am using js cp 4.5 and my problem is i am creating a report in ireport with paramter product_id and am linking a input control to this parameter in jasper server where i am passing prodcut-id as a value column and product_name as a visible column. i want to dispaly what ever selected filter value along with the report. i dragged parameetr product_id into detail band but it is dispalying product_id as it is referencing value column as product_id. please help if you have any thoughts on this on how to show visible column instead of value column in the report . any jasper server customization needed ,please let me know. thanks in advace chandrasekhar Link to comment Share on other sites More sharing options...
shatad0101 Posted December 7, 2012 Share Posted December 7, 2012 Hi, thanks for this post , I also have been trying this for last one month , So if you could tell me in detail how can i do this in my jasperserver? Link to comment Share on other sites More sharing options...
superunicojosh Posted January 9, 2013 Share Posted January 9, 2013 with the code shown above I have the following problemdoes not show correctly the password field, and the parameter fails to reportim in JRS 4.7,http://img21.imageshack.us/img21/6310/problemiu.png Uploaded with ImageShack.us Link to comment Share on other sites More sharing options...
NikunjB Posted July 22, 2014 Share Posted July 22, 2014 a Link to comment Share on other sites More sharing options...
NikunjB Posted July 22, 2014 Share Posted July 22, 2014 Hi kcsekhar25....! You can display paramter text using subreport functionality. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now