There's no need to map the tld in the web.xml. The container (or at least most containers) automatically search for tlds inside jar files inside the lib folder, so if the struts library files are in the lib folder, then the container will automatically map the URI to the tld...

While trying the code, I discovered 5 errors that I had to resolve to get the code working. Those errors are as follows -

1- As I can see from your struts-config.xml you are using struts 1.3. The first mistake was in your form.jsp where you gave wrong uri="http://jakarta.apache.org/struts/tags-html". The correct one is -uri="http://struts.apache.org/tags-html"

2- In struts-config.xml , to represent action mapping you used opening tag <action-mapping> which is wrong, it should be <action-mappings>.

3- You gave the type in action as com.example.web.BeerSelection while your action class is BeerSelectionAction.

4- In form.jsp while submitting you selection action as "/select/SelectBeer.do" while there is no mapping in struts-config.xml for "/select/SelectBeer". I believe, you should have made only "/SelectBeer" as type in struts-config.xml.

5- In web.xml you had given servlet init parameter at completely wrong place. This comes under servlet tag

I corrected all those error at my end. Now it is working perfectly fine here. The corresponding code files are as attached below -

Form.jsp

Struts-config.xml

Web.xml

result.jsp

BeerSelectionAction.java

BeerSelectionForm .java

I hope, this would solve all your doubts and would give you a working example.

Regards
Salil Verma

Anil Deshpande
Ranch Hand

Joined: Jan 13, 2008
Posts: 119

posted Oct 15, 2009 02:06:17

0

Thanks for the comprehensive reply. I have not yet checked the code to verify it. But I am so happy with this replay I couldn't stop myself from replaying as a token of appreciation.

As soon as I will get time I will verify he code and respond with certain clarifications.

Thanks a lot

Anil Deshpande
Ranch Hand

Joined: Jan 13, 2008
Posts: 119

posted Oct 15, 2009 04:09:16

0

I did execute the code. And thanks once again. Did help me to clarify the mistakes.

Anil Deshpande
Ranch Hand

Joined: Jan 13, 2008
Posts: 119

posted Oct 16, 2009 02:40:36

0

Major problem, The code executes only when I am connected to the internet. If I am offline and start the tomcat it gives me this error

This is strange. Why should it be dependent on whether I am online or offline. I had executed Struts one year back. But it had executed even without I being connected to the internet.