servlets

Tutorial for using spring beans in jsp pages

Hi guys, (I am not familar with technologies related to HTML delivery, like JSP... But I know basic concepts...) In my application I use Spring Beans and Spring Security together with Blaze DS to communicate with Flex applications over AMF protocol. Everything works just fine. Now I have a task to deliver some services via HTTP/HTML e...

How to encode a url in spring framework ?

greetings all I have a post method in a controller, which redirects to a new page I a way such like: @RequestMapping(method = RequestMethod.POST) public String post(HttpServletRequest request) { return "redirect:http://www.x.appName.com/myPage"; } suppose that the user already has a session before the redirection an...

Passing JSP encrypted parameters to frmservlet

I want to pass encrypted parameters via a JSP form to frmservlet.I want to pass userid by encrypting it.But it is not decrypt by the frmsrvlet,How can I do this? ...

Passing parameters from servlet to servlet using HTTP POST

How do I pass parameters from ServletOne to ServletTwo using a HTTP POST through URL intead of using HTTP GET in the servlet? For example: http://localhost/ServletOne?username=test If the above link is accessed, in ServletTwo, username test will be displayed. ...

How to create an war file in Eclipse without ant or maven?

I am using Eclipse IDE for Java Developers Helios. I have mainly done desktop applications before but now I would like to learn about Servlets. I have installed Jetty on my computer. And I wrote a simple Servlet in Java using Eclipse. But how do I compile it and export it to a war file in Eclipse? I have found some tutorials doing it wit...

How to get a list of all available servlets?

Is it possible to get a list of all available servlets in an app? I'm writing a web application that will expose a lot of servlets and I want to use HttpUnit to test each one to see if it is returning (or not!). As lot of it will return a simple XML response, it would be really helpful not to write a test case for each one, only verify...

problem with AJAX request

i hava created the ajax XMLHttpRequest request for getting the data dyanmically , here is the code var XMLHttpReq; function createXMLHttpRequest() { if (window.XMLHttpRequest) { XMLHttpReq = new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { if(XMLHttpReq==null) ...

action-servlet ?

Hi all, I'm new to Java WEB Development please help with this !! my link in the action-servlet is http://myproject.co.in:9090/a/userSignUp.action i got a new user registration page and i have given an action for the log in button.. but if i click the button its redirecting to this page .. please help and thank you for your tim...

java jsp type="image" value into servlet

I have this code in my jsp <div class="controls"> <input type="image" class="sprite submit-button button" name="SubmitChangeCreds" value="ChangeUIDSubmit" src="../images/layout/transparent.png" /> </div> In my servlet I am trying to get the value of this image like this request.getParameter("SubmitChangeCreds") But this is null...

how to remove all "\n" in JSP page? (use javax.servlet.Filter?)

i want remove all "\n" for JSP page output. i think i should be using a Filter for this. but i dont know how to do public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)throws IOException, ServletException { //how to remove all "\n" for output? } any idea? thanks for help :) ...

Using Tomcat to run Ant from a Servlet with Log4jListener and JDBCAppender to log into a database, not released when finished

I have a servlet that performs an ANT build, I've attached a org.apache.tools.ant.listener.Log4jListener as you can see below and at the end of the build the org.apache.tools.ant.listener.Log4jListener is not released, the only way I've found around this is to restart Tomcat. If I don't restart Tomcat the next time I try to run the buil...

Should a servlet container create new javax.servlet.http.HttpServlet instance for each incoming reqeust?

Hello, I have a class public class GAE_SERVLETREQUESTServlet extends HttpServlet { Not sure what the spec says about recycling of the HTTPServlet: Should the servlet container create new instance of this class on each incoming request or can the implementation reuse classes between requests? I'm investigating a funny issue where it s...

Java Servlets and HttpSessions

Hi! Very basic question. I have a portal containing several servlets, one of which takes care of logging in (but only as an admin). How do I use HttpSessions between Servlets to know if the admin is signed in? Thanks in advance! ...

Send image(jpg) via HttpPost from Android to Servlet(WebServer)

Hi guys, I have an image sitting on my SDcard (of type jpg) and I am trying to send the image via HttpPost to my servlet running on Apache Tomcat 7.0 So far I have google-ing the way to do this but I can't seem to find the perfect way. Do any of you might have some suggestion or solution to this problem? Thank you in advance, Sammy St...

Accessing SSL Private Key From a Servlet

I'm running Apache Tomcat locally and have installed a self signed certificate using OpenSSL. I also have a servlet running. What I want to do is the following: The servlet takes in POST parameters and will echo back the parameters signed using the PrivateKey of the server. That is, treat the input parameter as an integer and raise it ...

Getting ResponseText without calling servlet using xmlhttprequest in IE(Any version)

Hi, I'm using xmlhttprequest to call servlet. It is working fine in Firefox. But, in IE, only if I click refresh button, it is working(that too sometimes). Otherwise, it is not triggering. Moreover, the response text is displayed without calling the servlet. Is that using Cache or what? I don't have any idea . Help me out please. ...

How to convert UTF8 to unicode

Hi, I try to convert a UTF8 string to java unicode string. String question = request.getParameter("searchWord"); byte[] bytes = question.getBytes(); question = new String(bytes, "UTF-8"); The input are Chinese Characters and when I compare the hex code of each caracter it is the same Chinses character. So I'm pretty sure that the c...

Servlet exception in java

I imported a java project(war file) to eclipse. When I tried to run it , I got following error : java.lang.Error: Unresolved compilation problems: The type List is not generic; it cannot be parameterized with arguments <User> Syntax error, parameterized types are only available if source level is 5.0 I tried to google it. I found tha...

What JAR files are needed for Eclipse to use JSTL so it ultimately works on GAE/J?

I've been trying for longer than I'd like to admit to get JSTL working under Eclipse (and ultimately under GAE/J). I've downloaded Eclipse, the Google App Engine Extension for Eclipse, and JSTL (http://download.java.net/maven/1/jstl/jars/ - jstl-1.2.jar is in the WEB-INF\lib directory). My code is below along with the output: <%@ tagl...

How to return JSON from a servlet based on request parameters

How do I use JSON in java servlet? Using the URL, to pass parameters from a POST servlet, the JSON would respond based on the URL parameters. ...