Results 1 to 6 of 6

Thread: <img src>

  1. #1

    Default <img src>

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

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney
    Posts
    503

    Default

    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.

  3. #3

    Default

    Quote 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

  4. #4

    Default

    <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>

  5. #5
    Join Date
    Aug 2004
    Location
    Sydney
    Posts
    503

    Default

    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.

  6. #6
    Join Date
    Aug 2004
    Posts
    123

    Default

    Quote 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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •