Results 1 to 11 of 11
Thread: JSTL c:set problem
- 07-23-2011, 03:59 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 29
- Rep Power
- 0
JSTL c:set problem
So for some reason when I set variables they just... don't exist O.o
Some test code I wrote:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix = "c"%>
<c:set var="period" value="1" scope="session" />
<c:out value="${param.period}" />
This just shows a blank page. I was using something similar in different code earlier and at one point I printed the variable, which worked, but now it won't print anything anymore, and when I use it in a constraint I get incorrect results. I can't see any syntax errors. Anybody know whats going on?
- 07-24-2011, 08:20 AM #2
Member
- Join Date
- May 2011
- Posts
- 35
- Rep Power
- 0
Look like the uri value does not return xml file anymore.
I think it is better for you to create one jstl xml file.
- 07-24-2011, 07:09 PM #3
Member
- Join Date
- Jul 2011
- Posts
- 29
- Rep Power
- 0
Thanks! Can you elaborate on how to do that?
- 07-25-2011, 07:35 PM #4
Member
- Join Date
- Jul 2011
- Posts
- 29
- Rep Power
- 0
Still confused, any more help would be great...
- 07-26-2011, 09:24 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Have a read here.
The URI is dependent on the version of the library you are using (see link).
It's a marker, not a real location, used by the library.
- 07-26-2011, 11:46 AM #6
Member
- Join Date
- Jul 2011
- Posts
- 29
- Rep Power
- 0
Thanks for that Tolls. I'm not sure if that's the problem though, since my jstl sql statements are working fine.
Also I added the following line to my code and it outputted 5 like it should:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix = "c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix = "sql"%>
<c:set var="period" value="1" scope="session" />
<c:out value="${param.period}" />
<c:out value="${3+2}" />
Then again I could have just misunderstood the link you sent me >.>
- 07-26-2011, 11:49 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Actually, is that first c:out correct?
You've just stored "period" in your session.
Shouldn't that be "sessionScope.period" then?
- 07-26-2011, 11:50 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Also, as the link I posted says, you don't need to use c:out for EL.
The EL will be translated anyway.
- 07-26-2011, 12:39 PM #9
Member
- Join Date
- Jul 2011
- Posts
- 29
- Rep Power
- 0
Oh... that worked! Apparently I need to brush up on my syntax >.>
Thanks!
- 07-26-2011, 01:04 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
I should have spotted that sooner.
I got distracted by jing-yi's point, which turned out to be a wrong turn...:)
- 07-26-2011, 01:23 PM #11
Member
- Join Date
- Jul 2011
- Posts
- 29
- Rep Power
- 0
Similar Threads
-
problem with jstl
By pablos in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 05-19-2010, 07:28 AM -
Weird problem with JSTL
By Diego_Dalmasso in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 03-02-2010, 02:51 PM -
Problem Running in Simple JSTL example
By arpitgadle in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 06-28-2009, 09:19 PM -
JSTL problem
By mihir66 in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 03-05-2009, 02:28 PM -
Problem using jstl and displaytags
By NikhilSrivastava in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 02-18-2008, 11:01 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks