Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!

Tim Eyre

Greenhorn
+ Follow
since May 20, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Eyre

Hi,
I am having a problem printing more than 42 variables in the same JSP from a bean using the following code:
<bean:write name="result" property="metric1"/>
Even if I just print the same one over and over again I get the following error message:
An error occurred at line: 70 in the jsp file: /STPMetricsTree.jsp
Generated servlet error:
/home/gstb-docs/tomcat/gstb/work/localhost/StrutsReportsDev/STPMetricsTree$jsp.java:1361: Variable _jspx_eval_bean_write_42 may not have been initialized.
if (_jspx_eval_bean_write_42 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
Is there a maximum number of variables I can use?
I am using Struts running on Tomcat.
Thanks
Tim
15 years ago
JSP
Hi,
In certain situations I want to get an ActionServlet to populate an action form and then forward to another ActionServlet. The second ActionServlet MUST have an associated ActionForm because users are able to populate it from an HTML form in the usual manner.
Can I populate the ActionForm and put it as an attribute in session/request scope so that it will be passed into my perform() method?
Thanks
Tim
15 years ago
Does anyone know how I dynamically set the contentType of a page? I want to give my users the option of seeing their results as an excel spreadsheet, or in HTML format. Effectively I want to do:

But this will always run the report in Excel. I'm sure I need to set the contentType first and then dispatch the request, but am unsure how to do this in Struts.
Any ideas?
Thanks
Tim
15 years ago
Thank you for your help, Michael.
In my JSP I have:

I am now getting the error:
"Cannot find bean under name name" - so it is expecting the labelName attribute to be a bean
My form bean has a field "office" with the associated getOffice() and setOffice() methods.
The relevant parts of my User bean are:

And my Office bean is:

You say I need to set up two collections, one for the OfficeID (here I called it "num") and one for the name - can I not have one collection of beans, each bean having a method for num and a method for name. It seems much cleaner this way.
Should I be using the collection attribute in the option tag? Trouble is it expects a collection of beans, and all I can offer is the user bean which has a collection of office beans as an instance variable - I have tried the attribute:
collection="user.getOffices()", but to no avail.
How can I store a collection of beans as a bean? - surely I can only store a collection of beans as an ArrayList (or some other Java collection)?
Thanks
Tim
15 years ago
I have a bean called "user" which has contains an ArrayList calles "offices" of Office objects. In the Office object there is a field called "name". The name field is accessible via getName() and setName() methods.
I want to display all these names as an HTML select tag, and I would have thought the following would work:
<html:select name="user" property="offices">
<html ptions name="user" property="offices" labelProperty="name"/>
</html:select>
But I just get the error:
No getter method available for property name for bean under name null
Any ideas?
Thanks
Tim
15 years ago
I have exactly the same problem, but my bean:write name attribute is pointing to my logic:iterate id attribute:
<logic:iterate id="rep" name="user" property="reports">
<tr>
<td align="left">
<bean:write name="rep" property="name" filter="true"/> </td>
<td align="left">
<bean:write name="rep" property="description" filter="true"/> </td>
</tr>
</logic:iterate>
My report bean is defined as follows:
public class Report {
String name = "REPBEAN";
String description = "Empty report bean";
Report(String name, String description) {
this.name = name;
this.description = description;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return this.description;
}
public String toString() {
return "Report: " + name + ", Description: " + description;
}
}
And my User bean is:
public class User implements Serializable {
private String username = null;
private Report[] reports = null;
User (String username) {
this.username = username;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public void setReports(Report[] reports) {
this.reports = reports;
}
public Report[] getReports() {
return this.reports;
}
}
And they get populated by the following code:
User u = new User("timmy");
Report r1 = new Report("this", "works");
Report r2 = new Report("this", "works too");
Report reps[] = new Report[2];
reps[0] = r1;
reps[1] = r2;
u.setReports(reps);
HttpSession session = request.getSession();
session.setAttribute("user", u);
Any ideas? I've tried every combination of the scope attribute, but I still get:
"Cannot find bean rep in scope ???"
Thanks for any help you can give.
Tim
[ November 26, 2002: Message edited by: Tim Eyre ]
15 years ago
Rene, Sanpra,
etek merely brought down Tomcat.
What is SVA?
Thanks
Tim
15 years ago
JSP
Sanpra,
Thanks for the advice. I am trying it now...
I want to display some graphs and charts in a JSP. If you know a better way of doing it rather than converting into JPEG and embedding within the HTML, then please let me know.
Thanks
Tim
15 years ago
JSP
Thanks Rob.
Do I need to do this in catalina.sh?
Tim
15 years ago
JSP
I am trying to display some graphics in a JSP.
I have tried using a JPEGImageEncoder to convert from Graphics2D into a JPEG, but I get the error: "Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable"
Other questions on the forum have suggested installing X-windows on my pc, but the app I'm writing runs on unix and is to be used by many users - I can't install X-windows on all of their pc's.
Does anyone know how to get round this?
Or does anyone know a better way of displaying graphics in a JSP/Servlet.
Thanks
Tim
15 years ago
JSP
Thanks Inam, my problem was that I needed to stop and restart tomcat.
Thanks
Tim
15 years ago
JSP
I am running Tomcat in UNIX, and have put a jar file called jconn2.jar in WEB-INF/lib. This contains the JDBC drivers needed.
In my JSP I import com.sybase.jdbcx.SybDriver, but when I run the JSP it says "Class not found in import".
Is the WEB-INF not the correct location for this file?
Thanks
Tim
15 years ago
JSP
There are no files in the logs directory to look at.
Tim
15 years ago
Hello,
I managed to get Tomcat working at home and am now trying at my office, and am not getting the same results. When I run %CATALINA_HOME%/startup.bat I get the following:
Using CATALINA_BASE: Z:\Tomcat\jakarta-tomcat-4.0\
Using CATALINA_HOME: Z:\Tomcat\jakarta-tomcat-4.0\
Using CLASSPATH: Z:\Tomcat\jakarta-tomcat-4.0\bin\bootstrap.jar:c:\j2sdk1.4.1\\lib\tools.jar
Using JAVA_HOME: c:\j2sdk1.4.1\
And then I get a DOS window pop up and then disappear very quickly. And thats it.
Do I have to make any other changes because I am connected to a LAN?
Thanks
Tim
15 years ago
Thank you Rene, it works fine now.
Tim
15 years ago