Search Results

Search found 148 results on 6 pages for 'jstl'.

Page 2/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • JSTL request attribute in c:if

    - by JNPW
    I set an request attribute in my action class as follows: request.setAttribute("xFg",Boolean.TRUE); I want to retrive this in my JSP. I want to retrive them using JSTL tags. I tried this : <c:if test="${requestScope.xFg}"> <c:set var="showlist" value="true" /> </c:if> But c:if didnt work, i mean it didnt goto c:set I tried to print the sameusing c:out but nothing got displayed. What is wrong or How should i test request attribute value. I havent used requestScope so far. Is requestScope the option to get the request value? pls help.Thanks in advance.

    Read the article

  • jstl code issue

    - by theJava
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style type="text/css"> .even { background-color: silver; } </style> <title>Registration Page</title> </head> <body> <form:form action="add.htm" commandName="user"> <table> <tr> <td>User Name :</td> <td><form:input path="name" /></td> </tr> <tr> <td>Password :</td> <td><form:password path="password" /></td> </tr> <tr> <td>Gender :</td> <td><form:radiobutton path="gender" value="M" label="M" /> <form:radiobutton path="gender" value="F" label="F" /></td> </tr> <tr> <td>Country :</td> <td><form:select path="country"> <form:option value="0" label="Select" /> <form:option value="India" label="India" /> <form:option value="USA" label="USA" /> <form:option value="UK" label="UK" /> </form:select></td> </tr> <tr> <td>About you :</td> <td><form:textarea path="aboutYou" /></td> </tr> <tr> <td>Community :</td> <td><form:checkbox path="community" value="Spring" label="Spring" /> <form:checkbox path="community" value="Hibernate" label="Hibernate" /> <form:checkbox path="community" value="Struts" label="Struts" /></td> </tr> <tr> <td></td> <td><form:checkbox path="mailingList" label="Would you like to join our mailinglist?" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="Register"></td> </tr> </table> </form:form> <c:if test="${fn:length(userList) > 0}"> <table cellpadding="5"> <tr class="even"> <th>Name</th> <th>Gender</th> <th>Country</th> <th>About You</th> </tr> <c:forEach items="${userList}" var="user" varStatus="status"> <tr class="<c:if test="${status.count % 2 == 0}">even</c:if>"> <td>${user.name}</td> <td>${user.gender}</td> <td>${user.country}</td> <td>${user.aboutYou}</td> </tr> </c:forEach> </table> </c:if> </body> </html> When i execute my jsp page, this piece of code does not show up at all. The full source code is below. <c:if test="${fn:length(userList) > 0}"> <table cellpadding="5"> <tr class="even"> <th>Name</th> <th>Gender</th> <th>Country</th> <th>About You</th> </tr> <c:forEach items="${userList}" var="user" varStatus="status"> <tr class="<c:if test="${status.count % 2 == 0}">even</c:if>"> <td>${user.name}</td> <td>${user.gender}</td> <td>${user.country}</td> <td>${user.aboutYou}</td> </tr> </c:forEach> </table> </c:if>

    Read the article

  • html select option tag closes itself due to a "/" character in the dynamic value (JSP, JSTL)

    - by saky
    <select id="ordersSelect" class="drop-down" onchange="somemethod()"> <c:forEach items="${orders}" var="order" varStatus="orderStatus"> <option value="${order.id}"> ${order.publicId} </option> </c:forEach> </select> I have the above peice of code in a JSP page, that receives a list of Orders and each order has some information, the particular information that I want to display in a SELECT field is the publicId. The problem is that, on display there is only one OPTION in the SELECT and the rest of the order's publicId s are displayed as normal text below the SELECT box and not an OPTION to select. I found out that the publicId actually contains a String like A10/0001/0 and that is the character "/" is most probably causing the problem. Any solutions/suggestion/ideas?

    Read the article

  • Java JSTL / EL: nesting

    - by NoozNooz42
    I really don't know how to name this question, it's great if anyone with 2K+ rep can edit this title to better reflect my question (the fact that I can't name this easily is probably why I can't Google the solution). I've got this, which is working: <c:choose> <c:when test="${sometest}"> Hello, world! </c:when> <c:otherwise> <fmt:message key="${page.title}" /> </c:otherwise> </c:choose> And I want to change it to this: <c:choose> <c:when test="${sometest}"> <c:set var="somevar" scope="page" value="Hello, world!"/> </c:when> <c:otherwise> <c:set var="somevar" scope="page" value="<fmt:message key="${page.title}">" </c:otherwise> </c:choose But of course the following line ain't correct: <c:set var="somevar" scope="page" value="<fmt:message key="${page.title}">" How can I assign to the somevar variable the string resulting from a call?

    Read the article

  • problem with iterate over java.util.Map using "JSF" OR JSTL TAGS

    - by New-To-Java
    I'm using Richfaces jsf and I want to iterate over an Map<Object,Object>. I see many examples on sun forums and other sites but in my case it doesn't work ! here is my xhtml code : <c:forEach items="#{order.customOptions}" var="option"> <h:outputText value="this text does not print"/> <h:outputText value="#{option.value.name}" /> <h:outputText value="#{option.value.key}" /> </c:forEach> and the "order" object is of type "Order". "customOptios" is of type Map<CustomOption,CustomOptionValue> and when I create an javascript alert on to print '#{order.customeOptions}' it's content is true. but it's not even enter in c:forEach loop. please heeeeelp me :(

    Read the article

  • Problem with JSTL and weblogic

    - by Jeune
    I get the following error when I run my java ee app on weblogic, javax.servlet.jsp.el.ELException: Cannot find PropertyDescriptor for 'name' for bean 'class java.lang.String' I want to print a list of artists with the following class, public class Artist { private int id; private String name; private String genre; public Artist() { } public Artist(String name){ this.name=name; } public void setId(int id) { this.id = id; } public int getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } } The following lines of code seem to be causing the problem because when I remove it I don't get the error anymore. <c:forEach items="artists" var="artist"> <c:out value="${artist.name}"></c:out><br/> </c:forEach> When I use PrintWriter to print, it works: for (Artist artist:artists){ resp.getWriter().println(artist.getName()); } I am using java ee 2.4 and weblogic 9.2

    Read the article

  • Set HTML dropdown selected option using JSTL

    - by sarah
    In the same context i have another query ${productSubCategoryList} and the corresponding setting in request is like for(int i=0;i } here i have multiple select drop down ,even though i get the return value from for as two ,in the UI only one data is getting higlighted not the second one,What is wrong in the code ?

    Read the article

  • Formatting a long timestamp into a Date with JSTL

    - by scubabbl
    I am pulling a long timestamp from a database, but want to present it as a Date using Tags only, no embedded java in the JSP. I've created my own tag to do this because I was unable to get the parseDate and formatDate tags to work, but that's not to say they don't work. Any advice? Thanks.

    Read the article

  • Creating a page selector with JSP/JSTL

    - by zakSyed
    I am working on a project where I am required to build a page somewhat similar to the one you see when you visit a website like blockbuster. When you click on browse more you are taken to a page with a bar on top with different page numbers and a drop down to select the number of pages you want to view on that page. I want to include a feature like that on my page but I am not sure where to start. In my page I have list of 200 items which I want to display page by page. I was suggested to use custom tags, but is there a more simpler or efficient way to create that functionality. My web application uses Spring MVC framework and is coded entirely in Java. Any suggestions will be appreciated.

    Read the article

  • org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be res

    - by user291750
    I've been having the following problem with my GoDaddy's server. I am using JSPs with the JSTL Library. My /WEB-INF/lib folder contains the following libraries: jstl.jar standard.jar My JSP looks something like this: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <p>Hello! <% out.print(System.getProperty("java.class.path")); %></p> But I keep getting the following exception: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application Any ideas as to why it is doing that? Thanks

    Read the article

  • Regular expression to match empty HTML tags that may contain embedded JSTL?

    - by Keith Bentrup
    I'm trying to construct a regular expression to look for empty html tags that may have embedded JSTL. I'm using Perl for my matching. So far I can match any empty html tag that does not contain JSTL with the following? /<\w+\b(?!:)[^<]*?>\s*<\/\w+/si The \b(?!:) will avoid matching an opening JTSL tag but that doesn't address the whether JSTL may be within the HTML tag itself (which is allowable). I only want to know if this HTML tag has no children (only whitespace or empty). So I'm looking for a pattern that would match both the following: <div id="my-id"> </div> <div class="<c:out var="${my.property}" />"></div> Currently the first div matches. The second does not. Is it doable? I tried several variations using lookahead assertions, and I'm starting to think it's not. However, I can't say for certain or articulate why it's not. Edit: I'm not writing something to interpret the code, and I'm not interested in using a parser. I'm writing a script to point out potential issues/oversights. And at this point, I'm curious, too, to see if there is something clever with lookaheads or lookbehinds that I may be missing. If it bothers you that I'm trying to "solve" a problem this way, don't think of it as looking for a solution. To me it's more of a challenge now, and an opportunity to learn more about regular expressions. Also, if it helps, you can assume that the html is xhtml strict.

    Read the article

  • How to convert an arbitrary object to String with JSTL? (calling toString())

    - by hstoerr
    Is there any way to call toString() on an object with the JSTL? (I need the String representation of an enum as index in a map in a JSP EL expression.) I hoped something like ${''+object} would work like in java, but JSTL isn't that nice, and there does not seem to be any function that does it. Clarification: I have a variable somemap that maps Strings to Strings, and I have a variable someenum that is an enumeration. I'd like to do something like ${somemap[someenum.toString()]}. (Of course .toString() does not work, but what does?)

    Read the article

  • How to select the first element of a set with JSTL?

    - by Sergio del Amo
    I managed to do it with the next code but there must be an easier way. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:if test="${fn:length(attachments) > 0}"> <c:forEach var="attachment" items="${attachments}" varStatus="loopCount"> <c:if test="${loopCount.count eq 1}"> attachment.id </c:if> </c:forEach> </c:if>

    Read the article

  • any way to use ajax with jstl customtags without duplicating tags in javascript?

    - by CodeMonkeyB
    I am working on a page where part of the content is loaded normally and the pages are rendered using jsps. The product images and links generated on that page are by custom jstl tags. When the user scrolls more products are requested from the server in a JSON response and then using UnderscoreJS templates they are rendered and added to the bottom of the page. Is there any way I can use the JSTL tags in Javascript without recreating them using a javascript function (it won't be possible to re-create all of them in javascript). What is the best way to handle this scenario? I guess I could return a rendered html response for the ajax call, but that would mean I have some ajax requests which use json and some that use rendered html...

    Read the article

  • Spring 3 pet clinic example uses ${owner.new}, in the JSTL EL where can I read about out about .new

    - by Albert
    Spring 3 pet clinic example uses ${owner.new}, in the JSTL EL where can I find out more about where the .new comes from and what spec it is a part of? Ive seen empty and not empty operators/ reserved words but not .new until now in the Spring 3 pet clinic example.hers is the line im questioning: New Owner: located in the ownerForm.jsp file in the spring 3 pet clinic sample application.

    Read the article

  • jstl taglib not found, where have I gone wrong?

    - by James.Elsey
    I'm trying to add Google Maps onto my JSPs by using the googlemaps jstl taglib. I've added this into my maven pom <dependency> <groupId>com.lamatek</groupId> <artifactId>googlemaps</artifactId> <version>0.98c</version> <scope>provided<>/scope </dependency> This then included the googlemaps-0.98c library under my project libraries in NetBeans, I right clicked and selected Manually install artifact and located the googlemaps.jar file I had downloaded. I've then added this into my taglibs file <%@taglib prefix="googlemaps" uri="/WEB-INF/googlemaps" %> And have then included this where I actually want to show a map on my jsp <googlemaps:map id="map" width="250" height="300" version="2" type="STREET" zoom="12"> <googlemaps:key domain="localhost" key="xxxx"/> <googlemaps:point id="point1" address="74 Connors Lane" city="Elkton" state="MD" zipcode="21921" country="US"/> <googlemaps:marker id="marker1" point="point1"/> </googlemaps:map> But when I load up my application, I get the following error. org.apache.jasper.JasperException: /jsp/dashboard.jsp(1,1) /jsp/common/taglibs.jsp(6,56) PWC6117: File "/WEB-INF/googlemaps" not found root cause org.apache.jasper.JasperException: /jsp/common/taglibs.jsp(6,56) PWC6117: File "/WEB-INF/googlemaps" not found Have I missed something simple? I'm unable to spot what I've done wrong so far.. Thanks

    Read the article

  • How to use JSON response in the form of JSTL?

    - by HariKrishna
    I am getting JSON response,now i need to construct a table using this response.The table may be contain more than one record and i know one way of doing this is using Jstl tags but not JSON response.Here is my jsp code <div id="divHideAllergies" class="clone"> <div class="copy"> <div class="col-md-12"> <div class="portlet box carrot "> <div class="portlet-title"> <div class="caption"> <i class="fa fa-medkit"></i> Allergies </div> </div> <div class="portlet-body form"> <div class="form-body"> <div class="form-group"> <label class="control-label col-md-3">Allergy Type:</label> <div class="col-md-9"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-medkit"></i></span> <select class="form-control" id="allergy_type"> <option selected value="">--Select One--</option> <option value="Drug">Drug</option> <option value="Environmental">Environmental</option <option value="Food">Food</option> </select> </div> </div> </div> <div class="form-group"> <label class="control-label col-md-3">Allergic to:</label> <div class="col-md-9"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-medkit"></i></span> <input type="text" class="form-control" name="first name" id="allergy_to"/> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div>

    Read the article

  • JSTL <c:out> where the element name contains a space character...

    - by Shane
    I have an array of values being made available, but unfortunately some of the variable names include a space. I cannot work out how to simply output these in the page. I know I'm not explaining this well (I'm the JSP designer, not the Java coder) so hopefully this example will illustrate what I'm trying to do: <c:out value="${x}"/> outputs to the page (artificially wrapped) as: {width=96.0, orderedheight=160.0, instructions=TEST ONLY. This is a test., productId=10132, publication type=ns, name=John} I can output the name by using <c:out value="${x.name}"/> no problems. The issue is when I try to get the "publication type"... because it has a space, I can't seem to get <c:out> to display it. I have tried: <!-- error parsing custom action attribute: --> <c:out value="${x.publication type}"/> <!-- error occurred while evaluating custom action attribute: --> <c:out value="${x.publication+type}"/> <!-- error occurred while parsing custom action attribute: --> <c:out value="${x.'publication type'}"/> <!-- error occurred while parsing custom action attribute: --> <c:out value="${x.publication%20type}"/> I know the real solution is to get the variable names formatted correctly (ie: without spaces) but I can't get the code updated for quite a while. Can this be done? Any help greatly appreciated.

    Read the article

  • How do I do "nested if" in JSTL for Java JSP?

    - by user678616
    I want to do something like the following: <c:choose> <c:when test="${empty example1}"> </c:when> <c:otherwise> <c:when test="${empty example2}"> </c:when> <c:otherwise> </c:otherwise> </c:otherwise> </c:choose> Is this even possible? I get an exception thrown when trying to run. Thank you.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >