Hi,
I have an Enum like this
package com.example;
public enum CoverageEnum {
COUNTRY,
REGIONAL,
COUNTY
}
I would like to iterate over these constants in JSP without using scriptlet code. I know I can do it with scriptlet code like this:
<c:forEach var="type" items="<%= com.example.CoverageEnum.values() %>">
${type}...
Hi,
Is there any way to do the equivalent of the following in a JSP without using scriptlet?
<% response.setContentType("text/plain"); %>
I can't simply use
<%@ page language="java" contentType="text/plain" %>
because I need to set the content-type in 2 places (each in a different branch of a ) and the JSP compiler will only allow...
I hava a url such as search.do?offset=20
offset sometimes is in the url sometimes not. When it is not in the URL i want it to be 0.
i try, without success, to retrieve the value with a scriptlet as follows:
<% Integer offset = (pageContext.findAttribute("offset")==null) ? new Integer("0") : new Integer((String) pageContext.findAttri...
Is it possible in JSP to get the type of Object in List, just like we do in Java
myDataBind.getResultsList().get(0).getClass();
or is it possible to achieve something like this:
if ( myDataBind.getResultsList().get(0) instanceOf MyClass ) {
doThis;
}
i don't prefer scriptlets, but if it is not possible to do without scriptlets th...
Sometimes after some refactoring occurs, and we produce a successful build, some legacy code using scriptlets fails to compile on runtime. I would like it if there was a way that I can verify that scriptlets will compile using msbuild.
Is that what aspnet_compiler is for?
Thanks
...
Kindly assist here, the getParameter is only printing the first portion of the String element in the tag.
here is the select tag
<select name="ActionSelect" id="ActionSelect" >
<%Iterator itr;%>
<% List data = (List) request.getAttribute("data");
for (itr = data.iterator(); itr.hasNext();) {
String value = (String) itr.next();...
I have some JSP code, which writes a tree representing hierachical data. This data is represented using nested layers.
In the JSP code there are many code snippets similar to the following code (which outputs as many closing div tags as is the numerical value of variable differenceAmount):
<jsp:scriptlet>
int differenceAmount = pr...
I have to access the JSTL variable which is calculated inside the iterator.
Excerpt of code:
<c:forEach var="resultBean" items="${resultList}" varStatus="status">
card: ${resultBean.cardNum}
</c:forEach>
i would like to access ${resultBean.cardNum} in the scriptlet code. what i am doing right now is:
<c:forEach var="resultBe...
Hi, I've been told that the use of scriptlets (<%= ... %>) in my JSP pages isn't such a great idea.
Can someone with a bit more java/jsp experience please give me some pointers as to how to change this code so its more 'best practice', whatever that may be?
This JSP is actually my sitemesh main decorator page. Basically my web design h...
Hi,
I have the following in my jspx file:
<jsp:scriplet>
int myvar = 2;
</jsp:scriptlet>
How can I put variable myvar into a textbox (id=myinput) value using JSTL or scriptlet (I can do this using session variable)
<input type="text" id="myinput" value="...the value of myvar..."/>
Thanks
...
Using struts2 with jsp with standard struts tag libraries.
I'm trying to dynamically hide a DIV on page load, but still send it to the browser. This is so I can show it later via javascript.
The request objects one and two are not easily referenced via a jsp:usebean tag. (They are enums and cannot be instantiated) I tried using a ...
Is it possible to instantiate a class and then invoke its methods between scriptlets in JSP?
I am getting errors and I don't know why (java class and methods are fine).
Any other way to do the same (i just want a string from a method in a class)?
...
I have a little problem with JDeveloper. It has excellent code completion abilities in java files, and it also works fine for tags in JSP files, but it doesn't work inside scriptlets. For example, if I have code like this:
<x:sometag attribute=<%=MyClass.A
I want it to automatically complete it, when I press Ctrl+space, with the avail...
In the web I've seen examples both with
<% if @showIt -%>
some html content
<% end -%>
and without
<% if @showIt %>
some html content
<% end %>
dash. Both versions work very well. So, what difference does it make?
Thanks!
...
Hello,
I am starting a project that will have many "files" (like a web servers .html or jsp files). Each of these files will have "JSP" embedded in the files, for example;
Hello <%="John Doe" %>
I would then like to programatically send this file through a "JSP Compiler" and then get the output file.
I have looked at the Tomcats...
The following code causes an error:
1. <c:set var="test" value="test1"/>
2. <%
3. String resp = "abc";
4. resp = resp + test;
5. pageContext.setAttribute("resp", resp);
6. %>
7. <c:out value="${resp}"/>
The error says
"error a line 4: unknown symbol 'test'".
How do I pass test from the JSTL code to the JSP scriptlet?
...
I know its not recommended, and I should be using tag libraries etc etc.
But I'd still like to know if it is legal to declare methods in a jsp scriplet:
<%
public String doSomething(String param) {
//
}
String test = doSomething("test");
%>
Is that legal? I am getting some weird compile errors (like a ; is expected)...
The string:
${prettyDate}
is output to the page by this custom tag instead of the prettified Date string:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ tag import="com.ocpsoft.pretty.time.PrettyTime, java.util.Date"%>
<%@ attribute name="dateParam" required="true" type="java.util.Date" %>
<%
PrettyTime p = ne...
My Description contains an apstrophe('). How to escape it.
<a href='javascript:select("<%= pageBean.replace(list.getColumn(0), "'", "'") %>",
"<%= pageBean.replace(list.getColumn(1), "'", "'") %>");' title="<%=selRpt%>">
<span class='img-view'></span></a>
"<%= pageBean.replace(list.getColumn(1), "'", "'") %>" is the description part i...