All Questions

1457
votes
28answers
235003 views

How to avoid Java code in JSP files?

I'm new to Java EE and I know that something like the following three lines <%= x+1 %> <%= request.getParameter("name") %> <%! counter++; %> is an old school way of coding and in ...
32
votes
7answers
32263 views

How to avoid using scriptlets in my JSP page?

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 thi...
9
votes
1answers
9895 views

How to evaluate a scriptlet variable in EL?

I was wondering if there was anyway of using JSP in <c:if> statement. E.g. <c:if test="${ param.variable1 == 'Add' <% JSP variable clause %>}"> So I want my JSP variable to check...
15
votes
7answers
119759 views

How do I pass JavaScript values to Scriptlet in JSP?

Can anyone tell me how to pass JavaScript values to Scriptlet in JSP?
1
votes
1answers
4405 views

Use EL ${XY} directly in scriptlet <% XY %>

In my project I've to asign a variable every time the JSP is being opened. I tried it with scriptlets <% %> in JSP and EL ${} which gives the variable back. But it seems not working. <% St...
43
votes
2answers
97155 views

I can pass a variable from a JSP scriptlet to JSTL but not from JSTL to a JSP scriptlet without an error

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...
18
votes
6answers
67534 views

Creating Array using JSTL or EL

I'm working on a web application using Java and its frameworks(Spring 3.1.1). And I'm trying to avoid using scriptlets as much as possible, however I can't find a way other than this to define an arra...
25
votes
2answers
54285 views

Accessing a jstl variable inside a scriptlet

The following code causes an error: <c:set var="test" value="test1"/> <% String resp = "abc"; resp = resp + ${test}; //in this line I got an Exception. ...
5
votes
2answers
11452 views

How to pass java variables from scriptlets to c:when expression in jstl?

what is a proper way to use variables from scriptlets in jstl? I don't know what is wrong in my code: <% boolean a = true; boolean b = false; %> <c:choose> <c:when test="${a}">...
11
votes
6answers
34407 views

JSP tags + scriptlet. How to enable scriptlet?

I have a page which uses a tag template. My web.xml is very basic. I simply want to run some code in the page. And no, I'm not interested in tags or other alternative. I want to use the bad-practice ...

Previous Next