jsp

How to call a java method from a jsp when a html element is clicked?

As title says, how do I call a java class method from a jsp, when certain element is clicked (by example an anchor)? (Without reloading the page) If this can be done, how I pass the method, some part of the html code of the page that invokes it? Im using jsp, servlets, javascript, struts2 and java, over Jboss AS. ...

How to transfer java array to javaScript array using jsp?

Hello all, I have a list of strings on my server which I am trying to get to the client in the form of an array. The code I am attempting to use is the following: Within the jsp I have a List<String> columns. I am attempting the following code: <%int j = 0; %> for(var i = 0; i < <%=columns.size()%>; i++) {   colArray[i] = "<%=column...

Is it OK to have two frameworks in the same project?

So I have taken over a Java Web project. The application was written by another developer who now works for another company. Generally speaking, the application is straightforward, well designed and the code is documented enough. The only issue is that the previous developer decided to built his own database access library instead of usi...

getting boolean properties from objects in jsp el

Hello, I have an instance of the following object in the jsp page context: Class User{ private boolean isAdmin; public boolean isAdmin(){return isAdmin} } How can I query the isAdmin property from the EL? This doesn't seem to work: ${user.admin} nor does this: ${user.isAdmin} thanks! -Morgan ...

URL routing and relative links in Tomcat 5.5

I'm trying to add URL routing to a web application running in Tomcat 5.5. I want to make the dynamic page URLs more friendly, changing main.jsp?type=test&group=info to main/test/info as is all the rage. I have set up the following in the web.xml <servlet> <servlet-name>main</servlet-name> <jsp-file>/main.jsp</jsp-file> </s...

Is it possible to have sessions with in Web Session.

Hi, I am developing an application where I need to support multiple instances of browser on same machine but with different user logins ! As far as if we open two different IE process instances, there will be different sessions on server side but same is not the case for Firefox (correct me if I am wrong). So is there any way I can some...

JSP -- default value for EL functions arguments

Is there a way to have default values for EL functions arguments (e.g., optional arguments)? ...

how to save the generated xml file using jsp?

hi i have generated xml file using jsp,but i want the generated xml file should be saved as a file. my code is <?xml version="1.0" encoding="UTF-8"?> <%@ page contentType="text/xml;charset=ISO-8859-1" %> <playlist version="1" xmlns = "http://xspf.org/ns/0/"&gt; <title>My Band Rocks Your Socks</title> <trackList> <%! S...

Apache Tomcat precompile JSPs before first request

Is there any option in Apache Tomcat Web Server, to compile the JSPs in a WAR at deploy time, instead of the first request instance. So that, when a user requests it for the first time he should not get a performance lag. We are using Apache Tomcat 5 ...

How to create a xml file at a particular location from the output generated from jsp page.

sports.jsp: <?xml version="1.0" encoding="UTF-8"?> <%@ page contentType="text/xml;charset=ISO-8859-1" %> <% response.setHeader("Content-Disposition", "attachment; filename=\"playlist.xml\""); %> <playlist version="1" xmlns = "http://xspf.org/ns/0/"&gt; <title>My Band Rocks Your Socks</title> <trackList> <%! String[] sports; %>...

please tell me where i made error in this jsp program..

<%@ page import="java.io.*" %> <%-- <%@ page contentType="text/html;charset=ISO-8859-1" %> --%> <% int iLf = 10; char cLf = (char)iLf; File outputFile = new File(generate.xml); outputFile.createNewFile(); FileWriter outfile = new FileWriter(outputFile); outfile.write(" <?xml version='1.0' encoding='UTF-8'?> "+cLf); outfile.write(" <playl...

Can include a jsp in a custom TagSupport class, and specify where the body should go?

I want to use custom jsp tags to help build a menu in my application. However, I want all the actual HTML to live in JSP files, rather than in the Java class. So, suppose I have a tag like this: <mytags:Menu> <mytags:MenuItem name="foo"/> <mytags:MenuItem name="bar"/> <mytags:MenuItem name="baz"/> </mytags:Menu> I then might h...

How can I give EL expressions as parameters in nested jsp 2.0 tags?

I want to do something like this to call a JSP 2.0 tag: <mytags:foo abc="<%=def%>"> <mytags:bar ghi="<%=jkl%>"/> </mytags:foo> Where Strings def and jkl are defined earielr in the jsp file. Suppose my tag files look like this: foo.tag: <%@ tag body-content="scriptless" %> <%@ attribute name="abc" required="true" %> <div class="${...

Deferred EL in JSP 2.0

Is there a way to use something like deferred EL in JSP 2.0 / J2EE 1.4? The idea is to pass a test to a tag file and have it display an item in a list (or not) based on the value of the expression. Basically, I'd like to do something like this: JSP: <x:myTag items="${myCollection}" test="${item.visible}"/> myTag.tag <c:forEach var...

How to Overwrite the file saved in the Context Directory...

I created two files 1)index.html 2)player.jsp I am using Tomcat Server. In the index.html i created some checkboxes in a form and assigned the values... After clicking submit i forwarded these values to player.jsp... In player.jsp i dynamically generated an xml file named "generate.xml" . This XML file changes according to the user requ...

Why does getRealPath() return null when deployed with a .war file?

Hi, getRealPath() is returning the actual path in the local system, but returns null when deployed with a .war file. <%@ page import="java.io.*" %> <%@ page contentType="text/html;charset=ISO-8859-1" %> <% int iLf = 10; char cLf = (char)iLf; String a= application.getResource("/"); //String myfile = application.getRealPath("/")+ "gener...

Does the Eclipse Web Tools Project handle refactoring inside JSPs?

I've installed the Web Tools Project for Eclipse version 3.4. I've been trying to get refactoring working the way I think it should and have had no success. I have one Java project that contains the Java classes for the jar that is put into the /WEB-INF/lib for a web site. Another project (a Dynamic Web project) has the JSP files for ...

How to get the path of the context directory in jsp and how can i overwrite it for every new request..

Hi i am getting path of the context directory in my local system using.. String myfile = application.getRealPath("/"); but the method getRealPath("/") is returning null when application is deployed in war file in www.eatj.com.. can any one provide me possible solution and sample code please... The purpose is i have to create a xml fil...

Editing xhtml jsp files in Eclipse

I've got some jsp files that are supposed to output xhtml. They seem to have the correct doctype etc but Eclipse is not parsing the xhtml attributes. For instance for the root element: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> I get the warning: "Undefined attribute name (xmlns)." What's the best way to solve...

JSP - Saving a collection

[Warning] I'm new to JSP/Struts/JSTL. This is probably a newbie question :) I have a form that contains a collection: public class ServiceForm extends AbstractForm { private List<SrvDO> allSrv = new ArrayList<SrvDO> (); } I can see the object data correctly in my form using the JSP. The page displays 5 input box with the dat...