Hi,
here is a sample code.
jsp
----------------------
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
prefix="logic" %>
<html:html locale="true">
<head>
<title><bean:message key="welcome.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:notPresent name="org.apache.struts.action.MESSAGE"
scope="application">
<font color="red">
ERROR: Application resources not loaded -- check servlet container
logs for error messages.
</font>
</logic:notPresent>
<h3><bean:message key="welcome.heading"/></h3>
<p><bean:message key="welcome.message"/></p>
<a href="./MyServlet">Servlet Welcome Page</a>
</body>
</html:html>
This <a href> will call the servlet MyServlet in my web.xml
web.xml
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.myapp.servlets.MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>
Thanks,
Nuwan
John Mammen wrote:
Hi Nuwan,
Can you tell me how you did that? A code snipet would do nicely :)
Thanks,
John.
-----Original Message-----
From: Nuwan Chandrasoma [mailto:[EMAIL PROTECTED]
Sent: Friday, July 27, 2007 10:45 PM
To: Struts Users Mailing List
Subject: Re: Invoking Servlets from JSP
Hi,
I have a struts app which has servlets also , i just call the servlet
mapping in my web.xml from my jsp.
Thanks,
Nuwan
John Mammen wrote:
Hi,
What is the best way to invoke a Servlet from a JSP in the struts framework?
I have a login page. When the user clicks 'Log-in', the control should go to a
Servlet outside the struts framework.
Regards,
John.
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not to copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is not
liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]