cancel
Showing results for 
Search instead for 
Did you mean: 

Webdynpro VS. Java Servlets

Former Member
0 Kudos

Hello,

Can anyone answer me following questions ?

1) Can I somehow combine Webdynpro project and Java servlet? I need to call Java Servlet from the link of Webdynpro View. Can I somehow packaged my servlet classes in Webdynpro and expecting that it will be run.

Or I must deploy servlet standalone (into servlet container) ?

2) How can I deploy and run simple Java Servlet ?

I must to embed it in j2ee web project (resulting in .war) and than deploy ? and how ? or I must to embed .war in whole j2ee aplication project (resulting in .ear) and deploy ?

3) When I call standalone servlet from Webdynpro aplication to do work through url link, can I somehow find out which user is logged, in servlet ?

4) How can I code in Webdynpro, that on action (referenced by button activate) it will appear a new web browser window, in which I can paste some data that want to obtain by reading a file from another url-link (obtained by RFC call). I cant paste simple link, because of firewall.

5) when I try to make RFC call, in webdynpro action (referenced by button click), it will make an exception with message < 'mshost' missing >. But when make pure Java application which has this code, it will run ok (I use a jco library).

Thanks for anyone who can answer some of my questions.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Miroslav,

I'll try to answer some of your questions. Not sure how far these would be helpful to you:-

<b>1 & 2)</b>Regarding the usage of servlets, you have two options to make use of a servlet:

1) In the J2EE perspective of your NWDS, you can create a servlet through a Web Module project and bundle it into an ear (through Enterprise application project) and deploy this ear in your WAS server. Don't forget to give the servlet mapping in your web.xml and the context root in your application.xml. Then you can access this servlet directly through the url http://server:port/context-root/servlet/servlet name

2) You can create a servlet as a portal component (PAR file) and deploy the par file in your server. Then you can access the servlet as you access any other portal component. For this :-

a. Create a servlet, that is, a java class that extends HttpServlet.

b. In the deployment descriptor of your portal application, define a configuration property named ComponentType and assign it a value of servlet, as shown below:

<components>

<component name="ServletTest">

<component-config>

<property name="ClassName" value="com.sapportals.portal.prt.component.ServletTest"/>

<property name="ComponentType" value="servlet"/>

</component-config>

</component>

c. Put the compiled servlet class in the private lib or classes folder.

<b>3)</b> I don't think you can retrieve the current user when you access the servlet through the url. Because the servlet runs without any authentication and hence doesn't run from the user's space.

<b>4)</b> If you could give us a clearer picture, we may be able to help you.

<b>5)</b>Sorry, I don't know why this error appears.

Best Regards,

Nibu.