Win a copy of Rust Web Development this week in the Other Languages forum!

Anjali Raman

Ranch Hand
+ Follow
since Nov 28, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anjali Raman

I had my JSPs under the WEB-INF folders. I am trying this other way now to make sure that index.html submit is calling the servlet. Will keep you posted if I see anything odd, but I am quite sure that my servlet is not invoked at all.
9 years ago
JSP
Bear, can you please guide me with just one thing here.
Am I supposed to provide the servlet URL or the result.jsp URL in the form action of the HTML page?
9 years ago
JSP
That's right. I too am not able to figure out what am I doing wrong with such a simple example.
Somehow I have this vague feeling that the request is not going to the servlet code, where it was supposed to set the Attribute.

I have gone over the program for 20 times and unable to figure out the problem. Its so frustrating...

Thanks Bear for all the time that you have taken on looking into this.
9 years ago
JSP
I am using the URL of HTML in the browser.(I hope i got your question right). The HTML has the form action pointing to the servlet /HelloController.
9 years ago
JSP
I am sorry for that, I had deleted all the files and tried it all over again. And eclipse by default had the constructor there that I forgot to remove as what you had suggested.

I added the import just to check if it would make any difference, but obviously it was an unnecessary line of code there. I removed it.

I have made changes as per your earlier comments.

I run the index.html from eclipse directly using Run As --> Run on Server, which opens the "http://localhost/ServletsDemo/index.html" and I enter the name "Fred" in the textbox, and on submitting it takes me to "http://localhost/ServletsDemo/result.jsp", where in the text "Hello Bingo null" is shown.

I have attached the screenshot of the directory Structure.
9 years ago
JSP
Thanks Bear for replying back... Here is the code

index.html


HelloController.java


result.jsp
9 years ago
JSP
But then why is it that I am getting "null" instead of "Fred" or any name that I would provide in the "Name" field of the HTML.

I have drilled my brain quite a lot on this. I would appreciate some help
9 years ago
JSP
Thanks Bear for the answer.

I know that we should not be using the scriptlets, but I was just attempting some of the examples in the book in preparation for SCJWD.

And i wanted to know what was I doing wrong that I wasnt getting the answer shown in the screenshot in the book.(the one I have also attached)

And yes it works with request.getParameter i have tested that.
9 years ago
JSP
Did it and still no luck.

Gives me "Hello Bingo null"
9 years ago
JSP
Thanks Seetharaman for the reply, and yes I forgot to insert the line
request.setAttribute("name", name);

But from the example that I see in the book, I should be able to do
<%=request.getAttribute("name") %> and the name entered in the HTML page should be displayed as it is saved to the request when we did request.setAttribute("name", name) in the servlet.

So I want to know what is that I am doing wrong by using getAttribute and setAttribute, I am sure that it would work in case I used getParameter, but thats not what I want.
I am attempting the example shown in Page 345 of Head First Servlets and JSP.
9 years ago
JSP
Hi Ranchers,

I am trying to execute a simple example from HeadFirst servlets and JSPs and running into a problem.
I have tried to resolve the issue in multiple ways but looks like I amm ending up nowhere.
Need your help on this.


Code in index.html


Code in HelloController.java my servlet class


Code in the forwarded page result.jsp


web.xml


When i try to call the index.html from the browser it gives me the page with a text box where in I enter "Fred" and click on "Submit"
I should be getting "Hello Bingo Fred" instead I get "Hello Bingo null", so it is quite sure that the attribute is not being set.
But what is the reason I am unable to narrow down on. Can you please help me with it. I know I am doing some kind of a silly error somewhere but unable to track it.

and by the way I even changed it to form action="result.jsp", yet there was no change..

Please please help...

Thanks
Anjali
9 years ago
JSP
The daily tale of a Software Professional
9 years ago
Thanks for the reply Ulf.
But I am hopeful that there could be someone who has actually faced this issue and implemented this as it seems to be a generic problem with all who use iText APIs.
Hello to all the Ranchers,

I see to be hitting my head onto a problem for which I am not getting a solution over the net. So I seek help from you.

My program was to populate a PDF with values and return the form using iText.
I was able to do this and things were going fine. It was later decided that the form has to be made editable after the values are populated using iText.
This part I am unable to do.

I have tried using the PDFStamper.partialFormFlattening() along with the stamper.setFormFlattening(true) with not much success.

Many have enquired for this same issue and I do not see any concrete answers coming in.

Below is a section of the sample code. I was able to partially populate the PDF but then the PDF was uneditable. I want it to be editable



Any help regarding is greatly appreciated.

Thanks
Anjali
Thanks a lot for that clarification. I now see what you mean.
9 years ago