Custom JSP input dialog in JasperReports Server 4.0


Hello all.


I would be glad if someone could help me with some kind of JSP code example, how

to 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,


Post Edited by robidomadenik at 06/14/2011 07:34
robidomadenik's picture
Joined: Apr 13 2011 - 1:54pm
Last seen: 6 years 4 months ago

8 Answers:



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!

<%-- ##########   SINGLE_VALUE - CUSTOM PARAMETER   ########## --%>
                <c:when test="${inputName == 'pass'}">  <%-- Single value : InputControl.TYPE_SINGLE_VALUE --%>
                    <li class="leaf" id="jsCtrl_pass">
                            <c:when test="${control.dataType.localResource.type == 3 or control.dataType.localResource.type == 4}">
                                <c:set var="controlClass" value="picker"/>
                                <c:set var="controlClass" value="text"/>
                        <label class="control input password" for="pass" title="Filter value">
                            <span class="wrap">
                                <js:inputControlLabel control="${wrapper}" messageSource="${messageSource}"/>:
                                    <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"/>
                            <div id="error_${inputName}"></div>
                            <span class="message warning"><c:out value="${wrapper.errorMessage}"/></span>
                    <c:set var="initAggregate_2">
                        initAggregate('${wrapper.resourceUriPrefix}'  ,'${inputName}', ${control.type}, ${readOnly}, '<spring:escapeBody javaScriptEscape="true">${wrapper.formattedValue}</spring:escapeBody>');
                    <textarea name="_evalScript" class="hidden" style="display:none">
                <%-- end custom parameters --%></td></tr></tbody></table>
gustafsf's picture
Joined: Nov 18 2008 - 2:24pm
Last seen: 3 months 4 weeks ago


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 submit

but its messy and I don't see nothing about submit in file DefaultparametersForm.jsp

Any suggestions???




robidomadenik's picture
Joined: Apr 13 2011 - 1:54pm
Last seen: 6 years 4 months ago

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/ (applyInputValues function)
gustafsf's picture
Joined: Nov 18 2008 - 2:24pm
Last seen: 3 months 4 weeks ago

Hello again.


I still didn't manage to solve all my issues regarding additional input parameters in JasperServer 4.0

As 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 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!


robidomadenik's picture
Joined: Apr 13 2011 - 1:54pm
Last seen: 6 years 4 months ago


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?

shatad0101 - 4 years 8 months ago



Thanks anyway.

I've already solved it...........



robidomadenik's picture
Joined: Apr 13 2011 - 1:54pm
Last seen: 6 years 4 months ago

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.

hlta's picture
Joined: Nov 22 2011 - 6:50am
Last seen: 5 years 9 months ago

 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




kcsekhar25's picture
Joined: Apr 24 2011 - 7:00am
Last seen: 6 months 3 weeks ago

Hi kcsekhar25....!

You can display paramter text using subreport functionality.

NikunjB - 3 years 1 month ago

with the code shown above I have the following problem

does not show correctly the password field, and the parameter fails to report

im in JRS 4.7

Uploaded with

superunicojosh's picture
Joined: Mar 26 2012 - 12:36pm
Last seen: 3 years 7 months ago


NikunjB - 3 years 1 month ago