jsp-tags

Java generics: get class of generic method's return type

家住魔仙堡 提交于 2019-12-17 11:21:14
问题 Background I once wrote this method: private <T> SortedSet<T> createSortedSet() { return new TreeSet<T>(); } It's supposed to be called like this: Set<String> set = createSortedSet(); This works fine (although I've seen in answers here when researching the current question that this is error-prone). The current situation Anyway, now I am writing the following code (in a class that extends javax.servlet.jsp.tagext.TagSupport): private <T> T evaluate(String expression) { ExpressionEvaluator

Can not find the tag library descriptor of springframework

本小妞迷上赌 提交于 2019-12-17 07:27:37
问题 I'm trying to follow the example of spring JPetStore but I get an error in the JSP pages in the line that references the lib tag spring: Can not find the tag library descriptor for "http://www.springframework.org/tags" <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> What is the URL of this library? Is there any way to avoid the direct dependence on this URL? Thanks in advance 回答1: Download the Spring dependency jar Place it to the lib folder path is /WEB-INF/lib/spring

Struts2 .action extension causing CSS, JavaScript and Struts Dojo to break

本秂侑毒 提交于 2019-12-17 05:13:20
问题 We have been running on Struts 2.1.8 for some time and all Struts actions have been working as expected, i.e. href's to the Struts actions are rendered with the action name with no extension. Here is the JSP code that set's up the links: <ul id="top_menu"> <li id="itemHome" class="active"><s:a action="viewHome">Home</s:a></li> <li><s:a action="viewSearch">Search</s:a></li> <li><s:a action="viewBookMarks">My Bookmarks</s:a></li> <li><s:a action="viewSupport">Support</s:a></li> </ul> The links

JSP/JSTL: '2 > 10' Evaluates to true

孤街醉人 提交于 2019-12-13 18:09:28
问题 I have a very simple custom JSP tag that I am using to generate pagination links. It goes roughly like: <span id="${id}" class="paginationLinks ${cssClass}"> <c:if test="${currentPage gt 1}"> <!-- Links to previous page(s) --> </c:if> <span class="paginationCurrentPage"> Page ${currentPage} [DEBUG: current=${currentPage}, total=${totalPages}, show=${currentPage lt totalPages} inverse=${currentPage gt totalPages}] </span> <c:if test="${currentPage lt totalPages}"> <!-- Links to next page(s) --

how to set default location in browse tag

浪尽此生 提交于 2019-12-13 17:40:26
问题 Am doing project in j2ee.I use Browse button. I need to fetch images/files from a folder inside my project folder, everytime.I wish to set my project's folder name as a default location for my browse button.How to do that? am using tis following code in a jsp page: and calling the value in servlet : String image= (String) request.getParameter("img"); while browsing ,the whole path is getting displayed but only the name of the image is passing as value in the sevlet.How to get the entire path?

javascript to jsp

空扰寡人 提交于 2019-12-13 08:27:00
问题 How to show a javascript 'var' in my jsp? ... <script type="text/javascript"> ... // My code to get the value. var val = combo.getValue(); </script> <body> The value is : //to be displayed here </body> 回答1: Add a HTML element which should mark the place where the value is to be displayed and give it an id . <body> The value is : <span id="value"></span> </body> Then let your JS access it by document.getElementById() and modify its inner HTML. document.getElementById("value").innerHTML = val;

JSP importing java class in Openshift

℡╲_俬逩灬. 提交于 2019-12-13 07:50:42
问题 I made a java web project in Eclipse and it works great (with jsp, servlets, and java classes). Now I'm trying to make it live. I decided to host it on Openshift which provides its own file structure. I've tried copying my files over and it works for the most part. The problem is my import tags don't seem to work and it doesn't find my classes (such as databaseInteractor which fetches information from my database to be displayed). This might be a path issue but I'm not sure. This is what I

Java Code inside JSP: How to put double quotes

非 Y 不嫁゛ 提交于 2019-12-13 05:18:14
问题 Our legacy code use Java directly inside JSP. I cannot use EL. I got a problem here: <jbo:DataSource id="dsyn" appid="AM_Quebec" viewobject="YesnoView1" whereclause='<%="yesno.yn_lang="+locale%>'> For the whereclause, what I really want is like this: String yesno_wc = "yesno.yn_lang='" + locale + "'"; Anybody knows how to put the yesno_wc in the where clause? Thanks 回答1: In Java you can escape double quotes with a backslash. I might first store that value, here is an example JSP storing the

how to show processing status of transaction or work at server side in a browser for end user?

左心房为你撑大大i 提交于 2019-12-13 04:46:23
问题 ____ ----- > 60% completed the above type of some processing status i want to show the user in a web browser when these is some transaction is going. For example im creating some tables say 1000 show i do not want to get disturb by user when some thing is going on. so for that i need to show user the status ( no. of tables created so far on the browser in a gui manner) . give me some idea to do that. in advance for ur comments and answers. Note : while copying some data , we can see these

Initial value to textarea field in form tld

强颜欢笑 提交于 2019-12-13 04:24:46
问题 I am using spring mvc and in my jsp page I have a form with textarea. I want the textarea to be pre filled with some text (it is an edit feature for article). I tried the following. <form:textarea id="description" path="article.description" value="${article.description}" onKeyUp="validationmethod($(this));" onKeyDown="validationmethod($(this));" /> But my textarea is still empty.. the value="" attribute works perfectly fine for <form:input> but not for text area. if i try to put it betweeen