الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

JSP & TomCat

مغلق
بدأه سليم في 25 مارس 2003 · 9 رد · 1,598 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بسم الله الرحمن الرحيم

السلام عليكم ورحمة الله وبركاته

اخواني في المنتدى

أحب أن أسال عن طريقة تركيب سيرفر لصفحات JSP

(أو عن طريق تشغيل صفحات JSP )

مجــلد TomCat موجود عندي.

وحاولت تشغيل صفحات JSP من خلاله أكثر من مره لكن لم استطيع .

وهل يمكن تشغيله من خلال IIS أو Apache .

وشكرا......

#2

نعم بالطبع فانت تتحدث عن مشكلتي

انا شغلت صفحات JSP على tomcat فقط و لكن ليس هذا ما اريده با اريد تشغيله على IIS و يوجد طريقة و لكنها معقدة و صعبة ارجو ان نتساعد انا و انت في حل هذا الموضوع

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why

#3

شكرا أخي Java Man على التجاوب

سأحاول البحث ان شاء الله (clock)

وسابلغك بكل جديد

#4

السلام عليكم

اخوتي الاحبه

ان عمليه تشغيل JSP و servlets و EJB enterrpise java beans تتم عن طريقه تشغيل سرفر بما يسمى java server application هناك عده سرفرز في الاسواق ويعتبر احسنها في السوق:

- weblogic application server

- IBM web sephere

وهولاء مكلفين للغايه ولكن تم انشاء عده سرفرز في open source community حيث اني اشارك في وقت الفراغ. ومن افضلهم:

- JBOSS وهذا يعتبر من احسن الموجد في السوق ويمكنك ان تنشا java beans ايضا مع jsp و سرفلتس.

- TOMCAT وهو سرفر لل jsp و sevlets فقط.

جميع هولاء السرفرس لابد خلال التصميم من اتباع مواصفات j2ee من sun microsystem حيث انهم قاموا برسم الخريطه لانشاء السرفرس ومن ثم قامت عده شركات بانشاء سرفرس ومنها TOMCAT ولكنه يعتبر لل jsp , servelts فقط.

لكي يفهم السرفر كيف يشغل برامجكم لابد ان تقومو بانشاء ملف xml توضح للسرفر كيف يتعامل مع البرنامج تبعك حيث انك لاتستطيع ان تجعل البرنامج يعمل بمجرد وضعه في مكان معين وهناك مع اي سرفر يوجد examples امثله ومن الافضل ان تقوم بقراءه تلك الامثله.

ملفات xml هي عباره عن بما يسمي application descriptor ويمكنك انشائه كتابه او عن طريق برنامج.

انا من راي ان تقرا في هذا الامر حيث انه new technology وجميع الشركات ذات الاعتماد علي الزبائن في دخلها تحولت الي هذا النظام. مثل البنوك وغيرها.

ابدا بالويب طبعا وهناك ماده تعليميه في sun في قسم الجافا ومن ثم اقرا كتاب و انا انصح بقراءه كتاب اسمه

java application programming طباعه WROX publications .

لابد من القراءه الكثيره اخوتي الاحبه في هذا الموضوع حيث انه مفيد للغايه اذا اردت الاتجاه في هذا المجال.

في امان الله

#5

نعم اخي و لكن Tomcat ليس فقط كما قلت بل يمكن ربطه بانظمة مخدمات اخرى مثل IIS و Apache

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why

#6

السلام عليكم

اخي java man انت محق نعم يمكنك ان تربطه مع web servers .

مثال عمله كمثل عمل cgi-bin وهو عباره عن jsp +servelets container. لو تلاحظ انك خلال تركيبك لهذا السرفر لابد من وضع بورت معينه خاصه بالسرفر ويمكنك ان تحددها بعكس web server حيث يعمل علي بورت 80 .

tomcat سرفر متحد لوحده وربطك به يتم عن طريق ما يسمي ب plugin و تحويل اي مستخدم يطلب صفحات خاصه فيها بورت معينه الي tomcat server.

لو تلاحظ ان معظم الملفات العاديه للويب في دوماين واحد لايهمك ان تسجلها بل تضع الملف في docs ويقوم السرفر بعرضها. اما بالنسبه لل jsp فلا بد من ان يقوم السرفر بتحليلها وعمل كومبايل لها ومن ثم عرضها ولذلك يلزم تسجيلها وخلال معرفتي ب weblogic سرفر هناك config يعلم السرفر انه في اي حاله يوجد ملف جديد قم بتسجيله تلقائيا ولكن لابد من اخبار السرفر كيف يتم التعامل مع الملفات.

لدي TOMCAT 4 في لينكس وإن شاء الله سوف اقوم بعمل مثال عليه. ما رايك ان تقوموا كذلك بعمل امثله ومن ثم مناقشتها هنا لكي نتعلم من بعض؟

في امان الله

#7

السلام عليكم

هذا ما وجدته في TOMCAT website بالنسبه كيف يمكنك ان تجعل برنامجك يعمل مع السرفر:

http://jakarta.apache.org/tomcat/tomcat-4....deployment.html

لاحض العنوان في الصفحه ب

Web Application Deployment Descriptor

وهو يتبع سرفلت docs من sun

وهذا مثال:

<?xml version="1.0" encoding="ISO-8859-1"?>



<!DOCTYPE web-app 

    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 

    "http://java.sun.com/dtd/web-app_2_3.dtd">



