jsp

JSP Validating and Redirecting: how to validate forn input and forward the errors back to the original page?

I'm taking a class on JSP and I have an assignment... we have to write a JSP page that takes user input, validate the input and then forward it to a different web site. To be more precise, we were asked to implement a rudimentary version of the FareFinder functionality of Amtrak's web site. There are 2 main purposes to this assignment:...

How can I use a JSP to create a dynamic Javascript file?

I'm using a Jboss5/Spring/Struts implementation, and I'm not familiar enough with JSP technology to know how to do this. Is this even possible? ...

How can I add or change params to a struts url tag?

In struts, I'd like to have a base URL (an <s:url...) set up with a some parameters (<s:param...), and then either add parameters to that URL or change the values of some parameters. For example: <s:url action="getSomeData" id="baseDataUrl"> <s:param name="someID" value="%{currentID}"/> </s:url> I can then do <s:property value="...

Get full url and split into an array with JSP/ASP

In PHP/Apache I can get the full url and cut it up into parts like this URL: mysite.com/friends/enemies-cats/ Then using PHP explode function I can split the URL by the "/" into an array. Array[0] = 'friends'; Array[1] = 'enemies-cats'; I wonder, is it possible to do the same thing on a Java server. I am hoping the same thing could ...

Redirect from missing page to new one

Hi I am upgrading a site, moving from Notes to Java JSP's and need to support a redirect from the old url's to the new ones. So /site/oldpage.nsf?home needs to redirect to /site/newpage.jsp. In Tomcat I've set up an error-page to redirect: 404 /avi_redirect.jsp in the avi_redirect.jsp I have : pageContext.f...

email integration along with struts

Is there anything similar to freemarker that can be used along with struts. ...

How can I produce a select tag using JSTL or Standard Actions in a JSP

I want to make a select tag in a JSP, where the options are an Enumeration (for example, all US States). Is their a tag in JSTL or a standard tag that can do this, without manually iterating through the list? ...

tomcat 5.5 setting up context path with virtual hosts (non webapps directory)

Hi. I have been a web developer for a couple of years (some ASP, mostly PHP) and have recently taken on Java/JSP in the last two years. The one thing I have tried repeatedly but continue to fail to wrap my head around is the way to setup a working JSP application in another location that is NOT the webapps folder. Rocking my applicati...

Is there a generic refernce to the active form in Struts for a JSP?

Hi All, I'm using struts 1.3.10 In JSP I can reference an object from the form that's associated with the action. So I can have: <bean:define id="someObject" name="myCurrentActionForm" property="someObject"/> Where I have my form defined in struts-config.xml. In my case above "someObject" is actually defined in the base class that m...

Can I access the values of an enum class from a JSP using EL?

I have an enum class USState. I would like to iterate through the states in a JSP. Is it possible to access a list of USStates without first setting such a list as an attribute? It seems that something as static as an enum should always be available, but I can't figure out how to do it. Here's what I'm looking for: (except working) ...

Set attribute into JSP PageContext for use in EL from a Filter

How can I put an attribute into the JSP PageContext for the current request (so that it becomes accessible via ${myVar} ) from a Filter that runs before the JSP? ...

How to determine which JSP pages are being rendered?

I'm working on a legacy application that is using simple JSPs that are nested using <jsp:include>. No frameworks are being used - just JSP Servlets and filters. Can anyone suggest a way to trace which JSP pages are being rendered? Perhaps there's a log, or maybe a hook in the rendering engine (Jasper). ...

Getting DataSource resource in a Java web app

I have the following resource tag in my context.xml file: <?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/myApp"> <Resource name="jdbc/myDS" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="1000" username="user" password="passwd" driverClassName="com.mysql.jdb...

Analog of PHP "MAX_FILE_SIZE" param for JSP

Is there analog of PHP "MAX_FILE_SIZE" parameter for JSP? It's needed to perform validation on UI before upload process triggered on backend. ...

How to handle back browser button problem using spring?

How to handle back browser button problem using spring?. In my application user login properly and when user click on back button page state is not maintained. So do i maintain the page state even the user click on back button / forward button Thanks ...

Javascript to set focus in a framed page

Hi, I have a page with frame in it, the left side being a jsf form and right side is an applet. The actions on the jsf form on the left cause the applet to refresh from time to time (e.g on a button press on form). The problem is that since the jsf page renders before the applet finishes it's refresh, the applet steals the focus from t...

Calling a servlet from a form but the servlet is never invoked

I am trying to call a Servlet called AddClass.java using the following line in a jsp <form method="post" name="addClass" action="AddClass.do"> The class is in package web and the filename is AddClass.java A similar servlet named SeedSearch is called (and everything works fine) from this piece of code in another jsp. <form method="po...

tools,plugins or api's for monitoring java web applications

hi all, I have developed a web application in java,i want to monitor the web application.I have used jconsole, but it monitors only java application.I heard about jmon could u tel me how to use jmon or any other tools or plugins are there for monitoring web applications.All your views are appreciated. ...

How can I access Java list elements from my client-side JavaScript code?

I have the following simple script, which I am using to dynamically create the list elements in a <ul> <script type="text/javascript"> function generate(){ var arr = new Array(); <c:forEach items="${articles}" var="a" varStatus="status"> $('#listitems').append( "<li>"+${a.title}+"</li>" ...

How to pass an object from Spring 3.0 controller to JSP view and test with JSTL

First I have a Spring 3.0 controller with a method similar to the following. I'm passing the view an object named "message" and hoping to print that message via the view if it has been set by the "doStuff" method. @RequestMapping("/index") public ModelAndView doStuff() { ModelAndView mav = new ModelAndView(); Map<String, String...