How to call the JSP function and send the parameter using the function

Nur Wafiqa

I have two files which is Form.jsp and Util.jsp

What I want to do is I want to substitute the <%=sType%> attribute with a function call name checkParam and pass the parameter

Form.jsp

sType is a variable

sType=request.getParameter("type")!=nullrequest.getParameter("type").toString():"";

<form name="myFrm" method=post action="frmAction.jsp?type=<%=checkParam(sType)%>">

Util.jsp

public String checkParam(String mParam)
{
     //mycode
}
javabot

<%=sType%>"> is jsp code, right? then why is it in a .html file? JSP files are rendered by the server and since can process java code, hence the name Java Server Pages. HTML files are served as resources and no such rendering is done on server side. If you want the form to be configured dynamically use either a .JSP file to reside the form or use an ajax call and javascript/jquery to set the action parameter manually.

Even if you used a .JSP to render the form i think the code should be written with a place holder.

<form name="myFrm" method=post action="frmAction.jsp?type=${sType}">

If you are using JSP use standard tag libraries. Coding like <%=sType%> is bad practice, as of my understanding.

According to the edit I think the statement should be

sType=(request.getParameter("type")!=null) ? request.getParameter("type").toString():"";

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to call the JSP function and send the parameter using the function

From Dev

How to call DLL function using "&" parameter?

From Dev

How to call a function with a function as parameter?

From Dev

How do i send parameter in ajax function call in jquery

From Dev

How do i send parameter in ajax function call in jquery

From Dev

Call php function from javascript and send parameter

From Java

How to call a function on an object with a generic type parameter using scala macros?

From Dev

How to call a JS function inside a JSP?

From Dev

How to call function defined in jsp from servlet?

From Dev

Error in call to function using pointers as parameter

From Dev

Call a function with parameter in codeigniter using hyperlink

From Dev

How to send object in ejs as function parameter

From Dev

Laravel 5.1 - How to send parameter to authorize() function

From Dev

How to send parameter from one function to another

From Dev

How to send dictionary as parameter to python function

From Dev

Function call in another function using same parameter received

From Dev

How to call a JavaScript function with parameter in jQuery?

From Dev

How to call one function with different parameter types

From Dev

How to call a JavaScript function with parameter in jQuery?

From Dev

How to call class template function with parameter

From Dev

How to call a function with a parameter as string in php?

From Dev

How can I call function with parameter in bash?

From Dev

How to properly call a function with date parameter?

From Dev

how to call function where parameter based on a promise

From Dev

How to call on init function from textarea with parameter?

From Dev

How to call a parameter list from a function in Julia

From Dev

How to call java function using onclick event in <a> tag from jsp page

From Dev

Function call as parameter value?

From Dev

Function as method call parameter

Related Related

  1. 1

    How to call the JSP function and send the parameter using the function

  2. 2

    How to call DLL function using "&" parameter?

  3. 3

    How to call a function with a function as parameter?

  4. 4

    How do i send parameter in ajax function call in jquery

  5. 5

    How do i send parameter in ajax function call in jquery

  6. 6

    Call php function from javascript and send parameter

  7. 7

    How to call a function on an object with a generic type parameter using scala macros?

  8. 8

    How to call a JS function inside a JSP?

  9. 9

    How to call function defined in jsp from servlet?

  10. 10

    Error in call to function using pointers as parameter

  11. 11

    Call a function with parameter in codeigniter using hyperlink

  12. 12

    How to send object in ejs as function parameter

  13. 13

    Laravel 5.1 - How to send parameter to authorize() function

  14. 14

    How to send parameter from one function to another

  15. 15

    How to send dictionary as parameter to python function

  16. 16

    Function call in another function using same parameter received

  17. 17

    How to call a JavaScript function with parameter in jQuery?

  18. 18

    How to call one function with different parameter types

  19. 19

    How to call a JavaScript function with parameter in jQuery?

  20. 20

    How to call class template function with parameter

  21. 21

    How to call a function with a parameter as string in php?

  22. 22

    How can I call function with parameter in bash?

  23. 23

    How to properly call a function with date parameter?

  24. 24

    how to call function where parameter based on a promise

  25. 25

    How to call on init function from textarea with parameter?

  26. 26

    How to call a parameter list from a function in Julia

  27. 27

    How to call java function using onclick event in <a> tag from jsp page

  28. 28

    Function call as parameter value?

  29. 29

    Function as method call parameter

HotTag

Archive