jsp

useBean tag

Hi, I'm really confused in the following two lines of Head First servlets & JSP book of page no. 349: The is a way of declaring and initializing the actual bean object you're using in . 2.Declare and intializea bean attribute with <jsp:useBean> <jsp:useBean id="person"class="foo.Person" scope="request"/> In the first line, why...

Can I use a JSP tag library with FreeMarker for a non-web context?

I was investigating FreeMarker (and also Velocity), and one of the things I liked about FreeMarker was that I could use it with my existing JSP tags. However, it's become my understanding that this will only work when using FreeMarker as a view for servlets. Is there a way to use these JSP tag libraries with either FreeMarker or Veloci...

JSP Display Tag Sorting Page Reload

Setup: I have a Struts web application where I use displaytag elements to do all of my table work. Each column is sortable. Situation: When I click sort, on a long page, it sorts, but drops you at the top of the page. Question: How do I use an anchor or some other method to come back to the table rather than the top of the page. Additio...

display tags jsp tags

i am using diaply tags library for displaying my tables.But i cant use the <% %> tagst there.If i try to us it it gives me error.but i can use tag there. If i try to use followin code in my jsp it give an error sayin shoul hav a matcheing ending tag. i have follown java code in jsp List<Course> = (List<Course>)request.getAattribute("c...

How to invoke main method of java program from a jsp?

Hi, I have a JSP from which I'm getting the input from the users. Now, I'd like to pass the input that get from this JSP as arguments to the main method of my java program and run the program from this JSP. Some help please! Thanks in advance! Ravilla ...

RequestDispatcher.forward loop

I am using <url-pattern>/*</url-pattern> to map all the requests to one sevlet,where i do all the authentication work. but I want to skip some static content (like css files).so I tried fowrding them from that sevlet to where the resource file is if(isResourceFile){ RequestDispatcher dispatcher = getServletContext().getRequestDi...

In JSP, how to identify the type of Object present in a List ?

Is it possible in JSP to get the type of Object in List, just like we do in Java myDataBind.getResultsList().get(0).getClass(); or is it possible to achieve something like this: if ( myDataBind.getResultsList().get(0) instanceOf MyClass ) { doThis; } i don't prefer scriptlets, but if it is not possible to do without scriptlets th...

How to check whether .dll is loading again?

Hi, i used .dll in JSP. In a first Jsp program i did a code to forward another JSP page. which again uses the same dll So my question is does that forwarded page again loads the library? Or it loaded once? i code System.loadlibrary("lib") in a separate class and created a object for that class in first JSP page and also in th...

Side effect--what's this?

Hi, Could anyone tell me the meaning of side effect in the following line: If you're calling an EL function that doesn't return anything, then you're calling it just for its side effects. many thanks in advance. ...

Using sqls in JSP - What is the best practice?

Say, You have an application which lists down users in your application. Ideally, if you were writing code to achieve this in Java, irrespective of what your UI layer is, I would think that you would write code which retrieves result set from the database and maps it to your application object. So, in this scenario, you are looking at yo...

Execute JSP directly from Java

Hi to all! I need to execute a JSP. But I need to directly from Java, without using Tomcat or any other servlet container. Compiling JSPs would be a good thing too, but not necessary. I think maybe org.apache.jasper package is good for doing this, but I can't find any good example or tutorial online. I need something as: Class compil...

Open an HttpURLConnection in a browser

I am working on a jsp page which uses a bean to create an OAuth authenticated HttpURLConnection and am able to connect successfully. Is there anyway that I can take that open HttpURLConnection and somehow display the contents in a browser window? ...

automativ thread starting in tomcat

i want a thread to start automaticalyy when my application on tmocat is started. How do i do that.Do i have to add something to web.xml?? ...

Problem in Custom tag in JSP

Hi i have a custom tag in JSP <dc:drawMultiSelect availableLabel='<%=request.getAttribute("availableCoreColumn").toString()%>' selectedLabel='<%=request.getAttribute("selectedCoreColumns").toString()%>' availableCName="selectCol" selectedCName="selectedCol" availableCId="select1" selectedCId="select2" sort...

Why window.print is printing all pages in IE but only one page in firefox?

I am having a JSP page, where i am dynamically creating a Table data. ( My page is having only table, and nothing else ). Number of rows in table can go upto 1000s. What i am doing is: after the complete page i have written <script> function printPage(){ window.print(); } </script> This code is working fine to print all pages ...

Can I find the URL for a spring mvc controller in the view layer?

I think what I need is called reverse url resolution in Django. Lets say I have an AddUserController that goes something like this: @Controller @RequestMapping("/create-user") public class AddUserController{ ... } What I want is some way to dynamically find the url to this controller or form a url with parameters to it from the view (...

<c:import> tag

Hi, I'm trying to import file from the Header.jsp in my file by using import tag url attribute, but I'm getting runtime error--java.io.FileNotFoundException: http://localhost:8081/latest/header.jsp The imported file and the importing file in the same web app(latest). The code of the importing file is: <%@ taglib prefix="c" uri="http:...

Working with html, css code in a JSP page

I am a web designer. As a team member of a web application project, I some times need to work on the jsp pages to modify html, css. I feel uncomfortable seeing the jsp tags which I don't understand. Did any member of this site gone through this kind of experience? If so how you manage to edit? Do you use a particular tool which highlight...

JSP EL and Scriptlets - How to Avoid mixing jstl and scriptlet vars

Accessing non-properties via jsp el In the code below, I need to access a method that is not a property. I need a c:foreach variable to be visible to be the test as well. I'm dealing with someone else's code. I'm not particularly happy with the design of it, but that's easy when dealing with someone else's code. I would prefer to ju...

How to compare substring of a bean property in JSTL 1.0?

I have the following code in a jsp page (Struts backed): <c:if test="${USERINFO.someproperty == 'test'}"> ... </c:if> But what I would like to do is compare only a substring of someproperty, like e.g. if the suffix ends with "st". I am using JSTL 1.0 so the endsWith() function from JSTL 1.1 is not available (as far as I know) and furt...