struts images problem

P

pluto

Hello,
I have a login as follow:

1)my index.jsp link to a login page with 2 text fields for Id and Password
and a submit button
2)when the user click the submit button he back to the index.jsp but lost
all images file
Anyone could tell me why?

TIA

1)<action
path="/viewsignin"
parameter="/security/signin.jsp"
type="org.apache.struts.actions.ForwardAction"
scope="request"
name="loginForm"
validate="false"
input="/index.jsp">
</action>



2)<action
path="/signin"
type="com.mycompany.struts.mydemo.security.LoginAction"
scope="request"
name="loginForm"
validate="true"
input="/security/signin.jsp">
<forward name="Success" path="/action/home"/>
<forward name="Failure" path="/security/signin.jsp" redirect="true"/>
</action>
 
W

Wendy S

pluto said:
1)my index.jsp link to a login page with 2 text fields for Id and Password
and a submit button
2)when the user click the submit button he back to the index.jsp but lost
all images file
Anyone could tell me why?

Post the JSP and the generated HTML (view the source in your browser). I've
had the ?jsessionid get appended to links, which causes them not to be
found. Remember that images are requested by the browser separately, so the
URL's need to work from the *client* side, not the server side.
 
P

pluto

Post the JSP and the generated HTML (view the source in your browser).
I've had the ?jsessionid get appended to links, which causes them not to be
found.

Here is an example of the generated HTML, anyway not all a href have an
?id=something

<td width="104" align="center">
<a href="/my_demo/action/viewitemdetail?id=116"><img border="0"
src="multimedia/c.gif"/></a>
</td>

<td width="104" align="center">
<a href="/my_demo/action/viewitemdetail?id=115"><img border="0"
src="multimedia/image2.jpg"/></a>
</td>

<td width="104" align="center">
<a href="/my_demo/action/viewitemdetail?id=114"><img border="0"
src="multimedia/image3.gif"/></a>
</td>

<td width="104" align="center">
<a href="/my_demo/action/viewitemdetail?id=113"><img border="0"
src="multimedia/image4.gif"/></a>
</td>


Remember that images are requested by the browser separately, so the
URL's need to work from the *client* side, not the server side.

What do you mean? What should I do? How do you solved your problems?



TIA
 
K

KD

Hi

If you page url is for example
http://localhost:8080/someapp/someaction.do

then according to your html below, your pictures should be found in the
folder http://localhost:8080/someapp/multimedia

Browse to this URL and see if you can see you images. I think you wont.
You need to change your URL, using the following:

/ - starts at the root of the webserver
.../ - starts at folder one folder below the current one

Also take a look at the HTML rewrite tag. It will give you some tips,
even if you do not use it.

-Karim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top