Announcement Announcement Module
Collapse
No announcement yet.
<img src> Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • <img src>

    How to determine src in tag <img> for .jsp page. I still cann't see any image in my browser.

  • #2
    Can you post what you're doing?

    Show:
    - The img tag
    - Any Spring handler mappings you've got, which might be trying to handle the image request.
    - web.xml, which I think needs to have *.gif, say, if you have a .gif image.

    Comment


    • #3
      Originally posted by gmatthews
      Can you post what you're doing?

      Show:
      - The img tag
      - Any Spring handler mappings you've got, which might be trying to handle the image request.
      - web.xml, which I think needs to have *.gif, say, if you have a .gif image.
      Could You show me some example how to do that, I have no idea how my Spring
      handler mappings suppose to looks like, the same with my web.xml

      Comment


      • #4
        <img src="/images/login_button.gif"> - img tag

        HTML Code:
        <?xml version="1.0" encoding="UTF-8"?>
        <!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>
         	<display-name>Aplikacja</display-name>
         	<context-param>
         		<param-name>contextConfigLocation</param-name>
         		<param-value>/WEB-INF/spring-context.xml</param-value>
         	</context-param>
         	
         	<listener>
         		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
         	</listener>
         	
         	<servlet>
         		<servlet-name>appServlet</servlet-name>
         		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
         	</servlet>
         	
         	<servlet-mapping>
         		<servlet-name>appServlet</servlet-name>
         		<url-pattern>*.html</url-pattern>
         	</servlet-mapping>
         </web-app>
        HTML Code:
        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
        		"http://www.springframework.org/dtd/spring-beans.dtd">
        <beans>
        <!-- mapowanie URI na odpowiedni kontroler -->
        	<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        	<property name="mappings">
        		<props>
        			<prop key="/login.jsp">loginController</prop>
        			<prop key="/index.jsp">indexController</prop>
        		</props>
        	</property>	
        	</bean>
        	
        <!-- definicja obiektu kontrolera loginController -->
        	<bean id="loginController"
        		class="controllers.LoginController">
        		<constructor-arg>
        			<ref bean="service"/>
        		</constructor-arg>
        		<property name="formView">
        			<value>login</value>
        		</property>
        		<property name="successView">
        			<value>listProjectsRedirect</value>
        		</property>
        	</bean>
        
        <!-- definicja obiektu kontrolera projektController -->
        	<bean id="projektController"
        		class="controllers.ProjektController">
        		<constructor-arg>
        			<ref bean="service"/>
        		</constructor-arg>
        		<property name="formView">
        			<value>login</value>
        		</property>
        		<property name="successView">
        			<value>login</value>
        		</property>
        	</bean>
        	
        <!-- definicja obiektu kontrolera index, kontroler typu ParameterizableViewController (bezposrednie zadanie view) -->
        	<bean id="indexController" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
            	<property name="viewName" value="index" />
        	</bean>
        	
        	<bean id="viewResolver"
        	 	class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        	 	<property name="viewClass"><value>org.springframework.web.servlet.view.InternalResourceView</value></property>
        		<property name="prefix"><value>/WEB-INF/jsp/</value></property>
        		<property name="suffix"><value>.jsp</value></property>
        	</bean>
        	
        	<bean id="listProjectsRedirect"
        		class="org.springframework.web.servlet.view.RedirectView">
        		<property name="url">
        			<value>/login.jsp</value>
        		</property>
        		<property name="contextRelative">
        			<value>true</value>
        		</property>
        	</bean>
        </beans>

        Comment


        • #5
          Try this.

          1. <img src="images/login_button.gif"/>

          2. Put login_button.gif in an images directory in the top level of your war.

          That should do it. The web.xml entries are only needed if your app was going to handle supplying the images as opposed to the web container.

          Comment


          • #6
            Originally posted by karol_lo
            How to determine src in tag <img> for .jsp page. I still cann't see any image in my browser.
            Did you try the stuff I suggested in your earlier message?

            Comment

            Working...
            X