Apologies in advance - I'm new to JSPs and struggling with some basic issues.
My present problem is that I need to build a url. This will be of the format:
/somepage?param1=p1¶m2=p2.
p1 and p2 are stored in a database rowset, lets call them ${row.p1} and ${row.p2}.
I need to create a string made up of "/somepage?param1=" ${row.p1} "¶m2=" and ${row.p2}.
In a servlet this would be easy, but I can't find the correct syntax for a JSP.
I have tried building the string in a scriplet:
<% String url = "/somepage?param1=" + ${row.p1} + "¶m2=" + ${row.p2}; %>
This fails to complile - the ${row.p1} syntax is not recognised - jasper error is "expected ";".
I have also tried doing this in a core tag:
<cut value=" ${ '/somepage?param1=' + row.p1 + '¶m2=' + row.p2 }">
I get no error message from the compiler or at runtime, but the page does not display.
One variation which nearly worked was:
<cut value="/somepage?param1=${row.p1}¶m2=${row.p2}"/>
This displayed the first part of the string and the value of p1, but failed to show the second half.
I would like to know what I'm doing wrong in both cases if anyone can help.
How can an expression e.g. ${row.p1} be referenced in a scriplet?
How can several expressions and strings be cocatenated within a tag?
Thanks in advance.
My present problem is that I need to build a url. This will be of the format:
/somepage?param1=p1¶m2=p2.
p1 and p2 are stored in a database rowset, lets call them ${row.p1} and ${row.p2}.
I need to create a string made up of "/somepage?param1=" ${row.p1} "¶m2=" and ${row.p2}.
In a servlet this would be easy, but I can't find the correct syntax for a JSP.
I have tried building the string in a scriplet:
<% String url = "/somepage?param1=" + ${row.p1} + "¶m2=" + ${row.p2}; %>
This fails to complile - the ${row.p1} syntax is not recognised - jasper error is "expected ";".
I have also tried doing this in a core tag:
<cut value=" ${ '/somepage?param1=' + row.p1 + '¶m2=' + row.p2 }">
I get no error message from the compiler or at runtime, but the page does not display.
One variation which nearly worked was:
<cut value="/somepage?param1=${row.p1}¶m2=${row.p2}"/>
This displayed the first part of the string and the value of p1, but failed to show the second half.
I would like to know what I'm doing wrong in both cases if anyone can help.
How can an expression e.g. ${row.p1} be referenced in a scriplet?
How can several expressions and strings be cocatenated within a tag?
Thanks in advance.