• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Using both struts html:link and bean:write error

 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone:
I write a struts app and have a problem.I use the html:link and bean:write TAG together.I want to use them display topic and add a hyperlink in these topic.
Code is:
<td><a href="/viewtopic.do?id=<bean:write name="love" property="id"/>"><bean:write name="love" property="title"/>
The topic can display property.When I move mouse to the topic the statusbar disply:"http://localhost:3030/viewtopic.do?id=8"
But when I click the hyperlink Tomcat report error:
//////////////////////////////////////////////////////////
HTTP Status 400 - Invalid path /viewtopic was requested
--------------------------------------------------------------------------------
type Status report
message Invalid path /viewtopic was requested
description The request sent by the client was syntactically incorrect (Invalid path /viewtopic was requested).
///////////////////////////////////////////////////////////////////////
But I add the forward in my struts-config.xml.This:
/////////////////////struts-config.xml//////////////////////////////
................................................
<forward name="viewtopic" path="/viewtopic.do"/>
..........................................
<action path="/viewtopic" type="/viewtopic" actionClass="lyo.hotmail.bbs.Viewtopic">
<forward name="success" path="/jsp/viewtopic.jsp"/> </action>
Why this?
Do I mistake using Tag? :roll:
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again..
try to use the domain-relative instead of module-relative path.
for ex: instead of using "/viewTopic.do"..use something like
"/loveForum/[module]/viewTopic.do"
where the loveForum is your application context. U might also add the module (but you must reflect it in your struts config)

rgds
beN
 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
It also can't work.Error is:
HTTP Status 400 - Invalid path /jsp/viewtopic was requested
--------------------------------------------------------------------------------
type Status report
message Invalid path /jsp/viewtopic was requested
description The request sent by the client was syntactically incorrect (Invalid path /jsp/viewtopic was requested).
I try to use the html:link tag :
<html:link action="viewtopic.do?id=<bean:write name="love" property="id"/>"><bean:write name="love" property="title"/><html:link>
The action viewtopic is in my struts-config.xml:
////////////////////////////////////////////////////////////////////
<action path="/viewtopic" type="lyo.hotmail.bbs.Viewtopic" input="missfile.jsp">
<forward name="success" path="/jsp/viewtopic.jsp"/>
</action>
But it still can't work.Tomcat report error:
org.apache.jasper.JasperException: /jsp/loveforum.jsp(29,61) equal symbol expected
What it's mean? :roll:
 
Bernardus Irmanto
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refering back to your first post, You have the following tag..
<a href="/viewtopic.do?id=<bean:write name="love" property="id"/>">
try to use
<a href="[app_context]/viewtopic.do?id=<bean:write name="love" property="id"/>">
instead.
I had similar problem sometimes ago. It worked well when I change the "module-relative" path in the href attribute to "domain-relative" path
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I try it but it can't work also.I am using Tomcat4.1.18.My web app's context path is "/myweb".
After I change it to href="myweb/jsp/viewtopic.do?id=<bean:write ... ...", I move the mouse to the hyperlink,then the statusbar display "http://localhost:3030/myweb/jsp/myweb/jsp/viewtopic.do?id=4". When I click it Tomcat remain report the last error:
HTTP Status 400 - Invalid path /jsp/myweb/jsp/viewtopic was requested
--------------------------------------------------------------------------------
type Status report
message Invalid path /jsp/myweb/jsp/viewtopic was requested
description The request sent by the client was syntactically incorrect (Invalid path /jsp/myweb/jsp/viewtopic was requested).
////////////////////////////////////////////////////////////////////
I am also change to href="/myweb/jsp/viewtopic.do?id=<bean... ..."
Statusbar display :"http://localhost:3030/myweb/jsp/viewtopic.do?id=4"
But it can't work too.error is:
///////////////////////////////////////////////////////////
HTTP Status 400 - Invalid path /viewtopic was requested
--------------------------------------------------------------------------------
type Status report
message Invalid path /viewtopic was requested
description The request sent by the client was syntactically incorrect (Invalid path /viewtopic was requested).In Tomcat console:
///////////////////////////////////////////////////////////////////////
2003-10-7 19:08:18 org.apache.struts.action.RequestProcessor processMapping
server: Invalid path /viewtopic was requested
:roll:
So I think the html tag href can't be used with the struts TAG.Now I am thinking that I will use the "<html:link action paramId .. paramName ..>" Tag.
The problem now is after I change the code to
<html:link action="/viewtopic.do" paramName="lovebean" paramProperty="id" paramId="id"><bean:write name="love" property="title"/></html:link>
I add the article data to arraylist ,later add the arraylist to request.setAttribute("lovetable",listdata);
jsp code is:
////////////////////////////////////////////////////
<logic:iterate id="love" name="lovetable">
<td><bean:write name="love" property="id"/></td>
<td><html:link action="viewtopic.do" paramName="lovetable" paramProperty="id" paramId=""><bean:write name="love" property="title"/></html:link></td>
<td><bean:write name="love" property="name"/></td>
<td><bean:write name="love" property="time"/></td>
</tr>
</logic:iterate>
Report error is:
org.apache.jasper.JasperException: No getter method for property id of bean lovetable
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
////////////////////////////////////////////////////////
The lovetable is list and it don't have getter or setter indeed.whether I take a mistake while using the tag <html:link action=...>?HOw to use it?
 
lyo Yashnoo
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I use bean efine Tag successful and it can work property.
my code is:
<logic:iterate id="love" name="lovetable">
<bean efine id="idbean" name="love"/>
<%
String color=(i%2==0)?"white":"#CCC000";
%>
<tr bgcolor="<%=color%>">
<td><bean:write name="love" property="id"/></td>
<td><html:link forward="viewtopic" paramId="id" paramName="idbean" paramProperty="id"><bean:write name="love" property="title"/></html:link></td>
<td><bean:write name="love" property="name"/></td>
<td><bean:write name="love" property="time"/></td>
</tr>
<%

i++;
%>
</logic:iterate>
Thks for your help
 
lyo Yashnoo
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry I forget to forbidden express symbol
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use this it will solve your problem.

">text

Thanks,
niranjan
 
niranjan smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use this it will solve your problem.

">text


Thanks,
niranjan
 
Sheriff
Posts: 9697
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
lyo Yashnoo please Use Code Tags when you post a source code. You can edit your message using button and then add code tags to it...
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic