How to use jstl variable in a jsp page
Hi all,
I am new to JSTL and i want to access the value of jstl in jsp.
when i use the tag like below it is displaying the value ""
<c:out value="${ack}"/>
But as ack is string, i want to convert it into int. and i have written like
<c:set var="ackvalue" value="${ack}"/>
and int ack = Integer.parseInt(ackvalue);
But it is showing error like varialbe can not be resolved: ackvalue
can anybody please help me regarding this?
Waiting for your warm response.
Thanks in advance
Hi,
Thanks for your immediate reply.
I am able to display the ackvalue when i am using
<c:set var="ackvalue" value="${ack}"/>
and <c:out value="${ackvalue}"/>
But my actual requirement is to use the ack value in
switch statement. if i can assign the value to a
String variable, then it si easy for me to proceed.
Please help me in this regard.
Thanks,You can use the c:choose, c:when and c:otherwise tags
<c:choose>
<c:when test = "${ackvalue == 1}">
//do stuff
</c:when>
<c:when test = "${ackvalue == 2}">
//do some other stuff
</c:when>
<c:otherwise>
//stuff
</c:otherwise>
</c:choose>ram.
Similar Messages
-
How to use ShowValue within a UIX/JSP page to display an active link?
I am storing URL's in the DB and want to display them as active links on a UIX/JSP page. I thought that I had this working some time ago, but now it no longer works.
Using <bc4juix:RenderValue datasource="ds1" dataitem="myTextField" /> will display "http://www.otn.oracle.com" as an inactive link using UIX/XML which is expected.
Using <jbo:ShowValue datasource="ds1" dataitem="myTextField" /> will display an active link using if using BC4J/JSP, which is expected.
However, I have not been able to do this using a UIX/JSP page.
Is it possible to use ShowValue within a UIX/JSP page to display an active link?
Thanks,
Bill GHi Juan,
I've done the following and it does not work for me;
--- snip ---
<uix:form name="form1" method="GET">
<bc4juix:Table datasource="ds1" >
<uix:columnHeaderStamp>
<uix:styledText textBinding="LABEL"/>
</uix:columnHeaderStamp>
<%--
<jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
<bc4juix:RenderValue datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
</jbo:AttributeIterate>
--%>
<bc4juix:RenderValue datasource="ds1" dataitem="FacilityDesc" />
<bc4juix:RenderValue datasource="ds1" dataitem="LocationId" />
<bc4juix:RenderValue datasource="ds1" dataitem="LocationDesc" />
<%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
<jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
<%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
<uix:rawText>
<jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
</uix:rawText>
<%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
<uix:contents>
<uix:rawText>
<jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
</uix:rawText>
</uix:contents>
--- snip ---
Bill G... -
How to use javascript functions in struts jsp page
hi
iam using struts jsp pages. here iam calling one javascript function. but iam not able to access the form in javascript.
wat i have to give as form name to get the elements of the form.
please reply me soon
it is urgent
vamsiyour form has no name liek this one:
<html:form action="/userRegistration.do" >so you cannot access the elements inside your form?
accessing the elements inside the form will be like this:
document.forms[0].propertyName.value; -
Could I use jstl tag in the JSP page of Creator 2 final release?
I have a JSP page used to work well in Creator 2EA2. The page
has the following code snippets:
<c:forEach items="${SessionBean1.webQuery1.details}" var="item">
<tr>
<td class="detailKey">
<c:out value="${item.key}"/>
</td>
<td class="detailValue">
<c:out value="${item.value}"/>
</td>
</tr>
</c:forEach>
...Basically, it generates a table columns.
After migrating to Creator2 final release, a fatal exception is thrown
when the page is launched :
Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
Exception Details: org.apache.jasper.JasperException
/Page1.jsp(148,132) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
Possible Source of Error:
Class Name: org.apache.jasper.compiler.DefaultErrorHandler
File Name: DefaultErrorHandler.java
Method Name: jspError
Line Number: 43
Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
Stack Trace:
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:43)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:414)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:155)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes Any suggestion, or work around?
ThanksThere is something strange in the HTML for you posedt, so I cannot clearly see what you are trying to do in your JSP page. But either of the following kinds of usage would cause this kind of error:
<h:dropDown ... items="<%= ...some Java expression ...>"/>or
<h:dropDown ... items="${...some JSP EL expression...}"/>This is because JSF component tags allow neither Java runtime expressions nor JSP EL expressions (at least in JSF 1.1, which is what Creator 2 supports). The answer is to use a JSF EL expression instead, like this:
<h:dropDown ... items="#{... some EL expression}"/>Craig -
Using JSTL variables in JSP or Javascript. Possible ?
Hi All,
Is it possible to share or use the variables which are declared are used by JSTL in JSP expression or scriplet code and in Java Script.
Example:
This Works:
<fmt:set var="test" value="JSTL" />
<fmt:out value="${test}" />
But, this gives error:
<% out.println(test) %>
And passing the value of variable 'test' to Java Script code also gives error.
How to use JSTL variables in JSP and in Javascript ?
Yours,
Sankar.BBy default, JSTL variables are kept in servlet
attributes. Default is to store it in the page
context. You can make it request/session/application
scope as required by an attribute of the set tag.Hi there,
Can anyone advise how to access JSP variables in JSTL?
Can it be done as the same method through request/session/application scope?
Thnks... -
Accessing a JSTL variable in a JSP Scriptlet (need to replace string )
I have
<c:set var="myVar" value="..." />
I need to replace single quotes and double quotes to be escaped because I pass them into javascript functions and set them as ID for div sections
... onclick ="func('${myVar}')" ..
<div id="${myVar}">
but if the string contains ' single quotes it messes up the javascript or double quotes messes up the ID portion of the HTML tag
I know there is the JSTL function fn but I can't figure out how to do it properly in JSTL
<c:set var="myVar"
value="${fn:replace(myVar, "'", "\"")"/>
But that gets tricky since the value portion is enclosed in quotes
So I was thinking of using a Scriptlet part instead.
escaping quotes within quotes within quotes.... ARGH!
Recipe for a headache if ever there was one.
However you must be strong and resist the temptations of the dark side (Scriptlet code)
My suggestion for cleaning this up - write your own static function for escaping javascript strings.
public static String escapeJavascriptString(String s){
return .......
}Then define the function in a tld:
<function>
<description>
Escapes a string for javascript purposes
</description>
<name>escapeJavascript</name>
<function-class>com.mypackage.ELFunctions</function-class>
<function-signature>java.lang.String escapeJavascript(java.lang.String)</function-signature>
<example>
<c:out value="${myfunc:escapeJavascript(name)}">
</example>
</function>Cheers,
evnafets
escaping quotes within quotes within quotes.... ARGH!
Recipe for a headache if ever there was one.
However you must be strong and resist the temptations of the dark side (Scriptlet code)
My suggestion for cleaning this up - write your own static function for escaping javascript strings.
public static String escapeJavascriptString(String s){
return .......
}Then define the function in a tld:
<function>
<description>
Escapes a string for javascript purposes
</description>
<name>escapeJavascript</name>
<function-class>com.mypackage.ELFunctions</function-class>
<function-signature>java.lang.String escapeJavascript(java.lang.String)</function-signature>
<example>
<c:out value="${myfunc:escapeJavascript(name)}">
</example>
</function>Cheers,
evnafets
How to pass applet variable to a jsp
I just want to pass applet variable to a jsp page to access database. But how .
Help me please.
you can use showDocument() to show a page which could have values in the query string.
you can use URLConnection to do GET or POST requests to a page.
How to use ADF variables in C:when test?
I have a <af:iterator in my page fragment as follows
<af:iterator id="i1" value="#{queryModel.currentDescriptor.conjunctionCriterion.criterionList}" var="criterion" varStatus="vs">
Within this iterator, I want to make a decision absed on the index of the iterator. To do this test, I am using jstl as follows
<c:when test="${vs.index == '0' or vs.index == '2' or vs.index == '4'}">
This test is however always evaluating to false. I have tried cahnging my code using various combiantion as below ...
<c:when test="#{vs.index == '0' or vs.index == '2' or vs.index == '4'}">
<c:when test="${vs.index == 0 or vs.index == 2 or vs.index == 4}">
<c:when test="${vs.index == '0' || vs.index == '2' || vs.index == '4'}">
But nothign seems to be working fine.
Can some one help me with what I am doing wrong?
Thanks.
How to use ADF variables in <C:when test?
How to use JSTL varriable in to XML
1. how to use JSTL varriable into Xml Tag.
for example :
java value I am passing to XML.
<eztag:companytag pgm_sname="<%= strpgm_name%>" dbase="<%= strd%>"
dbpass="<%= strp%>" dburl="<%= stru%>" session="<%= session%>" />
After modified in JSTL
<eztag:companytag pgm_sname="${pgm_name}" dbase="${strd}"
dbpass="${strp}" dburl="${stru}" session="${session}" />
but its Not working. How to use this
2.How to use ArrayLIst in JSTL
For example
IN Java scriplet code in JSP
<%for(int i=0;i<alist.size();i++) {
String str = String.valueOf(alist.get(i));
String str1 = String.valueOf(alist.get(i+1));
%>
<TD>STR - <%=str%> </TD>
<TD>STR1 - <%=str1%> </TD>
<% } %>
This code How to Use in JSTL.
thanks in advance
thanks for reply
But in this article it describes how to passing the value of function.
I need how to assign the JSTL varriable to xml tag attribute.
for example
In my TLD File
<tag>
<name>companytag</name>
<tag-class>bas.CompanyTag</tag-class>
<attribute>
<name>dbase</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<name>dbpass</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<name>dburl</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<name>pgm_sname</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<name>session</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
</tag>
Html code
old code :
<%@ taglib uri="/ezerptags.tld" prefix="eztag" %>
<eztag:companytag pgm_sname="<%= strpgm_name%>" dbase="<%= strd%>"
dbpass="<%= strp%>" dburl="<%= stru%>" session="<%= session%>" />
After modified in JSTL
<%@ taglib uri="/ezerptags.tld" prefix="eztag" %>
<eztag:companytag pgm_sname="${pgm_name}" dbase="${strd}"
dbpass="${strp}" dburl="${stru}" session="${session}" />
but its Not working. How to use this
the "eztag" and "companytag" are the customtag. these tages available in eztaglib.tld file. I am passing the value through XML Tag.
Please suggest me . how to use.
is there any article describes how to pass jstl varriable to XML Tag attribute.
thanks in advance
How to use the variables used in the message mapping
Hi ,
In the message mapping we can declare variables in the JAVA section , these variables could be used across the mapping .
I have tried using it but I am unable to retrieve the values assigned to the variables in one UDF into the another UDF .
Please guide me how to use the variables declared in the JAVA section in the message mapping .
Thanks
Anita Yadav
Anita,
I have worked on the Global variables and i found no issues. Make sure that the variable is declared in the Declaration Section and then initlaized in the Initialization section.
If you declare a variable in the Declaration Section ,
int i;
then in any udf you can use if directly. No need to re declare the variable in the UDF. If you do this, then it becomes a local variable.
Regards,
Bhavesh
How can use a variable in the folowing code?
How can use a variable 'W_ROWNUM2' in the folowing code?
MOVE '1' TO CNT.
LOOP AT L_T_PM2.
CONCATENATE '0' CNT INTO W_ROWNUM2.CONDENSE W_ROWNUM2.
CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
perform DYNPRO_FIELD using FLD2
L_T_PM2-vari12_con.
CNT = CNT + 1.
CONDENSE CNT.
ENDLOOP.
I need to increment the value of W_ROWNUM2.
Please ,it is urgent!!
Hello
CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
Try using spaces between parts of the resulting string.
CONCATENATE 'F110V-VARI' W_ROWNUM2 '(01)' INTO FLD2
Regards
Greg Kern.
How to use bind variables in the following query
CREATE OR REPLACE PROCEDURE MMDB.test IS
sel_qtn VARCHAR2 (10);
CURSOR PT_QUANTITY IS select * from mmdb.product_tree WHERE QUANTITY_CHECK ='E'
AND run_id = 100
a PT_QUANTITY%ROWTYPE;
BEGIN
FOR i IN PT_QUANTITY
loop
sel_qtn := i.quanttity-1;
While sel_qtn>=1
loop
insert into mmdb.product_tree (BILLING_ACCOUNT_NO ,S_CODE) values (i.BILLING_ACCOUNT_NO ,i.S_CODE||'E');
sel_qtn :=sel_qtn -1;
End loop;
commit;
end;
Don't duplicate threads: How to use bind variables in the following query
How to use bind variables in this procedure
Hi Experts,
How to use bind variables in this procedure for static queries.
PROCEDURE DELETE_MER_PROC (M_id IN NUMBER)
IS
BEGIN
V_date DATE;
SELECT PD_DATE INTO v_date FROM PD_MAINTAIN;
DELETE FROM MER_CLEAR
WHERE MER_DT < v_date
AND ID = M_ID;
COMMIT;
END;
How to use v_date and m_id as bind variables in this procedure to avoid hard parsing.
Please help me.
Thanks.
976208 wrote:
How to use v_date and m_id as bind variables in this procedure to avoid hard parsing.
You cannot avoid hard parsing - as the 1st time a SQL statement (like the SELECT or DELETE statements in your code) is encountered, it does not reside in the server's Shared Pool, and needs to be added into the pool via a hard parse.
Bind variables does not prevent hard parsing. Hard parsing happens when the SQL statement (with or without bind variables) is a brand new statement encountered by the server.
Bind variables enables the same SQL cursor to be reused, by simply changing the bind variable value.
Not using bind variables means that each SQL statement is unique and not shareable - as the value is hardcoded into the statement and cannot be changed via a bind value. This typically means LOTS of different SQL statements (where the only difference is the changed value in the statement) are created - with each statement being a new statement not seen before in the Shared Pool and needing to be hard parsed.
One does not design one's code not to be hard parsed. There ALWAYS will be a hard parse in order to get a SQL statement into the Shared Pool. One designs one's code to REUSE cursors in the Shared Pool.
How to use Bind Variables in Essbase data control
Hi,
I am trying to use Bind Variables in MDX query while creating the Essbase Data Control. I have used the below query with the Bind Variable.. this query is working in Essbase admin console..but it is throwing error (*Invalid MDX Query)* while creating Essbase Datacontrol in JDeveloper.
MDX Query : SELECT {[Measures].Msr_2} ON COLUMNS, [Time].Children ON ROWS FROM cube
where ($name)
Could any body suggest me on how to use bind variables with Essbase Data control.
Thanks,
Swathi
Hello Swathi, can you please help me how you created Essbase DataControl? Also were you able to figure out this?
Thanks, Praveen.
Hi,
I have the below cursor 1 which is working already.For my requirement i want to use bind variable like second cursor.But its telling Bind Variable "p_col_list" is NOT DECLARED.Please any onehelp me on this.
How to use bind variable Here.
Cursor1:
DECLARE
emp_cv sys_refcursor;
iid NUMBER := 1;
i_sql varchar2(100);
p_col_list varchar2(2000) := 'aaa,bbb,ccc,ddd';
BEGIN
i_sql := 'select '''||REPLACE(p_col_list, ',', ''',''')||''' from dual '||CHR(10) ;
dbms_output.put_line(i_sql);
OPEN emp_cv FOR i_sql ;
END;
Cursor2:
DECLARE
emp_cv sys_refcursor;
iid NUMBER := 1;
i_sql varchar2(100);
p_col_list varchar2(2000) := 'aaa,bbb,ccc,ddd';
BEGIN
i_sql := 'select '''||REPLACE(:p_col_list, ',', ''',''')||''' from dual '||CHR(10) ;
dbms_output.put_line(i_sql);
OPEN emp_cv FOR i_sql using p_col_list;
END;
hello,
the reports parameterform capabilities are limited. if you want
to create sophisticated parameterforms, you should do that with
oracle forms or html forms.
regards,
the oracle reports team --pw
Maybe you are looking for
-
Vendor Account not getting automatically cleared using F.13 (OB74)
Dear Sir / Mam, I want to clear vendor account open item based on assignment field. for this 1. I configured OB74 as below YAIN K 0 9999999999 ZUONR (where YAIN = COA) 2. One of my vendor account # 300031 is appearing as below Assignm
-
How do I get iCal to print my calendar just as it appears on the screen? I like the whole block-out method rather than just a line down the side indicating the time devoted to an event. Is there any way to change the style of how it' sprinted?
-
How do you reorder the pages in a PDF ie back to front (not individually via Page view)
Sorry if this is in the wrong place or if this has been answered elsewhere but I couldn't seem to search "the database" How do you reorder the pages in a PDF ie back to front (not individually via Page view). The manual solution of course is to scan
-
I recently lost my photos that were in my photo stream on my phone. They are still on my iCloud storage. How can I retrieve those?
-
I uninstalled iTunes and all of the Apple-related products. I downloaded and installed .NET 4.0 product. My version of Windows is Windows 7 64 Bit. I re-installed the latest iTunes software. I still get this message and cannot access iTunes from