jsp

How can I browse my Tomcat localhost from another computer on the network?

I'm an IIS guy and know its as simple as just using the http://[computername]/path to webapp.. however, I can't seem to figure out how to make this possible for a JSP application I'm writing that runs under Tomcat. Is there a configuration setting I need to set somewhere? ...

How do I submit multiple models in Struts 2?

I have a JSP that allows users to dynamically create additional form fields to create multiple objects. Perhaps I want to allow users to be able to submit as many line items as they want when submitting an invoice form. How do I create a Struts 2 Action that will be able to take in an ArrayList populated with objects created from those ...

How would you easily validate a JSP option pick list?

I need to validate this simple pick list: <select name="<%= key %>"> <option value="ETC" SELECTED>Select an option...</option> <option value="ONE">Lorem ipsum</option> <option value="TWO">dolor sit amet</option> </select> So the user would never submit the form with the, excuse the repetition, "Select an option..." option ...

Can I use a Hashtable in a unified EL expression on a c:forEach tag using JSF 1.2 with JSP 2.1?

I have a Hashtable<Integer, Sport> called sportMap and a list of sportIds (List<Integer> sportIds) from my backing bean. The Sport object has a List<String> equipmentList. Can I do the following using the unified EL to get the list of equipment for each sport? <h:dataTable value="#{bean.sportIds}" var="_sportId" > <c:forEach items=...

How to output HTML from JSP <%! ... %> block?

I just started learning JSP technology, and came across a wall. How do you output HTML from a method in <%! ... %> JSP declaration block? This doesn't work: <%! void someOutput() { out.println("Some Output"); } %> ... <% someOutput(); %> Server says there's no out. U: I do know how to rewrite code with this method returning a ...

web-inf and jsp page directives

i have a number of jsp files under web-inf folder. Inside my web.xml i specify an errorppage for 404 amd 403 and java.lang.exception. Do i need to include a page directive for each of my jsp's or will they automatically get forwarded to the exception handling page because they are under web-inf? If this is true does this mean that jsps ...

iterating over Enum constants in JSP

Hi, I have an Enum like this package com.example; public enum CoverageEnum { COUNTRY, REGIONAL, COUNTY } I would like to iterate over these constants in JSP without using scriptlet code. I know I can do it with scriptlet code like this: <c:forEach var="type" items="<%= com.example.CoverageEnum.values() %>"> ${type}...

What is the default session timeout for a Java EE website?

If I do not specify the following in my web.xml file: <session-config> <session-timeout>600</session-timeout> </session-config> What will be my default session timeout? (I am running Tomcat 6.0) ...

Eclipse Ganymede not validating JSPs properly

I just installed Ganymede and am exploring an old project in it. All of my JSPs are giving me weird validation errors. I'm seeing stuff like - Syntax error on token "}", delete this token Syntax error on token "catch", Identifier expected Syntax error, insert "Finally" to complete TryStatement I'm doing best practice stuff here, no s...

What is the best way to set-up authentication in a tomcat webapp?

I have a self built JSP webapp and at the moment I'm using tomcats built in admin pannel to manage user accounts (that are stored in tomcats config xml files) but this is limited because i can not create new accounts from within the web-app (eg. I can not have a sign up website) and need to manually create the accounts. What is the mos...

what's the fundamental difference between a jsp taglib vs including a jsp page?

i have several common elements (components), that will generate some html. it seems my options are creating a taglib, or just putting that logic into a jsp page and including the jsp. whats the difference? positives vs negatives? ...

Issues working with JSF redirect and WebTrends

On our new platform we are utilizing JSF. Our WebTrends tags are not reflecting the proper page title on this platform. It currently is displaying the name of the users previous page instead of the current page. We are making use of the JSF Navigation rule in which we have some "< redirect />" tags. Has anyone experienced this and is...

jsp create scripting variable like jsp:usebean does

I would like to do something like <test:di id="someService" /`> <% someService.methodCall(); %> where <test:di gets and instantiates a service bean and creates a scripting variable for use. similar to how jsp:usebean works for example <jsp:useBean id="someDate" class="java.util.Date" /> <% someDate.g...

Conditionally set an attribute on an element with JSP Documents (JSPX)

In HTML forms, buttons can be disabled by defining the "disabled" attribute on them, with any value: <button name="btn1" disabled="disabled">Hello</button> If a button is to be enabled, the attribute should not exist as there is no defined value that the disabled attribute can be set to that would leave the button enabled. This is ca...

How do I prepend <%= request.getContextPath() %> to all relative URLs inside a jsp page?

The subject says it all, almost. How do I automatically fix jsp pages so that relative URLs are mapped to the context path instead of the server root? That is, given for example <link rel="stylesheet" type="text/css" href="/css/style.css" /> how do I set-up things in a way that maps the css to my-server/my-context/css/style.css instea...

How do you restrict the size of a file being uploaded with JavaScript (or Java) without transferring the entire file?

Is there a way to validate on the client side browser whether the size of a file being uploaded from a JSP page is over a set size limit without forcing the user to upload the entire file only to find out it was too large? I would like to stay away from any proprietary controls or techniques like Flash or ActiveX if possible. Thanks! ...

Howto deactivate caching inside a jsp page

I understand there is a HTTP response header directive to disable page caching: Cache-Control:no-cache I can modify the header by "hand": <%response.addHeader("Cache-Control","no-cache");%> But is there a "nice" way to make the JSP interpreter return this header line in the server response? (I checked the <%@page ...%> directive....

How to merge jsp pre-compiled web.xml fragment with main web.xml using Ant

We have the usual web.xml for our web application which includes some jsp and jsp tag files. I want to switch to using pre-compiled jsp's. I have the pre-compilation happening in the build ok, and it generates the web.xml fragment and now I want to merge the fragment into the main web.xml. Is there an include type directive for web.xm...

How to know if a jsp tag attribute is available for EL ?

I have the following piece of code in my jsp : <% pageContext.setAttribute("warnings",Globals.WARNING_MESSAGES); %> <c:choose> <c:when test="${requestScope[pageScope.warnings] or sessionScope[pageScope.warnings]}"> <html:errors header="warnings.header" footer="warnings.footer" prefix="warnings.prefix" suffix="warnings.suffix"/>...

Enum inside a JSP

Is there a way to use Enum values inside a JSP without using scriptlets. e.g. package com.example; public enum Direction { ASC, DESC } so in the JSP I want to do something like this <c:if test="${foo.direction ==<% com.example.Direction.ASC %>}">... ...