<web-app>





    <!-- General description of your web application -->



    <display-name>My Web Application</display-name>

    <description>

      This is version X.X of an application to perform

      a wild and wonderful task, based on servlets and

      JSP pages.  It was written by Dave Developer

      (dave@mycompany.com), who should be contacted for

      more information.

    </description>





    <!-- Context initialization parameters that define shared

         String constants used within your application, which

         can be customized by the system administrator who is

         installing your application.  The values actually

         assigned to these parameters can be retrieved in a

         servlet or JSP page by calling:



             String value =

               getServletContext().getInitParameter("name");



         where "name" matches the <param-name> element of

         one of these initialization parameters.



         You can define any number of context initialization

         parameters, including zero.

    -->



    <context-param>

      <param-name>webmaster</param-name>

      <param-value>myaddress@mycompany.com</param-value>

      <description>

        The EMAIL address of the administrator to whom questions

        and comments about this application should be addressed.

      </description>

    </context-param>





    <!-- Servlet definitions for the servlets that make up

         your web application, including initialization

         parameters.  With Tomcat, you can also send requests

         to servlets not listed here with a request like this:



           http://localhost:8080/{context-path}/servlet/{classname}



         but this usage is not guaranteed to be portable.  It also

         makes relative references to images and other resources

         required by your servlet more complicated, so defining

         all of your servlets (and defining a mapping to them with

         a servlet-mapping element) is recommended.



         Servlet initialization parameters can be retrieved in a

         servlet or JSP page by calling:



             String value =

               getServletConfig().getInitParameter("name");



         where "name" matches the <param-name> element of

         one of these initialization parameters.



         You can define any number of servlets, including zero.

    -->



    <servlet>

      <servlet-name>controller</servlet-name>

      <description>

        This servlet plays the "controller" role in the MVC architecture

        used in this application.  It is generally mapped to the ".do"

        filename extension with a servlet-mapping element, and all form

        submits in the app will be submitted to a request URI like

        "saveCustomer.do", which will therefore be mapped to this servlet.



        The initialization parameter namess for this servlet are the

        "servlet path" that will be received by this servlet (after the

        filename extension is removed).  The corresponding value is the

        name of the action class that will be used to process this request.

      </description>

      <servlet-class>com.mycompany.mypackage.ControllerServlet</servlet-class>

      <init-param>

        <param-name>listOrders</param-name>

        <param-value>com.mycompany.myactions.ListOrdersAction</param-value>

      </init-param>

      <init-param>

        <param-name>saveCustomer</param-name>

        <param-value>com.mycompany.myactions.SaveCustomerAction</param-value>

      </init-param>

      <!-- Load this servlet at server startup time -->

      <load-on-startup>5</load-on-startup>

    </servlet>



    <servlet>

      <servlet-name>graph</servlet-name>

      <description>

        This servlet produces GIF images that are dynamically generated

        graphs, based on the input parameters included on the request.

        It is generally mapped to a specific request URI like "/graph".

      </description>

    </servlet>





    <!-- Define mappings that are used by the servlet container to

         translate a particular request URI (context-relative) to a

         particular servlet.  The examples below correspond to the

         servlet descriptions above.  Thus, a request URI like:



           http://localhost:8080/{contextpath}/graph



         will be mapped to the "graph" servlet, while a request like:



           http://localhost:8080/{contextpath}/saveCustomer.do



         will be mapped to the "controller" servlet.



         You may define any number of servlet mappings, including zero.

         It is also legal to define more than one mapping for the same

         servlet, if you wish to.

    -->



    <servlet-mapping>

      <servlet-name>controller</servlet-name>

      <url-pattern>*.do</url-pattern>

    </servlet-mapping>



    <servlet-mapping>

      <servlet-name>graph</servlet-name>

      <url-pattern>/graph</url-pattern>

    </servlet-mapping>





    <!-- Define the default session timeout for your application,

         in minutes.  From a servlet or JSP page, you can modify

         the timeout for a particular session dynamically by using

         HttpSession.getMaxInactiveInterval(). -->



    <session-config>

      <session-timeout>30</session-timeout>    <!-- 30 minutes -->

    </session-config>





</web-app>
#8

اخي العزيز و الغالي bawazeem

انا ارغب بشدة ان انجح في ربط Tomcat مع IIS و قد حاول محاولات عديدة جدا و بطرق مختلفة و لم انجح و سوف اعرض عليكم كل محاولاتي لنتناقش حولها

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why

#9

السلام عليكم

اخي العزيز java man

لقد وجدت هذا الموقع في اباتشي وهو يشرح عمليه ربط TOMCAT مع IIS ومع اباتشي سرفر.

http://jakarta.apache.org/tomcat/tomcat-4....config/ajp.html

انا لست من محبين IIS ولم اعمل عليه بتاتا ولكن افضل اباتشي ويمكنك ربطه مع اباتشي بسهوله وممكن ان اساعد في البحث بالنسبه لاباتشي اما IIS فليس عندي IIS. :(

اذا لم تستخدم IIS كل ما ستفقده هو كتابه ASP صفحات ومن خلال التجربه كتابه JSP , ASP لها نفس النتيجه وياتي هنا سوال اي منهما ترغب؟ حتي الكتابه ب PERL لها نفس النتيجه ولكن PERL اصبحت قديمه مع انها لا زالت تستعمل في مواقع مهمه كثيره. واعتقد انه من الاحسن لنا ان نقوم بمعرفه كل منهم ولكن لا اعرف من اين احصل علي IIS وكل ما اعرفه انه ياتي مع windows server مجانا.

في امان الله

اخيك المحب محمد

#10

نعم اخي ولكنني ارغب ان يكون مخدمي يجمع بين اللغتين و هذا هو الهدف و اذا نجحت فسيكون الامر رائع جدا على كل حال سوف اقرء المقال و شكرا جزيلا لك

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why

هذا الموضوع مغلق.

مواضيع مشابهة