jsp-tags

Spring 3 @NumberFormat not working with form:input Tag

≯℡__Kan透↙ 提交于 2019-12-06 09:51:40
I have a Spring 3 MVC app utilizing <mvc:annotation-driven /> . Having trouble getting a java.lang.Double property to display as currency in a <form:input> tag. The amount shows correctly, but no formatting applied. Any guidance? Spring config: <mvc:annotation-driven conversion-service="conversionService"> <mvc:argument-resolvers> <bean class="com.my.SessionUserHandlerMethodArgumentResolver"/> </mvc:argument-resolvers> </mvc:annotation-driven> <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean"> <property name="converters"> <list> <bean class=

Spring form:select multiple selected value?

杀马特。学长 韩版系。学妹 提交于 2019-12-06 09:33:47
I have this edit form: I want that the roles of the user get selected. If this were one-to-many relation I know that I can do something like this: <form:label path="roles">Roles:</form:label> <form:select multiple="true" path="roles"> <c:forEach items="${roles}" var="rol"> <c:choose> <c:when test="${usuarioEdit.rol.id ==rol.id}"> <option value="${rol.id}" selected="selected">${rol.nombre}</option> </c:when> <c:otherwise> <option value="${rol.id}">${rol.nombre}</option> </c:otherwise> </c:choose> </c:forEach> </form:select> <form:errors cssStyle="color:red" path="roles"></form:errors> But this

How to get full URL in JSP

跟風遠走 提交于 2019-12-06 06:27:17
问题 How would I get the full URL of a JSP page. For example the URL might be http://www.example.com/news.do/?language=nl&country=NL If I do things like the following I always get news.jsp and not .do out.print(request.getServletPath()); out.print(request.getRequestURI()); out.print(request.getRequest()); out.print(request.getContextPath()); 回答1: Given URL = http:/localhost:8080/sample/url.jsp?id1=something&id2=something&id3=something request.getQueryString(); it returns id1=something&id2

How to load Html page which is outside application context using JSP include or c:import or symlink

六眼飞鱼酱① 提交于 2019-12-06 05:10:11
I need to load some html pages created dynamically by some other application into my application jsp page using jsp include tag <jsp:include page="${Htmlpath}" /> OR <jsp:include page="D:\MySharedHTML\test.html" /> . My idea is to have a shared folder on server like "MySharedHTML" and let other application create html files there and my app will access by giving full path. But jsp include is saying "requested resource D:\MySharedHTML\test.html is not available". Any inputs how to do it. Thanks In Advance. It has to be available by an URL. The D:\MySharedHTML\test.html is very definitely not a

i18n translation in JSP custom tag

走远了吗. 提交于 2019-12-06 04:36:32
Is it possible to write a custom JSP tag to take an i18n message key and output the translation phrase for the given request? Normally in JSP/JSTL, I do: <fmt:message key="${messageKey}"><fmt:param>arg1</fmt:param></fmt:message> And I get the translation phrase. Now I need to do the following (there's a good reason for this): <custom:translate key="${messageKey}" arg="arg1"/> But I don't know how to look up the translation in the custom tag code. The TagSupport base class provides a pageContext from which I can get a ServletRequest which has the Locale... but how do I then look up the

Effective way to handle singular/plural word based on some collection size [closed]

风流意气都作罢 提交于 2019-12-05 11:15:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . There are many instances in my work projects where I need to display the size of some collection in a sentence. For example, if the collection's size is 5, it will say "5 users". If it is size of 1 or 0, it will say "1 user" or "0 user". Right now, I'm doing it with if-else statements to determine whether to

JSP - Can I use <jsp:attribute> inside <c:if>? Exception: “Must use jsp:body to specify tag body”

一曲冷凌霜 提交于 2019-12-05 06:58:14
I have the following inside a JSP: <c:if test="${true}"> <jsp:attribute name="extraInlineComplianceJavascript"> window.isSummaryComplianceLinkVisible = '${TabList.isSummaryComplianceLinkVisible}'; window.isDetailComplianceLinkVisible = '${TabList.isDetailComplianceLinkVisible}'; window.complianceSummaryReportTag = '${helper.complianceSummaryReportTag}'; window.complianceDetailReportTag = '${helper.complianceReportTag}'; </jsp:attribute> </c:if> As is, I get the following exception: Must use jsp:body to specify tag body for <MyTag if jsp:attribute is used. If I remove the outermost <c:if> tags,

Jsp tags outside WEB-INF/tags

痞子三分冷 提交于 2019-12-05 05:38:55
Is there any way to hold tag files out of /WEB-INF/tags folder? Maybe by using tld somehow and calling them with uri instead of tagdir? Reason for this request is that we are trying to run several sites from one codebase and we would like to have it like WEB-INF/site1/templates, tags, ... so if this is wrong idea to begin with, feel free to say so. Apparently not: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags6.html even if using tld to say where the tag is, it can be either in WEB-INF/tags or META-INF/tags for tags packed in jars. The standard way to deliver taglib is to pack all your

How to implement a “include” jsp tag?

穿精又带淫゛_ 提交于 2019-12-05 04:42:06
问题 I need to define a jsp tag which named "include". It should be used as: <cms:include page="/aaa.jsp" /> It has an attribute page which points to another jsp, and it will include the content of that jsp and render it. Is there any existing tag lib can do this? Or please give me some advises of implementing it, thanks! UPDATE From Ramesh PVK's answer, I know there is a standard <jsp:include> fit my need. But per my project's requirements, I can use the name jsp:include , but cms:include . I've

JSP tag file that either outputs its body or returns it in a variable

南笙酒味 提交于 2019-12-05 03:07:36
I have a custom tag in a ".tag" file that computes and outputs a value. Because I cannot post the code here, let's assume a simple example. Content of file mytag.tag: <@tag dynamic-attributes="dynamicParameters"> <%@attribute name="key" required="true"%> <%-- this works fine, in spite of dynamic-attributes --%> <jsp:doBody var="bodyContent/"> <%-- ... here is some code to compute the value of variable "output" --%> ${output} The caller can easily call it like this: <prefix:mytag key="foo">Body content...</prefix:mytag> This will insert the output of the tag. But I would also enable the caller